How to control whether the AnQiCMS breadcrumb navigation displays the title of the current page?
In website operation, user experience (UX) and search engine optimization (SEO) are always the core focus.Breadcrumbs navigation is an important part of the website structure, playing an indispensable role in both aspects.It not only helps visitors quickly understand their location on the website and effectively prevent getting lost, but also provides clear guidance for the website's hierarchical structure to search engines.
As an experienced website operations expert, I know that even seemingly minor details can have a huge impact on the overall website effect.AnQiCMS (AnQi Content Management System) is a product that also offers powerful customization capabilities in the details.Today, let's delve deeply into a common issue in website design and operation: how to flexibly control whether the AnQiCMS breadcrumb navigation displays the title of the current page.
Mastering Breadcrumbs: Display Strategy for the Current Page Title
In actual operation, we often encounter such a scenario: on some pages, we hope that the breadcrumb navigation can fully present the title of the current page to provide the most detailed path information;On some other pages, it may be for the sake of design aesthetics, page simplicity, or information consistency that we want to hide the title of the current page or replace it with a more generic text.AnQiCMS fully understands these diversified needs and provides us with an intuitive and flexible control method through its powerful template tag system.
The key to realizing this function lies in the AnQiCMS providedbreadcrumbtemplate tag. This tag is specifically used to generate breadcrumb navigation and has a core parametertitle. ThistitleThe parameter is the 'baton' we use to control the display behavior of the current page title.
titleDetailed explanation of the exquisite usage of the parameter:
titleThe flexibility of the parameter is reflected in its ability to accept three different types of values to meet various display requirements:
title=true: It displays the title of the current page completelyThis istitleThe default behavior of the parameter. When you set it totrueAt the end of the breadcrumb navigation, AnQiCMS will fully display the actual title of the current page.This is very suitable for content detail pages, such as articles, product or service detail pages, where it is necessary to clearly inform users of the specific content they are browsing.For example, while browsing an article named 'AnQi CMS Efficient Deployment Guide', the breadcrumb navigation will display as 'Home > Blog > AnQi CMS Efficient Deployment Guide'.{% breadcrumb crumbs with index="首页" title=true %} <ol class="breadcrumb"> {% for item in crumbs %} <li{% if forloop.last %} class="active"{% endif %}> {% if forloop.last %}{{ item.Name }}{% else %}<a href="{{ item.Link }}">{{ item.Name }}</a>{% endif %} </li> {% endfor %} </ol> {% endbreadcrumb %}In the above code,
{{ item.Name }}It will directly output the full title of the current page.title=false: Hide the title of the current pageIf you want the breadcrumb navigation to be extremely concise and not display the title of the current page, just need totitlethe parameter tofalseIt can be. In this case, the breadcrumb navigation will stop at the direct parent category or parent page of the current page, and the current page itself will not appear as a clickable or displayed item in the breadcrumb.This can make the page look cleaner and less redundant on some websites that pursue minimalist design styles.For example, when visiting the product details page, the breadcrumb may only display up to “Home > Product Category”, without displaying the specific product name.{% breadcrumb crumbs with index="首页" title=false %} <ol class="breadcrumb"> {% for item in crumbs %} <li{% if forloop.last %} class="active"{% endif %}> {% if forloop.last %}{{ item.Name }}{% else %}<a href="{{ item.Link }}">{{ item.Name }}</a>{% endif %} </li> {% endfor %} </ol> {% endbreadcrumb %}It is worth noting that even if it is set to
falsein the loop,forloop.lastit can still help you judge whether it is the last item in the breadcrumb trail, but at this point,item.NameThe output is the parent name of the current page, not the title of the current page.title="自定义文本": Replace the current page title with specific textExcept for boolean valuestrueandfalse,titleThe parameter also accepts a string value. This means you can display a custom, unified text in the breadcrumbs for the current page instead of its original title.For example, regardless of which product the user clicks on, the end of all product detail pages is unified to display "Product Details"