theme: make heading a template #744

This commit is contained in:
Sören Weber 2023-12-02 01:09:45 +01:00
parent 76782d06e5
commit ac985ee78c
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
7 changed files with 8 additions and 4 deletions

View file

@ -203,6 +203,7 @@ This theme defines the following partials :
- `custom-header.html`: custom headers in page. Meant to be overwritten when adding CSS imports. Don't forget to include `style` HTML tag directive in your file.
- `custom-footer.html`: custom footer in page. Meant to be overwritten when adding JavaScript. Don't forget to include `javascript` HTML tag directive in your file.
- `favicon.html`: the favicon
- `heading.html`: side-wide configuration to change the pages title headings.
- `heading-pre.html`: side-wide configuration to prepend to pages title headings. If you override this, it is your responsibility to take the page's `headingPre` setting into account.
- `heading-post.html`: side-wide configuration to append to pages title headings. If you override this, it is your responsibility to take the page's `headingPost` setting into account.
- `logo.html`: the logo, on top left hand corner

View file

@ -28,6 +28,8 @@ This document shows you what's new in the latest release and flags it with one o
The advanced functionality allows you to set an explicit name for a theme variant, set different colors (if you are using monochrome SVGs) or even different icons (handy if you want to adjust colors for PNGs, GIFs or JPGs) and now allows for multiple auto mode variants that adjust to the light/dark preference of your OS settings.
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} New partial for defining the heading. See [documentation](basics/customization#partials) for further reading.
---
## 5.23.0 (2023-11-03) {#5230}

View file

@ -6,7 +6,7 @@
{{- partial "content-header.html" . }}
</header>
{{ partial "heading-pre.html" . }}<div class="article-subheading">{{ T "Chapter" .Params.Weight }}</div>
<h1 id="{{ .Title | plainify | anchorize }}">{{ .Title }}</h1>{{ partial "heading-post.html" . }}
{{ partial "heading.html" . }}{{ partial "heading-post.html" . }}
{{ $content | safeHTML }}
<footer class="footline">

View file

@ -5,7 +5,7 @@
<header class="headline">
{{- partial "content-header.html" . }}
</header>
{{ partial "heading-pre.html" . }}<h1 id="{{ .Title | plainify | anchorize }}">{{ .Title }}</h1>{{ partial "heading-post.html" . }}
{{ partial "heading-pre.html" . }}{{ partial "heading.html" . }}{{ partial "heading-post.html" . }}
{{ $content | safeHTML }}
<footer class="footline">

View file

@ -5,7 +5,7 @@
<header class="headline">
{{- partial "content-header.html" . }}
</header>
{{ partial "heading-pre.html" . }}<h1 id="{{ .Title | plainify | anchorize }}">{{ .Title }}</h1>{{ partial "heading-post.html" . }}
{{ partial "heading-pre.html" . }}{{ partial "heading.html" . }}{{ partial "heading-post.html" . }}
{{ $content | safeHTML }}
<footer class="footline">

View file

@ -0,0 +1 @@
{{ if not .IsHome }}<h1 id="{{ .Title | plainify | anchorize }}">{{ .Title }}</h1>{{ end }}

View file

@ -1,6 +1,6 @@
{{- if not .Title }}
{{- $title := .Site.Title }}
{{- partial "heading-pre.html" . }}<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>{{ partial "heading-post.html" . }}
<h1 id="{{ $title | plainify | anchorize }}">{{ $title }}</h1>
{{- end }}
{{- "layouts/partials/initial.md" | readFile | .RenderString }}