mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-31 08:57:15 +00:00
Merge pull request #90 from mreithub/master
Added a `menuTitle` attribute to partials/menu.html
This commit is contained in:
commit
0eea21590b
2 changed files with 20 additions and 2 deletions
|
@ -98,6 +98,8 @@ Each Hugo page has to define a [Front Matter](https://gohugo.io/content/front-ma
|
||||||
# Table of content (toc) is enabled by default. Set this parameter to true to disable it.
|
# Table of content (toc) is enabled by default. Set this parameter to true to disable it.
|
||||||
# Note: Toc is always disabled for chapter pages
|
# Note: Toc is always disabled for chapter pages
|
||||||
disableToc = "false"
|
disableToc = "false"
|
||||||
|
# If set, this will be used for the page's menu entry (instead of the `title` attribute)
|
||||||
|
menuTitle = ""
|
||||||
# The title of the page in menu will be prefixed by this HTML content
|
# The title of the page in menu will be prefixed by this HTML content
|
||||||
pre = ""
|
pre = ""
|
||||||
# The title of the page in menu will be postfixed by this HTML content
|
# The title of the page in menu will be postfixed by this HTML content
|
||||||
|
@ -139,6 +141,22 @@ weight = 5
|
||||||
+++
|
+++
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Using a custom title for menu entries
|
||||||
|
|
||||||
|
By default, **Hugo-theme-learn** will use a page's `title` attribute for the menu item (or `linkTitle` if defined).
|
||||||
|
|
||||||
|
But a page's title has to be descriptive on its own while the menu is a hierarchy.
|
||||||
|
We've added the `menuTitle` parameter for that purpose:
|
||||||
|
|
||||||
|
For example (for a page named `content/install/linux.md`):
|
||||||
|
|
||||||
|
```toml
|
||||||
|
+++
|
||||||
|
title = "Install on Linux"
|
||||||
|
menuTitle = "Linux"
|
||||||
|
+++
|
||||||
|
```
|
||||||
|
|
||||||
## Homepage
|
## Homepage
|
||||||
|
|
||||||
To configure your home page, you basically have three choices:
|
To configure your home page, you basically have three choices:
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
{{if .Params.alwaysopen}}parent{{end}}
|
{{if .Params.alwaysopen}}parent{{end}}
|
||||||
">
|
">
|
||||||
<a href="{{.RelPermalink}}">
|
<a href="{{.RelPermalink}}">
|
||||||
{{safeHTML .Params.Pre}}{{.Title}}{{safeHTML .Params.Post}}
|
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
|
||||||
{{ if $showvisitedlinks}}
|
{{ if $showvisitedlinks}}
|
||||||
<i class="fa fa-check read-icon"></i>
|
<i class="fa fa-check read-icon"></i>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
{{ if not .Params.Hidden }}
|
{{ if not .Params.Hidden }}
|
||||||
<li data-nav-id="{{.URL}}" title="{{.Title}}" class="dd-item {{if eq .UniqueID $currentNode.UniqueID}}active{{end}}">
|
<li data-nav-id="{{.URL}}" title="{{.Title}}" class="dd-item {{if eq .UniqueID $currentNode.UniqueID}}active{{end}}">
|
||||||
<a href="{{ .RelPermalink}}">
|
<a href="{{ .RelPermalink}}">
|
||||||
{{safeHTML .Params.Pre}}{{.Title}}{{safeHTML .Params.Post}}
|
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
|
||||||
{{ if $showvisitedlinks}}<i class="fa fa-check read-icon"></i>{{end}}
|
{{ if $showvisitedlinks}}<i class="fa fa-check read-icon"></i>{{end}}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Add table
Reference in a new issue