Skip to content

Commit

Permalink
theme: make heading a template #744
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed Dec 2, 2023
1 parent 76782d0 commit ac985ee
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions exampleSite/content/basics/customization/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions exampleSite/content/basics/migration/_index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/archetypes/chapter/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/archetypes/default/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/archetypes/home/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
1 change: 1 addition & 0 deletions layouts/partials/heading.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ if not .IsHome }}<h1 id="{{ .Title | plainify | anchorize }}">{{ .Title }}</h1>{{ end }}
2 changes: 1 addition & 1 deletion layouts/partials/initial.html
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit ac985ee

Please sign in to comment.