diff --git a/.gitignore b/.gitignore index 20fc099..6b28dc7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ public resources themes static/img +.hugo_build.lock \ No newline at end of file diff --git a/i18n/de.yaml b/i18n/de.yaml index 718054c..f9d4ffc 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -1,5 +1,5 @@ # -# de.yaml 2021-11-24 +# de.yaml 2022-01-06 # about: @@ -74,6 +74,9 @@ sibling-articles: Teaser: other: Hintergrund +toc: + other: Inhaltsverzeichnis + topics: other: Themen diff --git a/i18n/en.yaml b/i18n/en.yaml index a48cf10..3796bb7 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -1,5 +1,5 @@ # -# en.yaml 2021-11-24 +# en.yaml 2022-01-06 # about: @@ -75,6 +75,9 @@ sibling-articles: Teaser: other: Teaser +toc: + other: Contents + topics: other: Topics diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 61a4722..8111850 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -69,4 +69,15 @@ (dict "related" $related "header" $header "id" "articles-in-section") -}} {{- end }} + {{ if .Params.toc -}} +
+
+

{{i18n "toc"}}

+
+
+ {{ .TableOfContents }} +
+
+ {{ end -}} + diff --git a/layouts/shortcodes/ilink.html b/layouts/shortcodes/ilink.html index 4c64fde..7f135d1 100644 --- a/layouts/shortcodes/ilink.html +++ b/layouts/shortcodes/ilink.html @@ -1,5 +1,9 @@ {{- $pages := where .Site.RegularPages "Params.pageid" "eq" (.Get "pid") -}} +{{- $frag := .Get "id" -}} +{{- $fragsep := "" -}} +{{- if ne $frag "" -}}{{- $fragsep = "#" -}}{{- end -}} {{- $inner := .Inner -}} {{- range $pages -}} -{{ or $inner .Title | markdownify }} +{{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}} +{{ or $inner .Title | markdownify }} {{- end -}}