0

EDIT: I found the solution, but now there is a problem with cakePhp itself

I am using:

<?php if (isset($image)) echo $this->Html->meta(array('name' => 'og:image', 'content' => $image)); ?>

and it generates

<meta name="og:image" content="https://test.com/img/sharer/startseite.jpg"/>

Sadly Facebook doesn´t like the /> at the end (related here Facebook Open Graph Error - Inferred Property )

I have to use it with a space - but CakePhp generates it that way. Any ideas?

Community
  • 1
  • 1
Isengo
  • 2,004
  • 3
  • 21
  • 43

1 Answers1

1

In CakePHP 3, you can find templates for the HTML helper in vendor/cakephp/cakephp/src/View/Helper/HtmlHelper.php.

Copy those to config/templates/html-templates.php and enhance them according to your demands.

Then, in your \App\Controller\AppController, add

public $helpers = [
  ...
  'Html' => ['templates' => 'templates/html-templates'],
];

and use your HTML helper as usual.

code-kobold
  • 829
  • 14
  • 18