【问题标题】:Joomla is not showing punctuation marks in meta descriptionJoomla 在元描述中没有显示标点符号
【发布时间】:2016-03-23 06:55:20
【问题描述】:

我正在尝试以编程方式在自定义 Joomla 组件中设置元“描述”标签。

当我调用“setDescription”时,它会添加元描述,但没有任何标点符号(“!”标记除外)。

我尝试了以下所有方法:

$this->document->setDescription("This is, just, a sample meta description! Good luck.");

$this->document->description = "This is, just, a sample meta description! Good luck.";

$this->document->setMetaData("description", "This is, just, a sample meta description! Good luck.");

但在上述所有尝试中,我看到了以下 HTML 代码:

<meta name="description" content="This is just a sample meta description! Good luck">

不显示逗号...不显示句号...只显示感叹号。

注意 1: 这似乎是 Joomla 的默认行为......它省略了所有“标点”标记,只允许“!” (可能是因为Joomla的全名“Joomla!”需要一个感叹号)。我在 Joomla 文章中也注意到了这种行为。

注意 2: 逗号正确出现在元关键字中......但就我而言,我还需要在描述中显示标点符号。

有人遇到并解决过这样的问题吗?

【问题讨论】:

  • 注 3:我尝试使用实体字符(例如,对于逗号,我使用了 &44;)...但是再次... Joomla 省略了 & 和分号 :(
  • 仅供参考。我们使用的是 Joomla 3.4.8 Stable。

标签: php joomla metadata comma punctuation


【解决方案1】:

原来问题不在于 Joomla 本身,而在于 YJSG 框架(我的模板所基于的框架)。

我主要是Joomla默认的“站点”模板,开始出现标点符号!

所以,我发现我需要编辑这个文件“yjsg.php”(位于 your_joomla_folder\plugins\system\yjsg)。在“onBeforeRender”函数下,必须去掉对“yjsg_clean_shortcodes”的调用。

这是 YJSG 代码中原始“有问题”链接的链接: https://github.com/YJSGframework/yjsg/blob/57546a9365ac4665ca43096a27de8c244f6dd742/yjsg.php#L868

我希望这可以帮助其他人节省一些宝贵的时间!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-17
    • 1970-01-01
    • 2019-09-17
    • 2021-08-12
    • 2012-05-16
    相关资源
    最近更新 更多