Implement LinkTitle in menus, making it easy to set in frontmatter.

This commit is contained in:
Fredrik Jonsson 2024-02-25 15:37:26 +01:00
commit 608936b748
4 changed files with 9 additions and 9 deletions

View file

@ -31,9 +31,9 @@ figcaption {
// Apply heading font stack and colour to labels etc. // Apply heading font stack and colour to labels etc.
th, th,
nav,
label, label,
legend, legend,
.main-menu,
.header, .header,
.footer { .footer {
color: var(--color-headings); color: var(--color-headings);

View file

@ -14,10 +14,10 @@
{{ with .File }}{{ $currentID = .UniqueID }}{{ end -}} {{ with .File }}{{ $currentID = .UniqueID }}{{ end -}}
{{ with site.Home }}<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} aria-current="page"{{ end }}>{{ i18n "menu_home" }}</a></li>{{ end }} {{ with site.Home }}<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} aria-current="page"{{ end }}>{{ i18n "menu_home" }}</a></li>{{ end }}
{{ range where site.RegularPages "Section" "" -}} {{ range where site.RegularPages "Section" "" -}}
<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} aria-current="page"{{ end }}>{{ .Title }}</a></li> <li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} aria-current="page"{{ end }}>{{ .LinkTitle }}</a></li>
{{ end -}} {{ end -}}
{{ range site.Sections -}} {{ range site.Sections -}}
<li><a href="{{ .RelPermalink }}"{{ if eq $currentSection .Section }} aria-current="page"{{ end }}>{{ .Title }}</a></li> <li><a href="{{ .RelPermalink }}"{{ if eq $currentSection .Section }} aria-current="page"{{ end }}>{{ .LinkTitle }}</a></li>
{{ end -}} {{ end -}}
{{ end -}} {{ end -}}

View file

@ -26,10 +26,10 @@
{{ with .File }}{{ $currentID = .UniqueID }}{{ end -}} {{ with .File }}{{ $currentID = .UniqueID }}{{ end -}}
{{ with site.Home }}<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} aria-current="page"{{ end }}>{{ i18n "menu_home" }}</a></li>{{ end }} {{ with site.Home }}<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} aria-current="page"{{ end }}>{{ i18n "menu_home" }}</a></li>{{ end }}
{{ range where site.RegularPages "Section" "" -}} {{ range where site.RegularPages "Section" "" -}}
<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} aria-current="page"{{ end }}>{{ .Title }}</a></li> <li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} aria-current="page"{{ end }}>{{ .LinkTitle }}</a></li>
{{ end -}} {{ end -}}
{{ range site.Sections -}} {{ range site.Sections -}}
<li><a href="{{ .RelPermalink }}"{{ if eq $currentSection .Section }} aria-current="page"{{ end }}>{{ .Title }}</a></li> <li><a href="{{ .RelPermalink }}"{{ if eq $currentSection .Section }} aria-current="page"{{ end }}>{{ .LinkTitle }}</a></li>
{{ end -}} {{ end -}}
{{ end -}} {{ end -}}

View file

@ -3,13 +3,13 @@
{{ with .File }}{{ $currentID = .UniqueID }}{{ end -}} {{ with .File }}{{ $currentID = .UniqueID }}{{ end -}}
<aside class="sidebar layout__second-sidebar"> <aside class="sidebar layout__second-sidebar">
{{ range site.Sections -}} {{ range site.Sections -}}
<section class="menu"> <nav class="menu">
<p class="title"><strong><a href="{{ .RelPermalink }}"{{ if eq $currentSection .Section }} aria-current="page"{{ end }}>{{ .Title }}</a></strong></p> <p class="title"><strong><a href="{{ .RelPermalink }}"{{ if eq $currentSection .Section }} aria-current="page"{{ end }}>{{ .LinkTitle }}</a></strong></p>
<ul> <ul>
{{ range .Pages -}} {{ range .Pages -}}
<li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} aria-current="page"{{ end }}>{{ .Title }}</a></li> <li><a href="{{ .RelPermalink }}"{{ if eq $currentID .File.UniqueID }} aria-current="page"{{ end }}>{{ .LinkTitle }}</a></li>
{{ end -}} {{ end -}}
</ul> </ul>
</section> </nav>
{{ end -}} {{ end -}}
</aside> </aside>