How to build a clear breadcrumb navigation through `breadcrumb` tags to enhance users' sense of positioning on the website?

Calendar 👁️ 82

In website operation, how to keep visitors from feeling lost while browsing through vast content, maintaining a clear sense of direction is a crucial issue.Imagine when a user delves into a page on a website and is unclear about where they came from or what level they are at, they are easily confused and may even choose to leave.At this point, a well-designed and functional breadcrumb navigation can play a crucial role, as it is like a 'road sign' in the digital world, providing users with a clear return path.

AnQiCMS (AnQiCMS) is well-versed in content management and user experience, its built-inbreadcrumbThe tag is the tool we use to build this kind of navigation. It can help you easily implement a structured, SEO-friendly breadcrumb navigation, significantly enhancing the user's sense of orientation on the website.

What is breadcrumb navigation and why is it so important?

Breadcrumb Navigation, as the name implies, is like Hansel and Gretel dropping breadcrumbs along the way in a fairy tale, allowing users to find the way back at any time. It is usually presented in首页 > 分类 > 子分类 > 当前页面This hierarchical structure presents, clearly showing the user's current position in the website content system.

It is important mainly in the following aspects:

  1. Improve user experience, reduce bounce rateWhen a user directly enters a deep page of a website through a search engine, breadcrumb navigation can quickly inform them of the context of the current page, avoiding the confusion of 'searching for a needle in a haystack'.Users can easily click on the previous level to explore more related content instead of closing the page directly.
  2. Optimize website structure, assist SEO:A clear hierarchy helps search engine spiders better understand the organization of the website, improving crawling efficiency.At the same time, breadcrumb navigation itself is an effective internal link, able to pass on weight, and is very beneficial for SEO ranking.
  3. Save screen space, assist navigationCompared to traditional sidebars or top menus, breadcrumb navigation displays the path in a compact line, does not occupy too much page space, and can provide an efficient auxiliary navigation function.

How to use AnQiCMS tobreadcrumbbuild breadcrumb navigation with tags?

Integrating breadcrumb navigation in AnQiCMS is a very simple thing. We mainly usebreadcrumbLabels and their combinationsforLoop to render navigation path

First, let's take a look atbreadcrumbThe basic usage of tags. Typically, you will place this code in the public header template file of the website (such as/template/{您的模板目录}/partial/header.htmlorbash.html) to ensure it is displayed consistently on all pages:

<nav class="breadcrumb-nav">
    {% breadcrumb crumbs with index="首页" title=true %}
    <ul>
        {% for item in crumbs %}
            <li><a href="{{item.Link}}">{{item.Name}}</a></li>
        {% endfor %}
    </ul>
    {% endbreadcrumb %}
</nav>

In this code block,{% breadcrumb crumbs %}Defined a namedcrumbsThe variable, it is an array object that contains all the levels of information on the current page path. Then, we{% for item in crumbs %}loop through this array and extract each level of theName(link name) andLink(Link address), and render it as a clickable navigation item.

breadcrumbThe tag provides several practical parameters to help us customize according to actual needs:

  1. indexParameter: Customize the home page nameBy default, the starting point of the breadcrumb navigation is "Home Page". If you want to change it to another name, such as "My Website Homepage" or your brand name, you can useindexSet the parameter:

    {% breadcrumb crumbs with index="我的网站主页" title=true %}
        {# ... 循环渲染内容不变 ... #}
    {% endbreadcrumb %}
    
  2. titleParameter: Controls the display of the current page titleIn some cases, you may not want to display the full title of the current page at the end of the breadcrumb navigation, or you may want to set a simpler name for it.titleParameters can help us achieve this.

    • Do not display the current page title: Totitleis set tofalse.
      
      {% breadcrumb crumbs with index="首页" title=false %}
          {# ... 循环渲染内容不变 ... #}
      {% endbreadcrumb %}
      
    • Customize the current page title: TotitleSet it to the specific string you want, for example, "Article Details".
      
      {% breadcrumb crumbs with index="首页" title="文章详情" %}
          {# ... 循环渲染内容不变 ... #}
      {% endbreadcrumb %}
      
      titleThe default value of the parameter istruewhich will automatically display the full title of the current page.
  3. siteIdParameter: Suitable for multi-site managementIf you are using the AnQiCMS multi-site management feature and need to call data from other sites on a specific site, you can usesiteIdSpecify the parameter. However, for most single-site websites, this parameter is usually not required.

    {% breadcrumb crumbs with siteId="2" %}
        {# ... 循环渲染内容不变 ... #}
    {% endbreadcrumb %}
    

Combine HTML semantics with SEO practices.

When building breadcrumb navigation, we should also pay attention to its HTML semantics and further enhancement for SEO.

  • Semantic HTML structureRecommended to use ordered list<ol>and list item<li>to build breadcrumb navigation, which can better express its structure. Each navigation item should contain its text. For example:<a>should also include its text. For example:

    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            {% breadcrumb crumbs with index="首页" title=true %}
            {% for item in crumbs %}
                <li class="breadcrumb-item"><a href="{{item.Link}}">{{item.Name}}</a></li>
            {% endfor %}
            {% endbreadcrumb %}
        </ol>
    </nav>
    

    (Please note that you need to add CSS styles yourself to achieve an aesthetically pleasing effect.)

  • Structured data (JSON-LD): To help search engines better understand the hierarchy of breadcrumb navigation, you can consider adding JSON-LD structured data. AnQiCMS usually automatically generates most of the necessary structured data, but if you have advanced customization needs, you can usejsonLdTags can be customized or supplemented. For example:

    {% jsonLd %}
    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "BreadcrumbList",
      "itemListElement": [
        {# 这里可以手动或通过循环渲染面包屑项的JSON-LD数据 #}
        {
          "@type": "ListItem",
          "position": 1,
          "name": "首页",
          "item": "https://www.yourdomain.com/"
        }
      ]
    }
    </script>
    {% endjsonLd %}
    

    Using structured data correctly can help your website display rich snippets in search results, further enhancing visibility.

By following this method, you can flexibly and efficiently build clear breadcrumb navigation in AnQiCMS, which can not only greatly improve the browsing experience of visitors, but also lay a solid foundation for the website's SEO optimization.Make every visit filled with a sense of direction, and every exploration more smooth.


Frequently Asked Questions (FAQ)

Q1: How to modify the text content of the 'Home' in the breadcrumb navigation?A1: You can usebreadcrumblabel'sindexparameter to specify the display name of the home page. For example, toindex="我的站点主页"Add to the tag, and you can replace 'Home' with 'My Site Homepage'.

Q2: Can the title of the current page be hidden in the breadcrumb navigation? Or can a custom title be displayed?A2: Yes. Throughbreadcrumblabel'stitleParameter, you can control the display of the current page title. If set totitle=falsethen the current page title will not be displayed; if set totitle="自定义标题"then the specified text will be displayed.

Q3: Where should I place the breadcrumbs navigation code on the website template?A3: To ensure that the breadcrumb navigation is displayed uniformly on all pages and is easy to manage, it is recommended to place it in the common header template file of the website, for example/template/{您的模板目录}/partial/header.htmlorbash.htmlChinese. This way, all pages inheriting or containing these public files will automatically have breadcrumb navigation.

Related articles

How to implement the `navList` tag for flexible display of top, bottom, or sidebar navigation menus on a website?

The website navigation is a guide for users to explore the website content and is also an important clue for search engines to understand the website structure.A well-designed, flexible navigation system that can greatly enhance user experience and website SEO performance.In AnQiCMS, the `navList` tag is just such a core tool that gives us great freedom, allowing us to easily build and manage navigation menus at various positions such as the top, bottom, and sidebars of the website.

2025-11-08

How to use the `tagDetail` and `tagDataList` tags to display information about a specific tab page and its associated documents?

AnQiCMS (AnQiCMS) is a flexible and efficient content management tool trusted by many operators.It is crucial to effectively present content classification and organization methods when building a functional and user-friendly website.Especially for the need to associate different content through "tags", mastering the use of the `tagDetail` and `tagDataList` template tags can make your website's tag page not only beautiful but also informative, greatly enhancing user experience and search engine optimization (SEO) effects.

2025-11-08

What are the applications of the `pageDetail` and `pageList` tags in displaying single-page content and list presentation?

When using AnQiCMS to build a website, the display of single-page content and page lists is an indispensable part.Whether it is an independent content page like "About Us" or a series of links in the website footer navigation, they all need flexible and efficient ways to manage and present.In AnQiCMS, the `pageDetail` and `pageList` tags are powerful tools designed to meet these needs.They each focus on different application scenarios and yet complement each other

2025-11-08

How to use the `categoryList` tag to build a multi-level category navigation and control its display level?

The website's navigation system is like a map, guiding visitors smoothly to their destination.A well-organized, layered classification navigation that can significantly improve the user's browsing experience and also help search engines understand and index your website content more efficiently.In AnQi CMS, the `categoryList` tag is the tool to build a high-efficiency and flexible category navigation system.With it, you can easily display the website's category structure, even fine-tune the display level of each category.### `categoryList` Label Overview

2025-11-08

How is the `bannerList` tag used to fetch and display the carousel of the website homepage or a specific group?

When building modern websites, the banner carousel is a commonly used element to enhance visual appeal and convey important information.They are usually located in prominent positions on websites, such as the top of the homepage, to display the latest activities, featured products, or important announcements.In AnQiCMS (AnQiCMS), managing and displaying these carousel images becomes very convenient, mainly due to its powerful template tag system, especially the `bannerList` tag.`bannerList`

2025-11-08

What global website information and contact details can the `system` tag and `contact` tag retrieve and display?

In the daily operation of AnQiCMS, the global information and contact information of the website are highly concerned by users and frequently change.How to efficiently and uniformly manage and display this information is an important standard for measuring the flexibility of a content management system.AnQiCMS provides an extremely convenient solution for calling website content and contact information through its unique template tag system, especially the core tags `system` and `contact`.

2025-11-08

How to dynamically generate and display SEO titles, keywords, and descriptions for `tdk` tags on different pages?

In website operation, the title (Title), keywords (Keywords), and description (Description), known as TDK, are indispensable core elements of search engine optimization (SEO).They not only directly affect the display of the website on the search engine results page (SERP), but also determine whether users click to enter your website.

2025-11-08

How to use the `archiveParams` tag to retrieve and display the content of the custom parameter fields of the document?

In daily website operations, we often encounter the need that standardized content fields can no longer meet the diversified display of information.For example, a product detail page may need to display unique attributes such as "model", "material", "warranty period", etc., while a regular article may need additional notes such as "source of the article", "estimated reading time", etc.

2025-11-08