document anchor settings

master
Robert Kaussow 2020-02-27 00:08:00 +01:00
parent 14567a6df4
commit 977daa7487
3 changed files with 14 additions and 2 deletions

View File

@ -49,6 +49,9 @@
# (Optional, default none) Add a link to your Privacy Policy page to the site footer. # (Optional, default none) Add a link to your Privacy Policy page to the site footer.
# It can be either a remote url or a local file path relative to your content directory. # It can be either a remote url or a local file path relative to your content directory.
geekdocPrivacyPolicy = '/privacy' geekdocPrivacyPolicy = '/privacy'
# (Optional, default true) Add an anchor link to headlines.
geekdocAnchor = true
``` ```
{{< /tab >}} {{< /tab >}}
@ -101,6 +104,9 @@ params:
# (Optional, default none) Add a link to your Privacy Policy page to the site footer. # (Optional, default none) Add a link to your Privacy Policy page to the site footer.
# It can be either a remote url or a local file path relative to your content directory. # It can be either a remote url or a local file path relative to your content directory.
geekdocPrivacyPolicy: /privacy geekdocPrivacyPolicy: /privacy
# (Optional, default true) Add an anchor link to headlines.
geekdocAnchor: true
``` ```
{{< /tab >}} {{< /tab >}}
@ -140,6 +146,9 @@ geekdocFlatSection = true
# Set true to hide page or section from side menu (file-tree menu only) # Set true to hide page or section from side menu (file-tree menu only)
geekdocHidden = true geekdocHidden = true
# Add an anchor link to headlines
geekdocAnchor = true
``` ```
{{< /tab >}} {{< /tab >}}
@ -174,6 +183,9 @@ geekdocFlatSection: true
# Set true to hide page or section from side menu (file-tree menu only) # Set true to hide page or section from side menu (file-tree menu only)
geekdocHidden: true geekdocHidden: true
# Add an anchor link to headlines
geekdocAnchor: true
``` ```
{{< /tab >}} {{< /tab >}}

View File

@ -1,4 +1,4 @@
{{ $showAnchor := (and (default true .Page.Params.geekdocAnchor) (default true .Site.Params.geekdocAnchor)) }} {{ $showAnchor := (and (default true .Page.Params.GeekdocAnchor) (default true .Site.Params.GeekdocAnchor)) }}
{{ $.Scratch.Set "content" (.Content | replaceRE `<nav id="TableOfContents">\s*<ul>\s*<li>\s*<ul>` `<nav id="TableOfContents"><ul>` | replaceRE `</ul>\s*</li>\s*</ul>\s*</nav>` `</ul></nav>` | safeHTML) }} {{ $.Scratch.Set "content" (.Content | replaceRE `<nav id="TableOfContents">\s*<ul>\s*<li>\s*<ul>` `<nav id="TableOfContents"><ul>` | replaceRE `</ul>\s*</li>\s*</ul>\s*</nav>` `</ul></nav>` | safeHTML) }}
{{ if $showAnchor }} {{ if $showAnchor }}

View File

@ -17,7 +17,7 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ $showBreadcrumb := (and (default true .Page.Params.geekdocBreadcrumb) (default true .Site.Params.geekdocBreadcrumb)) }} {{ $showBreadcrumb := (and (default true .Page.Params.GeekdocBreadcrumb) (default true .Site.Params.GeekdocBreadcrumb)) }}
{{ $showEdit := (and ($.Scratch.Get "geekdocFilePath") $geekdocRepo $geekdocEditPath) }} {{ $showEdit := (and ($.Scratch.Get "geekdocFilePath") $geekdocRepo $geekdocEditPath) }}
<div class="gdoc-page__header flex flex-wrap justify-between{{ if not $showEdit }} hidden-mobile{{ end }}{{ if (and (not $showBreadcrumb) (not $showEdit)) }} hidden {{ end }}" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> <div class="gdoc-page__header flex flex-wrap justify-between{{ if not $showEdit }} hidden-mobile{{ end }}{{ if (and (not $showBreadcrumb) (not $showEdit)) }} hidden {{ end }}" itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
<span> <span>