How to display dynamic breadcrumb navigation in AnQiCMS and customize the home page name?

Calendar 👁️ 54

In website content management, breadcrumb navigation plays a crucial role.It not only helps visitors clearly understand their position on the website, provides a convenient path to return to the upper-level page, but also reflects the hierarchy of the website from the side, which is greatly beneficial to user experience and search engine optimization.AnQiCMS is a powerful content management system and naturally provides a flexible way to manage and display this kind of navigation.

Understanding the breadcrumb navigation tags in AnQiCMS

AnQiCMS provides a namedbreadcrumbThe template tag is used specifically to generate and control the breadcrumb navigation in a website.This label can intelligently build a complete navigation path based on the current page level and type (such as article detail page, category list page, etc.).It generates an array containing the path information of the page, which we usually namecrumbs. ThiscrumbsEach element in the array represents a node in the path, containing the node'sName(display text) andLink(Link address).

Implement dynamic breadcrumb navigation by doing it yourself

To display the breadcrumb navigation on your website, you first need to find the appropriate template file to place the relevant code.Considering that breadcrumb navigation is usually a common element of a website, it is recommended that you place it in the public header or layout file.In the AnQiCMS template structure, you can find it in the current theme folder underpartial/Create a file in the directory, such aspartial/breadcrumb.htmlThen proceed{% include "partial/breadcrumb.html" %}Include it in the main layout file (for examplebash.html).

In the template file you have selected (for examplepartial/breadcrumb.html), you can use it like thisbreadcrumbtag to build breadcrumb navigation:

{% breadcrumb crumbs %}
    <nav class="breadcrumb-nav">
        <ul>
            {% for item in crumbs %}
                <li>
                    {% if item.Link %}
                        <a href="{{ item.Link }}">{{ item.Name }}</a>
                    {% else %}
                        <span>{{ item.Name }}</span>
                    {% endif %}
                </li>
            {% endfor %}
        </ul>
    </nav>
{% endbreadcrumb %}

In this code block,{% breadcrumb crumbs %}The label captures the breadcrumb path information and assigns it tocrumbsthe variable. Then, we traversed{% for item in crumbs %}Loop through this array to generate a list item for each path node<li>Here's a little trick:{% if item.Link %}The judgment is to ensure that the last element in the path (usually the current page) is displayed as text without hyperlinks because the user is already on the page.By such settings, a dynamic and clear breadcrumb navigation can be displayed on your website.

Easily customize the home page name of the breadcrumb navigation

By default, the first element of the breadcrumb navigation is usually displayed as 'Home'.But in actual operation, you may want to change it to "Home Page", "Homepage", or other names that are more in line with the brand positioning.AnQiCMS'breadcrumbTags provide convenient for thisindexParameter.

You just need tobreadcrumbthe tag withindexParameter and specify the name you want to display. For example, if you want to change 'home page' to 'my website homepage', you can modify the code in this way:

{% breadcrumb crumbs with index="我的网站主页" %}
    <nav class="breadcrumb-nav">
        <ul>
            {% for item in crumbs %}
                <li>
                    {% if item.Link %}
                        <a href="{{ item.Link }}">{{ item.Name }}</a>
                    {% else %}
                        <span>{{ item.Name }}</span>
                    {% endif %}
                </li>
            {% endfor %}
        </ul>
    </nav>
{% endbreadcrumb %}

By adjusting this simple parameter, your breadcrumb navigation can display a personalized home page name, enhancing the user experience to a new level.

Precisely control the current page title display in the breadcrumb

On the article detail page, product detail page, and other specific content pages, the last element of the breadcrumb navigation will usually display the full title of the page. AnQiCMS'sbreadcrumbTags also providedtitleParameters, allowing you to flexibly control the display of this part.

titleThere are several ways to use the parameter:

  • title=true(Default behavior):At this time, the breadcrumb will display the full title of the current page.
  • title=false:If you do not wish to display the current page title in the breadcrumbs, but rather stop the path at the parent category, you can use this setting.
  • title="自定义文本":You can also settitleThe parameter is set to a custom text string, for example, displaying "Article Details" on the article detail page instead of the specific title of the article.

For example, if you want to display "Read Details" in the breadcrumb of the article detail page instead of the article's title, you can set it like this:

{% breadcrumb crumbs with index="主页" title="阅读详情" %}
    <nav class="breadcrumb-nav">
        <ul>
            {% for item in crumbs %}
                <li>
                    {% if item.Link %}
                        <a href="{{ item.Link }}">{{ item.Name }}</a>
                    {% else %}
                        <span>{{ item.Name }}</span>
                    {% endif %}
                </li>
            {% endfor %}
        </ul>
    </nav>
{% endbreadcrumb %}

Such settings make the breadcrumb navigation clearer while also more concise and unified.

Flexible application with tips.

MasteredbreadcrumbThe core usage of the label, you can beautify the breadcrumb navigation according to the design style of the website and specific requirements, combine it with CSS style to make it harmonious with the overall page layout. Although in the multi-site management scenario, althoughbreadcrumbTag supportsiteIdParameters are used to call data from specific sites, but for breadcrumb navigation, it is usually automatically identified that the current site is being accessed, so in most cases, you do not need to specify manuallysiteId.

With these flexible configurations, AnQiCMS can help you build a dynamic and personalized breadcrumb navigation that not only enhances the user experience of the website but also makes the hierarchical structure clearer and more understandable.

Frequently Asked Questions (FAQ)

1. Why is my breadcrumb navigation not displayed or incomplete?

This is usually due to an incorrect template file inclusion or incorrect label parameter configuration. Please first confirm that you have placed the breadcrumb code in the correct template file (for examplepartial/breadcrumb.html), and make sure that the file is included by the main layout file (such asbash.htmlPassed{% include "partial/breadcrumb.html" %}correctly included. Next, checkbreadcrumbwhether the syntax of the tags and their internal loops is correct, for examplecrumbswhether the variable spellings are consistent,item.Linkanditem.Namewhether they are called correctly.

How to make the breadcrumb of the article detail page display "Article Detail" instead of the actual title of the article?

You can usebreadcrumblabel'stitlethe parameter. Just settitleThe value of the parameter is set to the custom text you want to display, for example{% breadcrumb crumbs with title="文章详情" %}. So, on the article detail page, the last element of the breadcrumb will display as "Article Details", rather than the original title of the article.

3. Can I also customize the names of other pages in the breadcrumb besides the home page name?

breadcrumbTags mainly throughindexParameters control the name of the home page and throughtitleThe parameter controls the display style of the current page. For the middle category pages, the name is usually taken directly from the original title of the category.If you want to modify the display name of the middle category page, you need to modify the corresponding category title from the background, or modify it in the front-end template.item.NamePerforming conditional judgment and replacement, but this will increase the complexity of the template, which is usually not recommended. Maintaining consistency in category names helps clarify the structure of the website.

Related articles

How to integrate and display Markdown, mathematical formulas, and flowcharts correctly on the AnQiCMS page?

In AnQiCMS, adding Markdown, mathematical formulas, and flowcharts to content greatly enhances its expressiveness and readability, especially for technical documents, educational materials, or data analysis reports.AnQiCMS as an efficient content management system, provides flexible mechanisms to support these modern content display needs. To implement the correct display of Markdown, mathematical formulas, and flowcharts on the AnQiCMS page, it mainly involves enabling backend settings and the necessary introduction of frontend templates.Here are the detailed steps and some practical suggestions

2025-11-08

How does AnQiCMS ensure the display quality of image resources and perform automatic compression and WebP conversion?

In the era where content is king, the image resources on the website play a crucial role.They not only directly affect the beauty of the page, but are also key factors in determining the loading speed and user experience of the website.For operators, how to ensure the display quality of images while also taking into account the performance and storage costs of the website is undoubtedly a question worthy of reflection.AnQiCMS (AnQiCMS) is well-versed in this, providing a comprehensive image resource management and optimization strategy, aimed at helping users easily master this challenge.The foundation for ensuring the quality of image display

2025-11-08

How to use AnQiCMS filters to format and truncate output text content?

In the AnQiCMS content management system, the presentation effect of content often determines the user experience and the efficiency of information delivery.To meet the diverse content display needs, AnQiCMS provides a powerful and flexible template filter function.These filters can help us with fine-grained processing of the original text when displaying content, whether it's adjusting text style, optimizing display length, or performing data conversion, it can be easily achieved.

2025-11-08

How to display the friend link list in AnQiCMS?

In AnQiCMS, managing and displaying friendship links is very important for improving the website's search engine optimization (SEO) performance, increasing the number of external links, and promoting traffic interflow between websites.AnQiCMS as a fully functional content management system provides an intuitive backend operation and flexible template tags, allowing you to easily display a list of friend links on your website. ### One, manage friend links in AnQiCMS background Firstly, you need to add and manage friend links in the AnQiCMS background.

2025-11-08

How to use the AnQiCMS document list tag to display content for specific categories or recommended attributes?

In AnQi CMS, efficiently managing and displaying website content is the key to improving user experience and website operation effectiveness.Whether you want to display the latest articles of a specific category on the homepage or highlight products with the "recommended" attribute, the document list tag (`archiveList`) provided by AnQiCMS is the core tool to meet these needs.Its flexible parameter configuration allows us to accurately control content retrieval, transforming technical details into easily accessible operational strategies.

2025-11-08

How to implement the display of previous and next document links in AnQiCMS templates?

When browsing website content, users often want to be able to navigate easily between related articles.In order to find more information or simply enjoy a smooth reading experience, the "Previous" and "Next" document links play a crucial role.They can not only effectively increase the user's stay time on the website, reduce the bounce rate, but also have a positive impact on the internal link structure of the website and the search engine optimization (SEO), helping search engines better understand the relevance of the website content.### Core Function Analysis: AnQiCMS

2025-11-08

How to display custom field content on the AnQiCMS document detail page?

When managing website content in AnQiCMS, we often encounter the need to add some unique information for different types of documents (such as articles, products, etc.).AnQi CMS provides flexible content model features, allowing us to customize fields to meet these personalized needs.How can these custom fields be displayed on the document detail page of the website after they are created and filled with data? This is actually simpler than you imagine, AnQiCMS's powerful template tag system provides us with various convenient ways to achieve this.--- ###

2025-11-08

How to display the list of related documents in AnQiCMS, what is the logic?

How to effectively guide users to discover more interesting content in a content management system is the key to improving user experience and website depth.AnQiCMS handles the 'related document list' feature by providing a flexible and intelligent mechanism that allows us to easily display other articles or products closely related to the current content on the website. This not only helps to extend the user's stay on the website but also optimizes the search engine crawling efficiency through internal links.### AnQiCMS

2025-11-08