Dữ liệu có cấu trúc loại Breadcrumb (BreadcrumbList)

Đường dẫn breadcrumb trên một trang cho biết vị trí của trang trong hệ thống phân cấp trang web và có thể giúp người dùng hiểu cũng như khám phá trang web một cách hiệu quả. Người dùng có thể di chuyển từng cấp một lên cấp trên cùng của hệ thống phân cấp trang web, bắt đầu từ breadcrumb cuối cùng trong đường dẫn breadcrumb.

Breadcrumb hiển thị trên một trang web

Cách thêm dữ liệu có cấu trúc

Dữ liệu có cấu trúc là một định dạng chuẩn để cung cấp thông tin về một trang và phân loại nội dung trên trang. Nếu mới làm quen với dữ liệu có cấu trúc, bạn có thể tìm hiểu thêm về cách thức hoạt động của dữ liệu có cấu trúc.

Sau đây là thông tin tổng quan về cách xây dựng, kiểm tra và phát hành dữ liệu có cấu trúc. Để xem hướng dẫn từng bước về cách thêm dữ liệu có cấu trúc vào một trang web, hãy tham khảo lớp học lập trình về dữ liệu có cấu trúc.

  1. Thêm các thuộc tính bắt buộc. Tùy theo định dạng bạn đang sử dụng, hãy tìm hiểu nơi chèn dữ liệu có cấu trúc trên trang.
  2. Tuân theo các nguyên tắc.
  3. Xác thực mã của bạn bằng công cụ Kiểm tra kết quả nhiều định dạng rồi sửa mọi lỗi nghiêm trọng. Bạn cũng nên cân nhắc việc khắc phục mọi vấn đề không nghiêm trọng có thể bị gắn cờ trong công cụ này, vì những vấn đề này có thể giúp cải thiện chất lượng của dữ liệu có cấu trúc của bạn (tuy nhiên, bạn không nhất thiết thực hiện việc này để nội dung đủ điều kiện xuất hiện dưới dạng kết quả nhiều định dạng).
  4. Triển khai một vài trang có chứa dữ liệu có cấu trúc và sử dụng Công cụ kiểm tra URL để kiểm tra xem Google nhìn thấy trang đó như thế nào. Hãy đảm bảo rằng Google có thể truy cập trang của bạn và bạn không chặn trang bằng tệp robots.txt, thẻ noindex hoặc yêu cầu đăng nhập. Nếu có vẻ như trang không gặp vấn đề nào, bạn có thể yêu cầu Google thu thập lại dữ liệu các URL của mình.
  5. Để thông báo cho Google về các thay đổi sau này, bạn nên gửi một sơ đồ trang web. Bạn có thể tự động hoá quy trình này bằng Search Console Sitemap API.

Ví dụ

Google Tìm kiếm sử dụng mã đánh dấu breadcrumb trong phần nội dung của trang web để phân loại thông tin trên trang trong kết quả tìm kiếm. Thông thường, người dùng có thể truy cập một trang thông qua các loại cụm từ tìm kiếm rất khác nhau, như được minh họa trong các trường hợp sử dụng sau đây. Mặc dù mỗi cụm từ tìm kiếm có thể trả về cùng một trang web, breadcrumb sẽ phân loại nội dung theo ngữ cảnh của cụm từ đó trên Google Tìm kiếm. Trang ancillaryjustice.html có thể hiển thị các đường dẫn breadcrumb sau tùy thuộc vào ngữ cảnh tìm kiếm:

Một đường dẫn breadcrumb

Một cụm từ tìm kiếm về giải thưởng dựa trên thể loại trong một năm, ví dụ: "Tiểu thuyết hay nhất Giải thưởng Tinh vân năm 2014", có thể tạo thành breadcrumb sau:

Sách Khoa học viễn tưởng Sách đạt giải thưởng

JSON-LD

Dưới đây là ví dụ về đoạn mã JSON-LD hỗ trợ breadcrumb đó:


<html>
  <head>
    <title>Award Winners</title>
    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "BreadcrumbList",
      "itemListElement": [{
        "@type": "ListItem",
        "position": 1,
        "name": "Books",
        "item": "https://example.com/books"
      },{
        "@type": "ListItem",
        "position": 2,
        "name": "Science Fiction",
        "item": "https://example.com/books/sciencefiction"
      },{
        "@type": "ListItem",
        "position": 3,
        "name": "Award Winners"
      }]
    }
    </script>
  </head>
  <body>
  </body>
</html>

RDFa

Dưới đây là ví dụ về đoạn mã RDFa hỗ trợ breadcrumb đó:


<html>
  <head>
    <title>Award Winners</title>
  </head>
  <body>
    <ol vocab="https://schema.org/" typeof="BreadcrumbList">
      <li property="itemListElement" typeof="ListItem">
        <a property="item" typeof="WebPage"
            href="https://example.com/books">
          <span property="name">Books</span></a>
        <meta property="position" content="1">
      </li>
      ›
      <li property="itemListElement" typeof="ListItem">
        <a property="item" typeof="WebPage"
            href="https://example.com/books/sciencefiction">
          <span property="name">Science Fiction</span></a>
        <meta property="position" content="2">
      </li>
      ›
      <li property="itemListElement" typeof="ListItem">
        <span property="name">Award Winners</span>
        <meta property="position" content="3">
      </li>
    </ol>
  </body>
</html>

Vi dữ liệu

Dưới đây là ví dụ về Vi dữ liệu hỗ trợ breadcrumb đó:


<html>
  <head>
    <title>Award Winners</title>
  </head>
  <body>
    <ol itemscope itemtype="https://schema.org/BreadcrumbList">
      <li itemprop="itemListElement" itemscope
          itemtype="https://schema.org/ListItem">
        <a itemprop="item" href="https://example.com/books">
            <span itemprop="name">Books</span></a>
        <meta itemprop="position" content="1" />
      </li>
      ›
      <li itemprop="itemListElement" itemscope
          itemtype="https://schema.org/ListItem">
        <a itemscope itemtype="https://schema.org/WebPage"
           itemprop="item" itemid="https://example.com/books/sciencefiction"
           href="https://example.com/books/sciencefiction">
          <span itemprop="name">Science Fiction</span></a>
        <meta itemprop="position" content="2" />
      </li>
      ›
      <li itemprop="itemListElement" itemscope
          itemtype="https://schema.org/ListItem">
        <span itemprop="name">Award winners</span>
        <meta itemprop="position" content="3" />
      </li>
    </ol>
  </body>
</html>

HTML

Dưới đây là ví dụ về đoạn breadcrumb HTML trong trang, là một phần của thiết kế hình ảnh.

<html>
  <head>
    <title>Award Winners</title>
  </head>
  <body>
    <ol>
      <li>
        <a href="https://www.example.com/books">Books</a>
      </li>
      <li>
        <a href="https://www.example.com/sciencefiction">Science Fiction</a>
      </li>
      <li>
        Award Winners
      </li>
    </ol>
  </body>
</html>

Nhiều đường dẫn breadcrumb

Nếu có nhiều cách để chuyển đến một trang trên trang web của bạn, bạn có thể chỉ định nhiều đường dẫn breadcrumb cho một trang. Sau đây là một đường dẫn breadcrumb đến một trang về sách đạt giải thưởng:

Sách Khoa học viễn tưởng Sách đạt giải thưởng

Đây là một đường dẫn breadcrumb khác dẫn đến cùng trang đó:

Văn học Sách đạt giải thưởng

JSON-LD

Dưới đây là ví dụ về đoạn mã JSON-LD hỗ trợ nhiều đường dẫn breadcrumb:


<html>
  <head>
    <title>Award Winners</title>
    <script type="application/ld+json">
    [{
      "@context": "https://schema.org",
      "@type": "BreadcrumbList",
      "itemListElement": [{
        "@type": "ListItem",
        "position": 1,
        "name": "Books",
        "item": "https://example.com/books"
      },{
        "@type": "ListItem",
        "position": 2,
        "name": "Science Fiction",
        "item": "https://example.com/books/sciencefiction"
      },{
        "@type": "ListItem",
        "position": 3,
        "name": "Award Winners"
      }]
    },
    {
      "@context": "https://schema.org",
      "@type": "BreadcrumbList",
      "itemListElement": [{
        "@type": "ListItem",
        "position": 1,
        "name": "Literature",
        "item": "https://example.com/literature"
      },{
        "@type": "ListItem",
        "position": 2,
        "name": "Award Winners"
      }]
    }]
    </script>
  </head>
  <body>
  </body>
</html>

RDFa

Dưới đây là ví dụ về đoạn mã RDFa hỗ trợ nhiều đường dẫn breadcrumb:


<html>
  <head>
    <title>Award Winners</title>
  </head>
  <body>
    <ol vocab="https://schema.org/" typeof="BreadcrumbList">
      <li property="itemListElement" typeof="ListItem">
        <a property="item" typeof="WebPage"
            href="https://example.com/books">
          <span property="name">Books</span></a>
        <meta property="position" content="1">
      </li>
      ›
      <li property="itemListElement" typeof="ListItem">
        <a property="item" typeof="WebPage"
            href="https://example.com/books/sciencefiction">
          <span property="name">Science Fiction</span></a>
        <meta property="position" content="2">
      </li>
      ›
      <li property="itemListElement" typeof="ListItem">
        <a property="item" typeof="WebPage"
            href="https://example.com/books/sciencefiction/awardwinners">
          <span property="name">Award Winners</span></a>
        <meta property="position" content="3">
      </li>
    </ol>
    <ol vocab="https://schema.org/" typeof="BreadcrumbList">
      <li property="itemListElement" typeof="ListItem">
        <a property="item" typeof="WebPage"
            href="https://example.com/literature">
          <span property="name">Literature</span></a>
        <meta property="position" content="1">
      </li>
      ›
      <li property="itemListElement" typeof="ListItem">
        <span property="name">Award Winners</span>
        <meta property="position" content="2">
      </li>
    </ol>
  </body>
</html>

Vi dữ liệu

Dưới đây là ví dụ về Vi dữ liệu hỗ trợ nhiều đường dẫn breadcrumb:


<html>
  <head>
    <title>Award Winners</title>
  </head>
  <body>
    <ol itemscope itemtype="https://schema.org/BreadcrumbList">
      <li itemprop="itemListElement" itemscope
          itemtype="https://schema.org/ListItem">
        <a itemprop="item" href="https://example.com/books">
            <span itemprop="name">Books</span></a>
        <meta itemprop="position" content="1" />
      </li>
      ›
      <li itemprop="itemListElement" itemscope
          itemtype="https://schema.org/ListItem">
        <a itemscope itemtype="https://schema.org/WebPage"
           itemprop="item" itemid="https://example.com/books/sciencefiction"
           href="https://example.com/books/sciencefiction">
          <span itemprop="name">Science Fiction</span></a>
        <meta itemprop="position" content="2" />
      </li>
      ›
      <li itemprop="itemListElement" itemscope
          itemtype="https://schema.org/ListItem">
        <a itemprop="item" href="https://example.com/books/sciencefiction/awardwinners">
          <span itemprop="name">Award Winners</span></a>
        <meta itemprop="position" content="3" />
      </li>
    </ol>
    <ol itemscope itemtype="https://schema.org/BreadcrumbList">
      <li itemprop="itemListElement" itemscope
          itemtype="https://schema.org/ListItem">
        <a itemprop="item" href="https://example.com/literature">
          <span itemprop="name">Literature</span></a>
        <meta itemprop="position" content="1" />
      </li>
      ›
      <li itemprop="itemListElement" itemscope
          itemtype="https://schema.org/ListItem">
        <span itemprop="name">Award Winners</span>
        <meta itemprop="position" content="2" />
      </li>
    </ol>
  </body>
</html>

HTML

Dưới đây là ví dụ về đoạn breadcrumb HTML trong trang, là một phần của thiết kế hình ảnh.

<html>
  <head>
    <title>Award Winners</title>
  </head>
  <body>
    <ol>
      <li>
        <a href="https://www.example.com/books">Books</a>
      </li>
      <li>
        <a href="https://www.example.com/books/sciencefiction">Science Fiction</a>
      </li>
      <li>
        Award Winners
      </li>
    </ol>
    <ol>
      <li>
        <a href="https://www.example.com/literature">Literature</a>
      </li>
      <li>
        Award Winners
      </li>
    </ol>
  </body>
</html>

Nguyên tắc

Bạn phải tuân thủ những nguyên tắc này để đủ điều kiện xuất hiện kèm theo breadcrumb trong Google Tìm kiếm.

Bạn nên cung cấp những breadcrumb thể hiện một đường dẫn điển hình mà người dùng thường đi theo để truy cập một trang thay vì tham chiếu theo cấu trúc của URL. Một số phần trong đường dẫn URL không giúp người dùng hiểu được trang đó nằm ở đâu trên trang web của bạn. Ví dụ: Trong URL https://example.com/pages/books/catcher_in_the_rye.html, cả phần pages và phần tử cấp cao nhất example.com đều không cung cấp thêm thông tin nào.

Định nghĩa các loại dữ liệu có cấu trúc

Để chỉ định breadcrumb, hãy xác định một thuộc tính BreadcrumbList có chứa ít nhất 2 ListItems. Bạn phải thêm các thuộc tính bắt buộc để nội dung của bạn đủ điều kiện xuất hiện kèm theo breadcrumb.

BreadcrumbList là mục chứa mọi thành phần trong danh sách. Bạn có thể xem định nghĩa đầy đủ về BreadcrumbList tại schema.org/BreadcrumbList. Sau đây là các thuộc tính được Google hỗ trợ:

Thuộc tính bắt buộc
itemListElement

ListItem

Một mảng (array) breadcrumb được liệt kê theo một thứ tự cụ thể. Chỉ định từng breadcrumb bằng thuộc tính ListItem. Ví dụ:

{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
  "itemListElement": [{
    "@type": "ListItem",
    "position": 1,
    "name": "Books",
    "item": "https://example.com/books"
  },{
    "@type": "ListItem",
    "position": 2,
    "name": "Authors",
    "item": "https://example.com/books/authors"
  },{
    "@type": "ListItem",
    "position": 3,
    "name": "Ann Leckie",
    "item": "https://example.com/books/authors/annleckie"
  }]
}

ListItem

ListItem chứa thông tin chi tiết về một mục riêng lẻ trong danh sách. Bạn có thể xem định nghĩa đầy đủ về ListItem tại schema.org/ListItem. Sau đây là các thuộc tính được Google hỗ trợ:

Thuộc tính bắt buộc
item

URL hoặc loại phụ của Thing

URL đến trang web đại diện cho breadcrumb. Có hai cách để chỉ định item:

  • URL: Chỉ định URL của trang. Ví dụ:
    "item": "https://example.com/books"
  • Thing: Sử dụng id để chỉ định URL dựa trên định dạng mã đánh dấu bạn đang sử dụng:
    • JSON-LD: Sử dụng @id để chỉ định URL.
    • Vi dữ liệu: Bạn có thể sử dụng href hoặc itemid để chỉ định URL.
    • RDFa: Bạn có thể sử dụng about, href hoặc resource để chỉ định URL.

Nếu breadcrumb là mục cuối cùng trong đường dẫn breadcrumb, thì bạn không cần phải chỉ định item. Nếu item không được sử dụng cho mục cuối cùng, Google sẽ sử dụng URL của trang chứa.

name

Text

Tiêu đề của breadcrumb hiển thị cho người dùng. Nếu đang sử dụng Thing với name thay vì URL để chỉ định item, thì bạn không cần phải chỉ định name.

position

Integer

Vị trí của breadcrumb trong đường dẫn breadcrumb. Vị trí 1 biểu thị điểm bắt đầu của đường dẫn.

Monitor rich results with Search Console

Search Console is a tool that helps you monitor how your pages perform in Google Search. You don't have to sign up for Search Console to be included in Google Search results, but it can help you understand and improve how Google sees your site. We recommend checking Search Console in the following cases:

  1. After deploying structured data for the first time
  2. After releasing new templates or updating your code
  3. Analyzing traffic periodically

After deploying structured data for the first time

After Google has indexed your pages, look for issues using the relevant Rich result status report. Ideally, there will be an increase of valid items, and no increase in invalid items. If you find issues in your structured data:

  1. Fix the invalid items.
  2. Inspect a live URL to check if the issue persists.
  3. Request validation using the status report.

After releasing new templates or updating your code

When you make significant changes to your website, monitor for increases in structured data invalid items.
  • If you see an increase in invalid items, perhaps you rolled out a new template that doesn't work, or your site interacts with the existing template in a new and bad way.
  • If you see a decrease in valid items (not matched by an increase in invalid items), perhaps you are no longer embedding structured data in your pages. Use the URL Inspection tool to learn what is causing the issue.

Analyzing traffic periodically

Analyze your Google Search traffic using the Performance Report. The data will show you how often your page appears as a rich result in Search, how often users click on it and what is the average position you appear on search results. You can also automatically pull these results with the Search Console API.

Khắc phục sự cố

Nếu gặp sự cố khi triển khai hoặc gỡ lỗi dữ liệu có cấu trúc, thì bạn có thể tham khảo một số tài nguyên trợ giúp sau đây.