Add hasBreadcrumbs variable to allow non-article content to add breadcrumbs

This commit is contained in:
Helen Chong 2024-04-19 23:56:22 +08:00
parent baf61d74ae
commit 15f074abb6
1 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<header class="main__header"> <header class="main__header">
{% if isArticle %} {% if isArticle or hasBreadcrumbs %}
<ul class="breadcrumbs"> <ul class="breadcrumbs">
{% set breadcrumbNavPages = collections.all | eleventyNavigationBreadcrumb(articleTitle) %} {% set breadcrumbNavPages = collections.all | eleventyNavigationBreadcrumb(articleTitle) %}
{%- for entry in breadcrumbNavPages %} {%- for entry in breadcrumbNavPages %}
@ -9,7 +9,9 @@
{%- endfor %} {%- endfor %}
</ul> </ul>
{% endif %}
{% if isArticle %}
<h1>{{ articleTitle }}</h1> <h1>{{ articleTitle }}</h1>
<div class="article__info"> <div class="article__info">
<p>Posted on {{ date | niceDate }} by {{ sitemeta.siteAuthor.name }} <p>Posted on {{ date | niceDate }} by {{ sitemeta.siteAuthor.name }}