How to display breadcrumb navigation on the page to enhance users' understanding of the content structure?

Calendar 👁️ 64

When we browse websites, we often see a line of text at the top of the page or above the content area, clearly indicating the position of the current page in the overall website structure, like "Home > Product Center > Some Product Category > Some Product Details" like this.This is what we commonly refer to as 'Breadcrumb Navigation'.It not only helps users quickly understand the content hierarchy of the website and avoid getting lost, but also plays an important role in user experience and search engine optimization (SEO).

AnQi CMS understands the importance of breadcrumb navigation and therefore built a simple and efficient implementation method from the beginning of the system design, allowing website operators to easily display this navigation element on the page, thereby enhancing users' understanding of the website content structure.

How to implement breadcrumb navigation in AnQi CMS?

The AnQi CMS is built-in with a very convenient breadcrumb navigation tag, which can intelligently generate the corresponding navigation path according to the type of the current page (whether it is the homepage, category page, article detail page, single page, or tag page).This means you don't have to write complex logic code to determine the current page and manually build the path, the system will automatically handle these, greatly simplifying development and maintenance work.

This core tag is{% breadcrumb %}It will automatically collect all parent paths of the current page up to the homepage and organize them into a list for use in the template.

Add breadcrumb navigation to your template.

To display breadcrumb navigation on your website, we usually place it in a common code snippet, such as in the template file directory under yourpartial/folderbreadcrumb.htmlFile, then include it in your main template file (such asbase.htmlor at the top of each page).

First, you can write the code like this inpartial/breadcrumb.htmlthe file:

{# partial/breadcrumb.html 文件内容示例 #}
<nav class="breadcrumb-nav" aria-label="breadcrumb">
    <ol class="breadcrumb">
        {% breadcrumb crumbs %}
            {% for item in crumbs %}
                <li class="breadcrumb-item">
                    <a href="{{ item.Link }}">{{ item.Name }}</a>
                </li>
            {% endfor %}
        {% endbreadcrumb %}
    </ol>
</nav>

Next, you just need to add a line of code in your main website template file (for examplebase.html) at the position where you want to display the breadcrumb navigation.

{# 在您的 base.html 或其他需要显示面包屑的模板文件中 #}
{% include "partial/breadcrumb.html" %}

This will automatically identify and generate breadcrumb navigation that matches the current page path regardless of which page the user visits.

Display of personalized breadcrumb navigation.

The breadcrumb navigation tags of Anqi CMS also provide several parameters, allowing you to have more detailed control and customization according to your actual needs.

  1. Customize the "Home" text:By default, the first element of the breadcrumb navigation is "Home". If you want to display other text, such as "My Blog" or your brand name, you can useindexSet the parameter:

    {% breadcrumb crumbs with index="我的博客" %}
        {# ... 您的循环代码 ... #}
    {% endbreadcrumb %}
    
  2. Control the display of the current page title:The last item of the breadcrumb navigation is usually the title of the current page. You cantitlecontrol its display in the parameters:

    • title=true(Default): Show the full title of the current page.
    • title=false: Do not show the title of the current page, the breadcrumb navigation will end at the second-to-last level.
    • title="自定义文本": Replace the current page title with custom text.
    {# 显示文章标题 #}
    {% breadcrumb crumbs with title=true %} ... {% endbreadcrumb %}
    
    {# 不显示文章标题 #}
    {% breadcrumb crumbs with title=false %} ... {% endbreadcrumb %}
    
    {# 显示自定义文本作为当前页面的名称 #}
    {% breadcrumb crumbs with title="文章详情页" %} ... {% endbreadcrumb %}
    
  3. Data call under multi-site environment (Advanced):If you have configured multiple sites in the Anqi CMS backend and want to call data from other sites in the breadcrumb navigation of a site (which is usually a special requirement), you can usesiteIdThe parameter specifies the site ID. Generally, this parameter does not need to be set, as the system will automatically identify the current site.

Further optimization and usage suggestions

  • Maintain consistency:Strongly recommend to use breadcrumb navigation.includePlace the statement globally on the websitebase.htmlIn the template, this ensures consistent navigation experience on all pages
  • Visual style:Although AnQi CMS provides functionality, the final visual effect of the breadcrumb navigation depends on your CSS style. You can design it according to the overall style of the website.breadcrumb-nav/breadcrumbandbreadcrumb-itemAdd custom styles to the class to make it better integrate into the page.
  • SEO friendly:Breadcrumbs navigation helps search engines better understand your website structure, especially in sites with deep levels.It provides clear internal links, having a positive impact on SEO.Ensure that the link is clickable and uses the correct semantic tags (such as<nav>and<ol>)

By reasonably using the breadcrumb navigation function of AnQi CMS, you can not only provide users with clearer website path guidance and effectively improve the browsing experience, but also lay a solid foundation for the website's search engine optimization.


Frequently Asked Questions (FAQ)

  1. Q: Why does my breadcrumb navigation only show the category and not the article title on the article detail page?A: This may be because you are in{% breadcrumb %}put in the tag.titlethe parameter tofalse. Please check your template code to ensuretitlethe parameter is set totrueOr it can be assigned the custom text you want to display, for example{% breadcrumb crumbs with title=true %}.

  2. Q: How should I set the breadcrumb navigation's "Home" link to display as "Website Homepage"?A: You can modify the display text of the homepage by using the parameter. For example, you can set it like this:{% breadcrumb %}the tag withindexParameter to modify the display text of "Homepage". For example, you can set it as follows:{% breadcrumb crumbs with index="网站主页" %}.

  3. Q: The breadcrumb navigation style does not look very aesthetic, does AnQi CMS provide default styles?A: The template tags of Anqi CMS are mainly responsible for outputting structured data and HTML skeletons, and do not necessarily provide visual styles.The final style of the breadcrumb navigation needs to be beautified by you through custom CSS.You can target in your template CSS file,breadcrumb-nav/breadcrumb/breadcrumb-itemWait for HTML elements and class names to write style code to match the visual design of your website.

Related articles

How to build and display a multi-level navigation menu for a website?

Website navigation, like the skeleton and compass of a website, it guides visitors to explore the website content, and is the core of user experience and information architecture.A clear and accessible navigation menu that not only helps users find the information they need quickly, but is also crucial for search engine optimization (SEO).AnQiCMS (AnQiCMS) is well-versed in this, providing powerful and flexible navigation management features that allow you to easily build and display multi-level navigation menus.Next, we will delve deeper into how to build and display your website navigation step by step in Anqi CMS.--- ### One

2025-11-08

How to dynamically display SEO titles, keywords, and descriptions (TDK) on different pages?

In website operation, Search Engine Optimization (SEO) is a key element in enhancing website visibility.Among them, the page title (Title), keywords (Keywords), and description (Description), abbreviated as TDK, play a crucial role.They are not only the primary information that search engines understand the content of the page, but also an important factor in attracting users to click.In AnQiCMS (AnQiCMS), we can easily implement the dynamic display of TDK, allowing each page of the website to have appropriate and attractive TDK information

2025-11-08

How to display contact information on the page, such as phone number, address, etc.

The contact information of the website is an important part of establishing user trust and providing convenient services.Whether it is displaying a simple phone number at the bottom of the website or providing detailed addresses and social media links on the "Contact Us" page, Anqi CMS offers a flexible and efficient way to manage and present these key information.This article will delve into how to set up and display all the contact information on your website using Anqi CMS, ensuring that your customers can easily find you.### Backend Management:Unified setting your contact information In AnQi CMS

2025-11-08

How to retrieve and display the system configuration information of the website in the template?

In website operation, we often need to display some global website information, such as the website name, Logo, filing number, copyright statement, as well as custom contact information or social media links.This information, if directly hardcoded in the template, would require searching and updating each page whenever a modification is needed, which is time-consuming and prone to errors.The AnQi CMS provides a very powerful and convenient template tag —— the `system` tag, which allows these system configuration information to be dynamically obtained and displayed in the template, greatly enhancing the maintainability and operational efficiency of the website.###

2025-11-08

How to use conditional judgment logic in a template to control the display and hiding of content?

In the presentation of website content, we often need to decide based on different situations which information should be displayed to visitors and which should be temporarily hidden.AnQiCMS (AnQiCMS) provides flexible template conditional judgment logic, making content display and hide intuitive and efficient.By these judgments, you can easily implement personalized page layouts, content display under permission control, and adjustment of page elements based on data status, which greatly enhances the dynamicity and user experience of the website.The Anqi CMS template system uses a syntax similar to the Django template engine

2025-11-08

How to iterate over list data in a template and display it one by one?

Managing and displaying content in Anqi CMS is one of its core advantages.When we need to display dynamic list data on the front end of a website, such as the latest articles, popular products, and content collections under categories, understanding how to efficiently iterate through these data in templates and display them one by one is an essential skill for website operators and template developers.The Anqi CMS template system adopts syntax similar to Django, which is intuitive and powerful, making the transformation of technical information and practical application extremely convenient.### Core Loop Syntax: `{% for %}`

2025-11-08

How to format timestamps and display them on the page as a readable date and time?

In website operation, the timeliness of content is often the key to attracting readers' attention.Whether it is the release date of the article or the update time of the product, these pieces of information, if presented in a clear and easy-to-understand manner on the page, will greatly enhance the user experience.However, you may find that the time information recorded by AnQiCMS backend, when directly called in the template, often appears as a long series of numbers, which is what we usually call a timestamp.These original timestamps are convenient for internal system processing, but they lack readability for ordinary users.It's lucky that

2025-11-08

How to set the recommendation attribute to affect the display priority of the front-end content when publishing a document?

How to effectively guide visitors to focus on key information when managing content in AnQi CMS, and enhance the visibility and interactivity of the content, is a common concern for operators.By setting the recommended properties of the document reasonably, we can finely control the display priority of the front-end content, thereby achieving this goal.This not only helps to optimize the user experience, but also better serves the overall operation strategy of the website.### Backend settings recommended attribute: clear content positioning When we publish or edit a document, the content editing interface of Anqi CMS provides a feature area named "Recommended Attribute".

2025-11-08