mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
theme: allow for page heading modification #139
This commit is contained in:
parent
96aa7af4fb
commit
59e2f19169
10 changed files with 25 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
|||
+++
|
||||
chapter = true
|
||||
pre = "<b>X. </b>"
|
||||
menuPre = "<b>X. </b>"
|
||||
title = "{{ replace .Name "-" " " | title }}"
|
||||
weight = 5
|
||||
+++
|
||||
|
|
|
@ -16,10 +16,12 @@ 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 Javacript. Don't forget to include `javascript` HTML tag directive in your file.
|
||||
- `favicon.html`: the favicon
|
||||
- `heading-pre.html`: side-wide configuration to prepend to pages title headings. If you override this, it is your responsiblity 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 responsiblity to take the page's `headingPost` setting into account.
|
||||
- `logo.html`: the logo, on top left hand corner
|
||||
- `meta.html`: HTML meta tags, if you want to change default behavior
|
||||
- `menu-pre.html`: side-wide configuration to prepend to menu items. If you override this, it is your responsiblity to take the page's `pre` setting into account.
|
||||
- `menu-post.html`: side-wide configuration to append to menu items. If you override this, it is your responsiblity to take the page's `post` setting into account.
|
||||
- `menu-pre.html`: side-wide configuration to prepend to menu items. If you override this, it is your responsiblity to take the page's `menuPre` setting into account.
|
||||
- `menu-post.html`: side-wide configuration to append to menu items. If you override this, it is your responsiblity to take the page's `menuPost` setting into account.
|
||||
- `menu-footer.html`: footer of the the left menu
|
||||
- `toc.html`: table of contents
|
||||
- `content.html`: the content page itself. This can be overridden if you wan't to display page's meta data above or below the content.
|
||||
|
|
|
@ -16,6 +16,10 @@ This document shows you what's new in the latest release. For a detailed list of
|
|||
|
||||
## 4.3.0
|
||||
|
||||
- **Change**: Renaming the frontmatter options `pre` / `post` to `menuPre` / `menuPost`. The old options will still be used if the new options aren't set. Therefore you don't need to change anything after the upgrade.
|
||||
|
||||
- **New**: Adding new partials `heading-pre.html` / `heading-post.html` and according frontmatter options `headingPre` / `headingPost` to modifiy the way your page`s main heading gets styled.
|
||||
|
||||
- **New**: The new shortcode `math` is available to add beautiful math and chemical formulae. See the [documentation]({{% relref "shortcodes/math" %}}) for available features. This feature will not work with Internet Explorer 11.
|
||||
|
||||
## 4.2.0
|
||||
|
|
|
@ -20,7 +20,7 @@ It will create a page with predefined Front-Matter:
|
|||
```toml
|
||||
+++
|
||||
chapter = true
|
||||
pre = "<b>X. </b>"
|
||||
menuPre = "<b>X. </b>"
|
||||
title = "{{ replace .Name "-" " " | title }}"
|
||||
weight = 5
|
||||
+++
|
||||
|
|
|
@ -54,7 +54,7 @@ You can define any HTML as prefix for the menu. In the example below, it's just
|
|||
```markdown
|
||||
+++
|
||||
chapter = true
|
||||
pre = "<b>1. </b>"
|
||||
menuPre = "<b>1. </b>"
|
||||
title = "Basics"
|
||||
weight = 5
|
||||
+++
|
||||
|
@ -110,10 +110,14 @@ menuTitle = ""
|
|||
alwaysopen = true
|
||||
# If set, this will explicitly override common rules for the sorting order of a page's submenu entries
|
||||
ordersectionsby = "title"
|
||||
# The title of the page heading will be prefixed by this HTML content
|
||||
headingPre = ""
|
||||
# The title of the page heading will be postfixed by this HTML content
|
||||
headingPost = ""
|
||||
# The title of the page in menu will be prefixed by this HTML content
|
||||
pre = ""
|
||||
menuPre = ""
|
||||
# The title of the page in menu will be postfixed by this HTML content
|
||||
post = ""
|
||||
menuPost = ""
|
||||
# Set the page as a chapter, changing the way it's displayed
|
||||
chapter = false
|
||||
# Hide a menu entry by setting this to true
|
||||
|
@ -127,12 +131,12 @@ LastModifierEmail = ""
|
|||
|
||||
### Add icon to a menu entry
|
||||
|
||||
In the page frontmatter, add a `pre` param to insert any HTML code before the menu label. The example below uses the GitHub icon.
|
||||
In the page frontmatter, add a `menuPre` param to insert any HTML code before the menu label. The example below uses the GitHub icon.
|
||||
|
||||
```toml
|
||||
+++
|
||||
title = "GitHub repo"
|
||||
pre = "<i class='fab fa-github'></i> "
|
||||
menuPre = "<i class='fab fa-github'></i> "
|
||||
+++
|
||||
```
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{{- with .page }}
|
||||
<article{{if .Params.chapter}} class="chapter"{{end}}>
|
||||
|
||||
{{ if and (not .IsHome ) (not .Params.chapter) }}<h1>{{ .Title }}</h1>
|
||||
{{ if and (not .IsHome ) (not .Params.chapter) }}{{- partial "heading-pre.html" . }}<h1>{{ .Title }}</h1>{{- partial "heading-post.html" . }}
|
||||
{{ end }}{{ $content | safeHTML }}
|
||||
<footer class="footline">
|
||||
{{- partial "content-footer.html" . }}
|
||||
|
|
1
layouts/partials/heading-post.html
Normal file
1
layouts/partials/heading-post.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{ .Params.headingPost | safeHTML }}
|
1
layouts/partials/heading-pre.html
Normal file
1
layouts/partials/heading-pre.html
Normal file
|
@ -0,0 +1 @@
|
|||
{{ .Params.headingPre | safeHTML }}
|
|
@ -1 +1,2 @@
|
|||
{{ .Params.Post | safeHTML }}
|
||||
{{ if .Params.menuPost }}{{ .Params.menuPost | safeHTML }}{{ else }}{{ .Params.
|
||||
Post | safeHTML }}{{ end }}
|
|
@ -1 +1 @@
|
|||
{{ .Params.Pre | safeHTML }}
|
||||
{{ if .Params.menuPre }}{{ .Params.menuPre | safeHTML }}{{ else }}{{ .Params.Pre | safeHTML }}{{ end }}
|
Loading…
Reference in a new issue