How to implement breadcrumb navigation in AnqiCMS templates and control the display of the home page name and document title?

Calendar 👁️ 70

In website operation, a clear navigation path is crucial for user experience and Search Engine Optimization (SEO).Breadcrumb Navigation as a type of auxiliary navigation can intuitively tell users the position of the current page in the website structure, effectively reduce the bounce rate, and help search engines better understand the website hierarchy.

AnqiCMS as a flexible content management system, provides a very convenient way to implement breadcrumb navigation in templates and can finely control the display of home page names and document titles as needed.

Implement breadcrumb navigation in AnqiCMS template

The core of implementing breadcrumb navigation in AnqiCMS is to use built-inbreadcrumbThe tag is very smart, it automatically generates the corresponding navigation path according to the type of the current page (home page, category page, document detail page, single page, etc.) and the level.

Generally, we would place the breadcrumb navigation code in the public part of the website, such aspartial/header.htmlorpartial/breadcrumb.htmlin such code snippet files, and then through{% include "partial/breadcrumb.html" %}introduce it to the pages that need to be displayed.

The basic usage of breadcrumb tags is as follows:

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

In this code block:

  • {% breadcrumb crumbs %}Declared acrumbsvariable, which is an array object containing each item in the breadcrumb navigation.
  • {% for item in crumbs %}Loop through thiscrumbsarray.
  • item.NameRepresents the name of the navigation item (for example, "Home", "Company News", "Article Title").
  • item.LinkRepresents the link address of the navigation item.
  • forloop.Lastis a special loop variable used to determine the current iteration ofitemIs it the last item in the array. For breadcrumb navigation, the last item is usually the current page, which should not have a link, so we use<span>tag wrapping.

Control the display of the home page name

AnqiCMS ofbreadcrumbTags allow us to customize the display name of the home page in the breadcrumb navigation.By default, the home page will display as "home page".indexSet the parameters.

Just inbreadcrumbthe tag withindexThe parameter, and set its value to the homepage name you want.

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

This will make the starting item of your breadcrumb navigation display as "My site homepage", instead of the default "Home".

Control the display of the document title.

On the document detail page, the last item of the breadcrumb navigation is usually the title of the current document. AnqiCMS providestitleparameters, allowing you to flexibly control the display of this section.

titleThere are several ways to use the parameter:

  • title=true(Default behavior):This will display the full document title as the last item in the breadcrumb. If you do not settitlethe parameter, this is the default effect.
  • title=false:If you want to hide the current document title in the breadcrumb navigation on the document detail page and keep it at the level of the parent category, you cantitlethe parameter tofalseThis may help simplify navigation in some designs
  • title="自定义标题":If you want to display a fixed text for the last item of the breadcrumb navigation on the document detail page, such as "Article Details", "Product Details", etc., instead of the specific document title, you can settitleThe parameter is set to a string.

Below is a combinationtitleExample of parameter usage:

{# 显示完整文档标题 (默认效果) #}
{% breadcrumb crumbs with title=true %}
    <ul class="breadcrumb-nav">
        {% for item in crumbs %}
            <li class="breadcrumb-item">
                {% if forloop.Last %}
                    <span>{{item.Name}}</span>
                {% else %}
                    <a href="{{item.Link}}">{{item.Name}}</a>
                {% endif %}
            </li>
        {% endfor %}
    </ul>
{% endbreadcrumb %}

{# 不显示文档标题 #}
{% breadcrumb crumbs with title=false %}
    <ul class="breadcrumb-nav">
        {% for item in crumbs %}
            <li class="breadcrumb-item">
                {% if forloop.Last %}
                    <span>{{item.Name}}</span>
                {% else %}
                    <a href="{{item.Link}}">{{item.Name}}</a>
                {% endif %}
            </li>
        {% endfor %}
    </ul>
{% endbreadcrumb %}

{# 显示自定义文本作为文档标题 #}
{% breadcrumb crumbs with title="当前产品详情" %}
    <ul class="breadcrumb-nav">
        {% for item in crumbs %}
            <li class="breadcrumb-item">
                {% if forloop.Last %}
                    <span>{{item.Name}}</span>
                {% else %}
                    <a href="{{item.Link}}">{{item.Name}}</a>
                {% endif %}
            </li>
        {% endfor %}
    </ul>
{% endbreadcrumb %}

By reasonable applicationindexandtitleYou can flexibly control the display of breadcrumbs to make it more consistent with your website design and user needs.

Summary

AnqiCMS ofbreadcrumbThe tag provides a simple and powerful breadcrumb navigation implementation solution for website administrators and developers.No matter whether you need to customize the homepage name or want to finely control the display of document titles, AnqiCMS makes it easy for you to achieve this through intuitive template tag parameters.This not only improves the user experience of the website, but also provides convenience for search engines to crawl and understand the website structure, which is greatly beneficial to the overall SEO performance of the website.


Frequently Asked Questions (FAQ)

  1. Ask: How to add a custom separator between each item in the breadcrumb navigation, for example>or/?Answer: AnqiCMS'sbreadcrumbThe tag itself does not provide a parameter to directly set the separator, but you can do so in the template's HTML structure through CSS or directly in<li>Add text between elements to achieve this. For example, you can<li>insert directly between>symbols, or use CSS's::afterpseudo-elements to add stylized separators.

  2. Ask: What is the use of breadcrumb navigation?siteIdWhat parameters are used? Do I need to set them on my single-site website?Answer:siteIdThe parameter is mainly used for the multi-site management feature of AnqiCMS. If you have created multiple independent sites in the background and want to call data from other sites in a template of a certain site, you need to go throughsiteIdSpecify. For most single-site websites, this parameter is usually not required to be manually set, as the system will automatically identify the context of the current site.

  3. Ask: Why does the breadcrumb navigation display the document's default title instead of the 'SEO title' I set in the backend? Can it be changed?Answer: The breadcrumb tags of AnqiCMS are displayed by default as the general title of the page (or category name, single page name), which is to provide the most intuitive and user-friendly navigation path.The purpose of breadcrumbs is to inform the user “where are you now”, usually using display names that users can recognize directly.If you really need to display the SEO title, this usually involves advanced template customization, may require manually obtaining the current page's SEO title, and assigning it to the last item of the breadcrumb, but this is not the default and recommended behavior as it may affect the intuitiveness of the user experience.

Related articles

How to build and display the AnqiCMS multi-level website navigation list, and support custom styles and subtitle display?

Building an efficient, intuitive, and user-friendly website depends on carefully designed navigation systems.In AnQiCMS, building a multi-level website navigation list, and supporting custom styles and subtitle display, is a powerful and flexible feature.It allows content operators to easily create menu structures that adapt to various complex scenarios according to business needs.

2025-11-09

How to customize the homepage title, keywords, and description through AnqiCMS's TDK tags to improve search engine display?

In website operation, it is crucial to have your website displayed better in search engines, and the TDK (Title, Description, Keywords) tags on the homepage are the core to achieve this goal.AnqiCMS as a SEO-friendly content management system provides intuitive and powerful features to help you easily customize these key elements.By cleverly setting the homepage TDK, you can not only improve the visibility of the website in the search results, but also attract more target users to click and visit.### Understand TDK

2025-11-09

How to display the contact information set in the AnqiCMS backend on the front page and support custom parameter display?

A website can effectively convey information, one of the core elements being that visitors can easily find the contact information.Whether it is in the footer of the website, a special "Contact Us" page, or in the article content, clear and clear contact information is the key to improving user experience and building trust.AnqiCMS (AnqiCMS) with its flexible and customizable features allows you to easily manage this information in the background and display it on the front page, even supporting custom parameters to meet various business needs.Next, let's take a look at how to use the AnqiCMS website front page on your site

2025-11-09

How to call and display AnqiCMS system configuration information on the front page, such as the website name, Logo, or filing number?

When building and managing a website, we often need to ensure that core brand information, such as the website name, Logo, and the registration number required by laws and regulations, remains consistent across all pages of the website and can be updated at any time.AnqiCMS provides a直观而强大的template system, making it very simple and efficient to call and display these global configuration information on the front page.

2025-11-09

How to use the AnqiCMS category list tag to display article/product categories by level or model on the front end?

It is crucial to organize and present information efficiently in website content management.AnqiCMS provides a powerful template tag system, where the `categoryList` tag is a core tool for displaying articles or product categories flexibly.By mastering the use of this tag, users can easily build a clear and functional classification navigation on the front end, whether displaying by level or filtering according to the content model (such as articles, products), they can handle it with ease.### Get to know `categoryList`

2025-11-09

How to accurately call and display the detailed information of a specific category in AnqiCMS on the front page, including the description and Banner image?

In AnqiCMS (AnqiCMS), the need to accurately call and display detailed information about a specific category on the front page, such as the category description and its exclusive Banner image, is a common requirement.This can make the structure of the website content clearer, as well as improve user experience and the website's SEO performance.Benefiting from AnqiCMS flexible template tag system, achieving this goal is actually very direct. We mainly use a core template tag——`categoryDetail`.

2025-11-09

How to use AnqiCMS's single page list tag to flexibly display independent pages such as 'About Us' on the front end?

In modern website operations, pages like "About Us", "Contact Information", and "Terms of Service" are independent pages that carry the basic information and brand image of the website. Although they are not updated often, they are crucial.AnqiCMS provides a flexible single-page management feature, combining its powerful template tag system, we can easily display these independent pages on the front end and customize them as needed.

2025-11-09

How to call and display the detailed content and images of a specific page in AnqiCMS on the front page?

In AnQiCMS, it is actually much simpler than you imagine to call and display the detailed content and images of a specific single page on the front page.AnQiCMS's powerful template tag system, especially the tags designed for single-page layouts, can help you achieve this easily. ### Understanding AnQiCMS Single Page Functionality Firstly, we know that AnQiCMS provides an independent "Page Management" module that allows us to create independent single pages such as "About Us", "Contact Information", or "Service Introduction".This page's content, images, SEO information, etc.

2025-11-09