编辑:我找到了解决方案,但现在cakePhp本身存在问题
我正在使用:
<?php if (isset($image)) echo $this->Html->meta(array('name' => 'og:image', 'content' => $image)); ?>
并生成
<meta name="og:image" content="https://test.com/img/sharer/startseite.jpg"/>
可悲的是Facebook不喜欢/&gt;最后(在此处Facebook Open Graph Error - Inferred Property)
我必须使用空格 - 但CakePhp会以这种方式生成它。有什么想法吗?
答案 0 :(得分:1)
在CakePHP 3中,您可以在vendor/cakephp/cakephp/src/View/Helper/HtmlHelper.php
中找到HTML帮助程序的模板。
将这些内容复制到config/templates/html-templates.php
并根据您的要求进行增强。
然后,在\App\Controller\AppController
中添加
public $helpers = [
...
'Html' => ['templates' => 'templates/html-templates'],
];
并像往常一样使用HTML帮助器。