【发布时间】:2020-06-28 12:11:21
【问题描述】:
如何删除 Oxwall 软件或任何软件中的元标记。 Oxwall 核心加载自动错误的 Facebook 元标记。
错误值(由 Oxwall 生成):
<meta name="og:type" content="website" />
正确值:
<meta property="og:type" content="website" />
提前致谢
【问题讨论】:
如何删除 Oxwall 软件或任何软件中的元标记。 Oxwall 核心加载自动错误的 Facebook 元标记。
错误值(由 Oxwall 生成):
<meta name="og:type" content="website" />
正确值:
<meta property="og:type" content="website" />
提前致谢
【问题讨论】:
您可以在基本或插件 init.php 文件中包含以下行。如果您不使用插件,请打开 /ow_system_plugins/base/init.php 并添加以下代码:
function modify_custom_meta_property(){
OW::getDocument()->addMetaInfo('og:type', 'website', 'property');
}
OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, 'modify_custom_meta_property');
【讨论】:
我终于找到了解决办法。
你必须这样做:
例子:
// $document->addMetaInfo("og:type", "website");
转到 /ow_system_plugins/base/init.php 并在文件顶部添加如下代码:
函数 modify_custom_meta_property(){
OW::getDocument()->addMetaInfo('og:type', 'website', 'property');
OW::getDocument()->addMetaInfo('og:title', '你的头衔在这里', 'property');
}
OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, 'modify_custom_meta_property');
清除您的网站缓存并查看您页面的源代码,现在应该添加正确的元数据并且错误的元数据已消失。
【讨论】: