【问题标题】:Get magento header description in schema Product description in view.phtml获取架构中的 magento 标头描述 view.phtml 中的产品描述
【发布时间】:2014-08-07 15:44:59
【问题描述】:

在标题中,我有以下元描述代码。

<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />

我试图在 view.pthml 文件中将此描述作为我的架构产品描述,如下所示

<meta itemprop="description" name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />

但是“描述”在 google 丰富的 sn-ps 工具 (GRST) 上显示为空白

当我在 head.phtml 文件中包含和标记元描述时

<meta itemprop="description" name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />

带有&lt;span itemscope itemtype="Http://Schema.Org/Product" &gt; 的描述会显示在 GRST 上,但当然会破坏 view.phtml 上的其他产品项目类型。

那么如何让标题中的描述在 view.phtml 中显示为我的架构产品描述?

注意:不使用默认元描述(空白)名为 creare SEO 的扩展程序会根据属性创建元描述。

【问题讨论】:

标签: php magento seo schema magento-1.8


【解决方案1】:

这就是解决问题的方法

<?php $headBlock = $this->getLayout()->getBlock('head'); echo $description=$headBlock->getDescription(); ?>" />

感谢Amit Bera,参考post

【讨论】:

  • $headBlock = $this->getLayout()->getBlock('head');显示错误。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-09-23
  • 1970-01-01
  • 1970-01-01
  • 2016-10-19
  • 1970-01-01
  • 2019-07-29
  • 1970-01-01
相关资源
最近更新 更多