討論區 (DiscussionForumPosting) 結構化資料

插圖:討論和論壇功能

討論區標記適用於任何論壇式網站,這類網站會集結眾人分享的第一手觀點。論壇網站新增這個標記後,Google 搜尋就能更準確地辨識網站上的討論內容,並在「討論和論壇」、「觀點」等功能中運用這個標記。

如何在論壇中使用 DiscussionForumPosting

一般來說,我們建議在相關貼文下方以巢狀結構顯示留言。如果論壇有自己的討論串結構,請以樹狀結構的形式呈現留言:

{
  "@context": "https://schema.org",
  "@type": "DiscussionForumPosting",
  "headline": "Very Popular Thread",
  ...
  "comment": [{
    "@type": "Comment",
    "text": "This should not be this popular",
    ...
    "comment": [{
      "@type": "Comment",
      "text": "Yes it should",
      ...
    }]
  }]
}

如果論壇偏向線性討論 (例如原始貼文之後接著一連串回覆),請採用巢狀結構,將所有討論顯示為原始貼文下方的留言。在理想情況下,如果論壇包含多個頁面,後續的內容頁面會包含具有主頁面網址的原始貼文:

{
  // JSON-LD on non-threaded forum at https://example.com/post/very-popular-thread/14
  "@context": "https://schema.org",
  "@type": "DiscussionForumPosting",
  "headline": "Very Popular Thread", // Only the headline/topic is explicitly present
  "url": "https://example.com/post/very-popular-thread",
  ...
  "comment": [{
    "@type": "Comment",
    "text": "First Post on this Page",
    ...
  },{
    "@type": "Comment",
    "text": "Second Post on this Page",
    ...
  }]
}

如果網址主要關於單一貼文,請使用 mainEntity (或 mainEntityOfPage) 識別主要的 DiscussionForumPosting

{
  "@context": "https://schema.org",
  "@type": "WebPage",
  "url": "https://example.com/post/very-popular-thread",
  "mainEntity": {
    "@type": "DiscussionForumPosting"
    ...
  }
}

若是列出貼文清單的網頁 (例如個人資料、主題或類別頁面),通常不會在同一頁面上顯示完整資訊,使用者需要自行點選才能查看額外資訊 (例如回覆)。你可以選擇是否要只納入網頁上呈現的資訊,以及是否要納入討論專屬貼文的網址。

如果不是貼文的討論頁面,請不要將該頁面上的某篇貼文標示為主要實體。如要表示多個頁面是一系列互有關聯的貼文,可以將所有頁面附加到 CollectionItemList

如何新增結構化資料

結構化資料是一種標準化格式,能夠提供網頁相關資訊並分類網頁內容。如果您是第一次使用結構化資料,請參閱這篇文章,進一步瞭解結構化資料的運作方式。

以下簡要說明如何建立、測試及發布結構化資料。

  1. 新增必要屬性。根據您使用的格式,瞭解要在網頁中的什麼位置插入結構化資料
  2. 遵循指南規範
  3. 使用複合式搜尋結果測試驗證程式碼,並修正所有重大錯誤。此外,我們也建議您修正工具中可能標記的任何非重大問題,因為這有助於改善結構化資料的品質 (但並非符合複合式搜尋結果的顯示條件)。
  4. 部署幾個包含結構化資料的網頁,並使用網址檢查工具測試 Google 轉譯網頁的情形。請確認 Google 可以存取您的網頁,且網頁並未遭到 robots.txt 檔案或 noindex 標記封鎖,也未設有登入規定。如果網頁看起來沒問題,您可以要求 Google 重新檢索您的網址
  5. 為了讓 Google 掌握日後的異動內容,建議您提交 Sitemap。您可以使用 Search Console Sitemap API 自動執行這項操作。

範例

下列標記範例為非討論串式的線性論壇頁面:

JSON-LD

<html>
  <head>
    <title>I went to the concert!</title>
    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "DiscussionForumPosting",
      "mainEntityOfPage": "https://example.com/post/very-popular-thread",
      "headline": "I went to the concert!",
      "text": "Look at how cool this concert was!",
      "video": {
        "@type": "VideoObject",
        "contentUrl": "https://example.com/media/super-cool-concert.mp4",
        "name": "Video of concert",
        "uploadDate": "2024-03-01T06:34:34+02:00",
        "thumbnailUrl": "https://example.com/media/super-cool-concert-snap.jpg"
      },
      "url": "https://example.com/post/very-popular-thread",
      "author": {
        "@type": "Person",
        "name": "Katie Pope",
        "url": "https://example.com/user/katie-pope",
        "agentInteractionStatistic": {
          "@type": "InteractionCounter",
          "interactionType": "https://schema.org/WriteAction",
          "userInteractionCount": 8
        }
      },
      "datePublished": "2024-03-01T08:34:34+02:00",
      "interactionStatistic": {
        "@type": "InteractionCounter",
        "interactionType": "https://schema.org/LikeAction",
        "userInteractionCount": 27
      },
      "comment": [{
        "@type": "Comment",
        "text": "Who's the person you're with?",
        "author": {
          "@type": "Person",
          "name": "Saul Douglas",
          "url": "https://example.com/user/saul-douglas",
          "agentInteractionStatistic": {
            "@type": "InteractionCounter",
            "interactionType": "https://schema.org/WriteAction",
            "userInteractionCount": 167
          }
        },
        "datePublished": "2024-03-01T09:46:02+02:00"
      },{
        "@type": "Comment",
        "text": "That's my mom, isn't she cool?",
        "author": {
          "@type": "Person",
          "name": "Katie Pope",
          "url": "https://example.com/user/katie-pope",
          "agentInteractionStatistic": {
            "@type": "InteractionCounter",
            "interactionType": "https://schema.org/WriteAction",
            "userInteractionCount": 8
          }
        },
        "datePublished": "2024-03-01T09:50:25+02:00",
        "interactionStatistic": {
          "@type": "InteractionCounter",
          "interactionType": "https://schema.org/LikeAction",
          "userInteractionCount": 7
        }
      }]
    }
  </script>
</head>
<body>
</body>
</html>
微資料

<html>
    <body>
      <div id="main-post" itemtype="https://schema.org/DiscussionForumPosting" itemscope>
        <meta itemprop="mainEntityOfPage" content="https://example.com/post/very-popular-thread" />
        <meta itemprop="url" content="https://example.com/post/very-popular-thread" />
        <div class="author-block" itemprop="author" itemtype="https://schema.org/Person" itemscope>
          <div><a href="https://example.com/user/katie-pope" itemprop="url"><span itemprop="name">Katie Pope</span></a></div>
          <div itemprop="agentInteractionStatistic" itemtype="https://schema.org/InteractionCounter" itemscope>
            <span itemprop="userInteractionCount">8</span>
            <span itemprop="interactionType" content="https://schema.org/WriteAction">posts</span>
          </div>
        </div>
        <div itemprop="datePublished" content="2024-03-01T08:34:34+02:00">March 1</div>
        <div itemprop="headline">I went to the concert!</div>
        <div>
          <div itemprop="video" itemtype="https://schema.org/VideoObject" itemscope>
            <meta itemprop="name" content="Video of concert" />
            <meta itemprop="contentUrl" content="https://example.com/media/super-cool-concert.mp4" />
            <meta itemprop="uploadDate" content="2024-03-01T06:34:34+02:00" />
            <meta itemprop="thumbnailUrl" content="https://example.com/media/super-cool-concert-snap.jpg" />
          </div>
          <span itemprop="text">Look at how cool this concert was!</span>
        </div>
        <div itemprop="interactionStatistic" itemtype="https://schema.org/InteractionCounter" itemscope>
          <span itemprop="userInteractionCount">27</span>
          <span itemprop="interactionType" content="https://schema.org/LikeAction">likes</span>
        </div>
        <div id="comment-1" itemprop="comment" itemtype="https://schema.org/Comment" itemscope>
          <div class="author-block" itemprop="author" itemtype="https://schema.org/Person" itemscope>
            <div><a href="https://example.com/user/saul-douglas" itemprop="url"><span itemprop="name">Saul Douglas</span></a></div>
            <div itemprop="agentInteractionStatistic" itemtype="https://schema.org/InteractionCounter" itemscope>
              <span itemprop="userInteractionCount">167</span>
              <span itemprop="interactionType" content="https://schema.org/WriteAction">posts</span>
            </div>
          </div>
          <div itemprop="datePublished" content="2024-03-01T09:46:02+02:00">March 1</div>
          <div>
            <span itemprop="text">Who's the person you're with?</span>
          </div>
        </div>
        <div id="comment-2" itemprop="comment" itemtype="https://schema.org/Comment" itemscope>
          <div class="author-block" itemprop="author" itemtype="https://schema.org/Person" itemscope>
            <div><a href="https://example.com/user/katie-pope" itemprop="url"><span itemprop="name">Katie Pope</span></a></div>
            <div itemprop="agentInteractionStatistic" itemtype="https://schema.org/InteractionCounter" itemscope>
              <span itemprop="userInteractionCount">8</span>
              <span itemprop="interactionType" content="https://schema.org/WriteAction">posts</span>
            </div>
          </div>
          <div itemprop="datePublished" content="2024-03-01T09:50:25+02:00">March 1</div>
          <div>
            <span itemprop="text">That's my mom, isn't she cool?</span>
          </div>
          <div itemprop="interactionStatistic" itemtype="https://schema.org/InteractionCounter" itemscope>
            <span itemprop="userInteractionCount">7</span>
            <span itemprop="interactionType" content="https://schema.org/LikeAction">likes</span>
          </div>
        </div>
      </div>
    </body>
</html>

指南規範

如要讓討論區結構化資料適用於 Google 搜尋,請務必遵循下列指南:

內容指南

  • DiscussionForumPosting 標記應只用來描述網站論壇上由使用者產生的貼文。如果內容主要是由網站發布者或代理商所撰寫,請勿使用這個標記。
  • 雖然我們建議用於其他類型的有效標記 (ArticleSocialMediaPostingVideoObject) 可使用與留言、作者資訊、互動統計資料非常類似的標記,但這些類型不應使用 DiscussionForumPosting 標記。以下舉例說明:

    適用的情況

    • 供使用者討論特定遊戲的社群論壇網頁
    • 提供各類子論壇內容的一般論壇平台

    不適用的情況

    • 由網站代理商直接撰寫的文章或網誌 (即使含有留言)
    • 使用者對產品的評論
  • 請注意,就大多數 Google 用途而言,問與答頁面是視為討論區頁面的特殊用途。如果論壇網站主要採用問答結構,建議改用問與答標記。如果網站結構較通用,且通常不是問答形式,則較適合使用 DiscussionForumPosting
  • 請確保每個 DiscussionForumPosting 均包含貼文全文,且如果該頁面上有回覆,Comment 須包含回覆全文。

技術指南

  • 與一般結構化資料偏好設定不同,我們建議盡可能在微資料 (或 RDFa) 中提供 DiscussionForumPosting 標記,這樣就不必在標記中複製大型文字區塊。但這只是建議做法,系統仍完整支援 JSON-LD。

結構化資料類型定義

本節將說明與 DiscussionForumPosting 相關的結構化資料類型。

內容必須包含必要的屬性,才能顯示在 Google 搜尋中。你也可以加入建議的屬性,為論壇頁面增添更多資訊,提供更優質的使用者體驗。

DiscussionForumPosting

DiscussionForumPosting 類型會定義討論主題的原始貼文。雖然這個類型通常是由文字組成,但也可能有只包含媒體內容的論壇貼文。

必要屬性

author

PersonOrganization

貼文作者的相關資訊。為了讓不同的 Google 功能更瞭解作者,建議你遵循作者標記最佳做法

請依照支援的文章資料頁面結構化資料屬性,盡量納入所有合理的作者屬性。

author.name

Text

貼文作者的名稱。

datePublished

DateTime

貼文發布日期和時間,採用 ISO 8601 格式

textimagevideo 其中之一

如要表示貼文內容,請務必加入下列其中一個屬性:

不過,若是使用外部 url,代表在論壇後續頁面或論壇類別頁面等其他頁面上的貼文,則不必加入這類屬性。

建議屬性

author.url

URL

可明確識別文章作者的頁面連結,通常是論壇的個人資料頁面。建議您使用個人資料頁面結構化資料標記該網頁。

comment

Comment

貼文的相關留言或回覆 (如適用)。請依照頁面上的顯示順序來標記留言。

creativeWorkStatus

Text

如果貼文已遭刪除,但仍因結構定義或討論串而加以保留,請將此屬性設為 Deleted

dateModified

DateTime

貼文編輯日期和時間 (如適用),採用 ISO 8601 格式。如果沒有任何異動,也不必複製發布日期。

headline

Text

貼文標題。如果沒有獨立標題,請勿複製或截斷文字做為標題。

image

ImageObjectURL

貼文中的內嵌圖片 (如適用)。如果沒有圖片,請勿在這個欄位加入預設圖片、圖示或預留位置圖片。

interactionStatistic

InteractionCounter

套用至主要貼文的使用者統計資料 (如適用)。

Google 支援下列 interactionTypes

isPartOf

CreativeWorkURL

貼文主要來源。如果貼文出現在整個網站的特定部分,例如大型網站中的子論壇或群組,就會使用這項屬性。如果使用 CreativeWork (例如 WebPage),請以 URL 屬性指定網址。

sharedContent

CreativeWork

貼文中主要分享的內容 (如適用)。此屬性最常用來以主題討論內容的形式分享 WebPages (附網址),不過也可以與圖片或影片搭配使用,尤其是留言主要內容為圖片或影片時。

以下舉例說明如何指出貼文中分享的連結:

  ...
  "sharedContent": { "@type": "WebPage", url: "https://example.com/external-url" }
  ...
text

Text

貼文中的文字 (如適用)。這很常用,但如果貼文中有其他媒體內容,就可以在某些情況下忽略。

url

URL

討論內容的標準網址。在包含多個頁面的討論串中,請將這項屬性設為第一個頁面的網址。如果討論內容只有一個頁面,這通常就是目前網址。

video

VideoObject

貼文中的內嵌影片 (如適用)。

Comment

Comment 類型會定義原始 CreativeWork 的留言。在這種情況下,這是指 DiscussionForumPosting,且具備許多與 DiscussionForumPosting 相同的屬性,適用類似的指南規範。

必要屬性

author

PersonOrganization

留言作者的相關資訊。為了讓 Google 更瞭解不同內容的作者,建議您遵循作者標記最佳做法

請依照支援的文章資料頁面結構化資料屬性,盡量納入所有合理的作者屬性。

datePublished

DateTime

留言的發布日期和時間,採用 ISO 8601 格式。如果沒有任何異動,也不必複製發布日期。

text

Text

留言的主要文字。在理想情況下,這個欄位會與留言頁面中顯示的文字相符。

建議屬性

author.url

URL

可明確識別留言作者的頁面連結,通常是論壇的個人資料網頁。建議您使用個人資料頁面結構化資料標記該網頁。

comment

Comment

關於或回覆這則留言的其他留言 (如適用)。請依照頁面上的顯示順序來標記留言。

creativeWorkStatus

Text

如果留言已遭刪除,但仍因結構定義或討論串而加以保,請將這個屬性設為 Deleted (如適用)。

dateModified

DateTime

上次編輯留言的日期和時間 (如適用),採用 ISO 8601 格式

image

ImageObjectURL

註解中的內嵌圖片 (如適用)。如果沒有圖片,請勿在這個欄位加入預設圖片、圖示或預留位置圖片。

interactionStatistic

InteractionCounter

套用至留言的使用者統計資料 (如適用)。

Google 支援下列 interactionTypes

sharedContent

CreativeWork

留言中主要分享的內容 (如適用)。此屬性最常用來以主題討論內容的形式分享 WebPages (附網址),不過也可以與圖片或影片搭配使用,尤其是留言主要內容為圖片或影片時。

以下舉例說明如何指出留言中分享的連結:

  ...
  "sharedContent": { "@type": "WebPage", url: "https://example.com/external-url" }
  ...

url

URL

網頁上特定留言的網址 (如適用)。如果只是原始貼文的網址,請不要加入這項屬性。

video

VideoObject

留言中的內嵌影片 (如適用)。

InteractionCounter

InteractionCounter 可將數量與特定類型的互動建立關聯。這可用於兩種內容 (DiscussionForumPostingComment) 屬性,以及 author 屬性。

必要屬性

userInteractionCount

Integer

發生此互動的次數。

interactionType

Action 的子類型

如需這個屬性的有效 Action 子類型清單,請查看使用 InteractionCounter 的屬性 (例如 interactionStatistic)。

透過 Search Console 監控複合式搜尋結果

Search Console 這項工具能協助您監控網頁在 Google 搜尋中的成效。 Google 會主動將您的網頁納入搜尋結果,您無需為此申請使用 Search Console,但是您可以藉由這項服務瞭解並改善 Google 檢索您網站的方式。建議在下列情況查看 Search Console:

  1. 首次部署結構化資料後
  2. 發布新範本或更新程式碼後
  3. 定期分析流量

首次部署結構化資料後

在 Google 為網頁建立索引後,請透過相關的複合式搜尋結果狀態報告查看是否存在任何問題。理想情況下,有效項目會增加,但無效項目不會變多。如果您在結構化資料中發現問題,請依下列步驟操作:

  1. 修正無效項目
  2. 檢查線上網址,查看問題是否仍繼續發生。
  3. 透過狀態報告要求驗證

發布新範本或更新程式碼後

當您對網站進行大幅變更時,請留意結構化資料中無效項目是否增加。
  • 如果無效項目增加,代表您推出的新範本可能無法正常運作,或者您的網站採用新方式與現有範本互動,但效果不佳。
  • 如果有效項目減少,但錯誤並未隨之增加,代表您的網頁可能已不再內嵌結構化資料。請使用網址檢查工具找出問題的成因。

定期分析流量

透過成效報表分析您的 Google 搜尋流量。 這些資料會顯示您的網頁在 Google 搜尋中呈現為複合式搜尋結果的頻率、使用者點擊的頻率,以及您的搜尋結果平均排名。您也可以使用 Search Console API 自動提取這些結果。

疑難排解

如果無法順利導入結構化資料,或是偵錯時遇到困難,請參考下列資源。

  • 如果您使用內容管理系統 (CMS) 或者有他人代您處理網站事務,請向對方尋求協助。請務必將所有與問題相關的 Search Console 訊息都轉寄給對方,這些訊息會針對問題提供詳細說明。
  • Google 不保證採用結構化資料的功能一定會顯示在搜尋結果中。如要瞭解為何 Google 無法將您的內容顯示為複合式搜尋結果,請參閱結構化資料通用指南裡的常見原因清單。
  • 結構化資料可能含有錯誤。請查看結構化資料錯誤清單
  • 如果您的網頁遭到結構化資料專人介入處理處置,系統會忽略網頁上的結構化資料,但該網頁仍然會出現在 Google 搜尋結果中。請使用專人介入處理報告來修正結構化資料問題
  • 再次查看指南規範,確認您的內容是否符合規定。問題可能是因為垃圾內容或不當使用的標記所引起。不過,因為問題可能與語法無關,所以複合式搜尋結果測試無法找出問題所在。
  • 疑難排解:未出現複合式搜尋結果/複合式搜尋結果總數減少
  • 請等待一段時間,讓系統執行重新檢索和重新建立索引作業。在發布網頁後,Google 可能需要幾天時間才會找到網頁並進行檢索。如有關於檢索和索引建立作業的一般問題,請參閱 Google 搜尋檢索和索引常見問題
  • 前往 Google 搜尋中心論壇發文提問。