Add breadcrumbs

This commit is contained in:
James Panther
2021-08-18 10:08:06 +10:00
parent 64dd424b80
commit 85b0f11c77
8 changed files with 30 additions and 2 deletions
+3
View File
@@ -1,6 +1,9 @@
{{ define "main" }}
<article class="max-w-prose">
<header>
{{ if .Site.Params.article.showBreadcrumbs | default false }}
{{ partial "breadcrumbs.html" . }}
{{ end }}
<h1 class="mt-0 text-4xl font-extrabold">{{ .Title | emojify }}</h1>
<div class="mt-8 mb-12 text-base text-gray-400 dark:text-gray-500">
{{ partial "article-meta.html" . }}
+13
View File
@@ -0,0 +1,13 @@
<ol class="text-sm text-gray-400 dark:text-gray-600">
{{ template "crumb" (dict "p1" . "p2" .) }}
</ol>
{{ define "crumb" }}
{{ if .p1.Parent }}
{{ template "crumb" (dict "p1" .p1.Parent "p2" .p2 ) }}
{{ else if not .p1.IsHome }}
{{ template "crumb" (dict "p1" .p1.Site.Home "p2" .p2 ) }}
{{ end }}
<li class="inline {{ if or (eq .p1 .p2) (.p1.IsHome) }}hidden{{ end }}">
<a href="{{ .p1.Permalink }}">{{ .p1.Title }}</a><span class="px-1 text-primary-500">/</span>
</li>
{{ end }}
+3
View File
@@ -1,3 +1,6 @@
{{ if .Site.Params.list.showBreadcrumbs | default false }}
{{ partial "breadcrumbs.html" . }}
{{ end }}
<section class="prose dark:prose-light">
<h1 class="mb-3 text-4xl font-extrabold">{{ .Title }}</h1>
<section>{{ .Content }}</section>