如何在Joomla中添加itemscope到标签?

问题描述 投票:0回答:1

我有一个包含丰富摘要的常见问题解答页面。Google搜索无法识别。我仍然需要将itemscope itemtype =“ https://schema.org/FAQPage”添加到html标签。

如何修改1个特定页面的html标签?我的html标签当前看起来像这样:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr">
...
</html>

如何添加代码并使它看起来像这样?仅一页?

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr" itemscope itemtype="https://schema.org/FAQPage>
...
</html>

非常感谢您提供任何提示。

PS:我从RicheyWeb安装了HeadTag插件。这样可以轻松地在页面顶部添加内容。但是我不能直接添加到html标签。

joomla3.0 google-rich-snippets
1个回答
0
投票

如果您的页面可行,您是否考虑过将结构化数据放在页面上的JSON代码段中?

我在下面的“常见问题解答”页面中提供了一个示例JSON脚本。

这是页面上的外观:https://codepen.io/panchroma/pen/zYYaRea

并且此页面在Google Structured Snippet Validator上验证,

下面的屏幕截图。

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS94cU1tdC5qcGcifQ==” alt =“在此处输入图像描述”>]

FWIW,here's an online generator for an FAQ Structured Data JSON snippet

我希望这会有所帮助,祝你好运!

示例FAQ JSON代码段

<script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "FAQPage",
      "mainEntity": [
        {
          "@type": "Question",
          "name": "Question 1",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Answer 1"
          }
        },
        {
          "@type": "Question",
          "name": "Question 2",
          "acceptedAnswer": {
            "@type": "Answer",
            "text": "Answer 2"
          }
        }
      ]
    }
</script>  
© www.soinside.com 2019 - 2024. All rights reserved.