User Tools

Site Tools


misc:zola_tips

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
misc:zola_tips [2022/12/25 22:17] – [Sections and _index.md] mithatmisc:zola_tips [2022/12/25 22:23] – [Breadcrumbs] mithat
Line 141: Line 141:
 No doubt, there are opportunities to stuff some of this into macros and/or partials and/or similar. No doubt, there are opportunities to stuff some of this into macros and/or partials and/or similar.
 ===== Breadcrumbs ===== ===== Breadcrumbs =====
-See this [[https://zola.discourse.group/t/breadcrumb/509/3|forum post]].+See this [[https://zola.discourse.group/t/breadcrumb/509/3|forum post]], reproduced and re-formatted here in case it goes away: 
 + 
 +<code twig> 
 +{% block breadcrumb %} 
 +<div class="breadcrumb-container"> 
 +  <a class="breadcrumb-path" href="/">Home</a> 
 +  {% set current = section | default(value=page) %} 
 +  {% for ancestor in current.ancestors %} 
 +    {% if loop.first %} 
 +      {% continue %} 
 +    {% endif %} 
 +    <span class="breadcrumb-separator">/</span> 
 +    {% set section = get_section(path=ancestor) %} 
 +    <a class="breadcrumb-path" href="{{ section.permalink }}">{{ section.title }}</a> 
 +  {% endfor %} 
 +  <span class="breadcrumb-separator">/</span> 
 +  <a class="breadcrumb-path active" href="{{ current.permalink }}">{{ current.title }}</a> 
 +</div> 
 +{% endblock breadcrumb %} 
 +</code>
misc/zola_tips.txt · Last modified: 2022/12/25 22:57 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki