Skip to content

Commit da634d6

Browse files
committed
theme: allow to display tags below article matcornic#513
1 parent ace357e commit da634d6

File tree

17 files changed

+43
-9
lines changed

17 files changed

+43
-9
lines changed

exampleSite/content/basics/customization/_index.en.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ This theme defines the following partials :
2828
- `menu-footer.html`: footer of the the left menu
2929
- `toc.html`: table of contents
3030
- `content.html`: the content page itself. This can be overridden if you want to display page's meta data above or below the content.
31-
- `content-footer`: footer below the content, has a default implementation but you can overwrite it if you don't like it.
31+
- `content-header.html`: header above the title, has a default implementation but you can overwrite it if you don't like it.
32+
- `content-footer.html`: footer below the content, has a default implementation but you can overwrite it if you don't like it.
3233
## Change the logo
3334

3435
Create a new file in `layouts/partials/` named `logo.html`. Then write any HTML you want.

exampleSite/content/basics/migration/_index.en.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ This document shows you what's new in the latest release. For a detailed list of
2626

2727
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The new parameter `breadcrumbSeparator` is now available in your `config.toml` to change the - well - separator of the breadcrumb items. An appropriate default is in place if you do not configure anything.
2828

29+
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} To give you more flexibility in customizing your article layout a new partial `content-header.html` is introduced.
30+
31+
This came out of the requirement to customize the position of article tags, which by default is displayed above the title. A second requirement was to also show additional [taxonomies](https://gohugo.io/content-management/taxonomies/) not supported by the theme nativly. While Hugo supports tags and categories by default, the theme only displays tags.
32+
33+
So how does it work starting from the theme's default where tags are only shown above the title?
34+
35+
1. Hide tags above title: Overwrite `content-header.html` with an empty file.
36+
2. Show tags below title: Overwrite `heading-post.html` and add `{{- partial "tags.html" . }}` to it.
37+
3. Show tags below article: Overwrite `content-footer.html` and add `{{- partial "tags.html" . }}` to it.
38+
2939
---
3040

3141
## 5.13.0 (2023-05-17)

layouts/_default/taxonomy.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{{- partialCached "page-meta.hugo" . .RelPermalink }}
22
{{- partial "header.html" . }}
33
<article>
4+
<header class="headline">
5+
</header>
46
{{- $page := . }}
57

68
{{- $title := i18n .Data.Plural }}

layouts/_default/term.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{{- partialCached "page-meta.hugo" . .RelPermalink }}
22
{{- partial "header.html" . }}
33
<article>
4+
<header class="headline">
5+
</header>
46
{{- $page := . }}
57

68
{{- $title := i18n .Data.Singular }}

layouts/partials/archetypes/chapter/article.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
{{- $content := .content }}
33
{{- with $page }}
44
<article class="chapter">
5+
<header class="headline">
6+
{{- partial "content-header.html" . }}
7+
</header>
58
{{ partial "heading-pre.html" . }}<div class="article-subheading">{{ T "Chapter" .Params.Weight }}</div>
69
<h1 id="{{ .Title | anchorize }}">{{ .Title }}</h1>{{ partial "heading-post.html" . }}
710

layouts/partials/archetypes/default/article.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
{{- $content := .content }}
33
{{- with $page }}
44
<article class="default">
5+
<header class="headline">
6+
{{- partial "content-header.html" . }}
7+
</header>
58
{{ partial "heading-pre.html" . }}<h1 id="{{ .Title | anchorize }}">{{ .Title }}</h1>{{ partial "heading-post.html" . }}
69

710
{{ $content | safeHTML }}

layouts/partials/archetypes/deprecated-chapter/article.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
{{- $content := .content }}
33
{{- with $page }}
44
<article class="chapter deprecated">
5+
<header class="headline">
6+
{{- partial "content-header.html" . }}
7+
</header>
58

69
{{ $content | safeHTML }}
710
<footer class="footline">

layouts/partials/archetypes/deprecated-home/article.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
{{- $content := .content }}
33
{{- with $page }}
44
<article class="home deprecated">
5+
<header class="headline">
6+
{{- partial "content-header.html" . }}
7+
</header>
58

69
{{ $content | safeHTML }}
710
<footer class="footline">

layouts/partials/archetypes/home/article.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
{{- $content := .content }}
33
{{- with $page }}
44
<article class="home">
5+
<header class="headline">
6+
{{- partial "content-header.html" . }}
7+
</header>
58
{{ partial "heading-pre.html" . }}<h1 id="{{ .Title | anchorize }}">{{ .Title }}</h1>{{ partial "heading-post.html" . }}
69

710
{{ $content | safeHTML }}

layouts/partials/body.searchpage.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{{- $title := T "Search" }}
22
<article class="default">
3+
<header class="headline">
4+
</header>
35
<h1 id="{{ $title | anchorize }}">{{ $title }}</h1>
46

57
<form action="javascript:triggerSearch()">
@@ -22,6 +24,5 @@ <h1 id="{{ $title | anchorize }}">{{ $title }}</h1>
2224
</div>
2325

2426
<footer class="footline">
25-
{{- partial "content-footer.html" . }}
2627
</footer>
2728
</article>

0 commit comments

Comments
 (0)