Breadcrumb Navigation Tag

Description: Used to get the breadcrumb navigation list

Usage:{% breadcrumb 变量名称 with index="首页" title=true %}If the variable is defined as crumbs{% breadcrumb crumbs with index="首页" title=true %}...{% endbreadcrumb %}.

breadcrumb supports 3 parameters:

  • Show titletitle titleThe parameter can set whether the document detail breadcrumb shows the document title. If it is settitle=falsethen the title will not be displayed,title=trueIf set, it will display the full document title, if the title is set to other specific values, it will display according to the set value, such astitle="文章详情"It will display 'Article Details', the default value istitle=true.
  • Home page nameindex indexThe parameter can be set to the display name of the homepage, the default value is Homepage, and it can be set to other names if needed, such asindex="我的博客".
  • Site IDsiteId siteIdGenerally, it is not necessary to fill in, if you use the multi-site management on the backend to create multiple sites and want to call data from other sites, you can specifysiteIdTo call the data of the specified site.

crumbs is an array object, so it needs to be usedforloop to output

item is the variable within the for loop, the available fields are:

  • Link NameName
  • Link AddressLink

Code example

{# 默认用法 #}
<div>
    {% breadcrumb crumbs %}
    <ul>
        {% for item in crumbs %}
            <li><a href="{{item.Link}}">{{item.Name}}</a></li>
        {% endfor %}
    </ul>
    {% endbreadcrumb %}
</div>

{# 自定义index,不显示标题 #}
<div>
    {% breadcrumb crumbs with index="我的博客" title=false %}
    <ul>
        {% for item in crumbs %}
            <li><a href="{{item.Link}}">{{item.Name}}</a></li>
        {% endfor %}
    </ul>
    {% endbreadcrumb %}
</div>