From: danix Date: Mon, 6 Feb 2023 09:35:47 +0000 (+0100) Subject: fixed page listing for articles. Now single pages show up even if they're branches... X-Git-Url: https://git.danix.xyz/?p=theme-danix.xyz.git;a=commitdiff_plain;h=d862564bc2609461aad794ae1e26b5db875f8eee fixed page listing for articles. Now single pages show up even if they're branches. Added breadcrumbs template. --- diff --git a/layouts/articles/baseof.html b/layouts/articles/list-baseof.html similarity index 92% rename from layouts/articles/baseof.html rename to layouts/articles/list-baseof.html index 8992f73..9a5985d 100644 --- a/layouts/articles/baseof.html +++ b/layouts/articles/list-baseof.html @@ -5,6 +5,7 @@
{{- partial "header.html" . -}} + {{- partial "breadcrumbs.html" . -}}
diff --git a/layouts/articles/list.html b/layouts/articles/list.html index 4a4b1f3..d75b6db 100644 --- a/layouts/articles/list.html +++ b/layouts/articles/list.html @@ -1,9 +1,6 @@ {{ define "main" }} -
-
-

{{ .Title }}

-
-
+
+
{{ .Content }}
@@ -11,7 +8,10 @@ {{ range .Pages }}
  • - {{.Date.Format "01-02-2006"}} | {{.Title}} +
    +

    {{.Title}}

    + +
  • {{ end }} diff --git a/layouts/index-baseof.html b/layouts/home-baseof.html similarity index 100% rename from layouts/index-baseof.html rename to layouts/home-baseof.html diff --git a/layouts/index.html b/layouts/home.html similarity index 100% rename from layouts/index.html rename to layouts/home.html diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html new file mode 100644 index 0000000..fd8cc6b --- /dev/null +++ b/layouts/partials/breadcrumbs.html @@ -0,0 +1,28 @@ +
      + {{- /* declare a 'variable' to store the each link position */}} + {{- $data := newScratch }} + + {{- range $index, $value := .Ancestors.Reverse }} +
    1. + {{- /* read the index from loop and add 'one', because it starts counting from zero */}} + {{- $data.Set "counter" $index }} + {{- $data.Add "counter" 1 }} + + {{ if .IsHome }} + home + {{ else }} + {{.Title}} + {{ end }} + + {{- /* pass the counter value into schema attribute */}} + +
    2. + {{- end }} +
    3. + {{- /* add 'one' one more time for the last link position */}} + {{- $data.Add "counter" 1 }} + {{.Title}} + {{- /* pass the counter value into schema attribute */}} + +
    4. +
    \ No newline at end of file diff --git a/layouts/post/single-baseof.html b/layouts/post/single-baseof.html index dbe68c7..1253cd5 100644 --- a/layouts/post/single-baseof.html +++ b/layouts/post/single-baseof.html @@ -5,6 +5,7 @@
    {{- partial "header.html" . -}} + {{- partial "breadcrumbs.html" . -}}