refactor categories+tags section into a dedicated partial, add jump links for menu and metadata to the footer ; update 'back to tpo' jump links to jump to the toc instead of the very top of the page to save screen readers having to skip forward after jumping back
This commit is contained in:
parent
34f9d69660
commit
10bc92116f
10
themes/hugo-xmin/layouts/partials/categories_tags.html
Normal file
10
themes/hugo-xmin/layouts/partials/categories_tags.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<a id="categories_tags" />
|
||||||
|
|
||||||
|
<p class="terms">
|
||||||
|
{{ range $i := (slice "categories" "tags") }}
|
||||||
|
{{ with ($.Param $i) }}
|
||||||
|
{{ $i | title }}: {{ range $k := . }}<a href="{{ relURL (print "/" $i "/" $k | urlize) }}">{{$k}}</a> {{ end }}
|
||||||
|
{{ end }}
|
||||||
|
<br />
|
||||||
|
{{ end }}
|
||||||
|
</p>
|
|
@ -3,6 +3,8 @@
|
||||||
{{ with .Site.Params.footer }}
|
{{ with .Site.Params.footer }}
|
||||||
<hr/>
|
<hr/>
|
||||||
<a class="back_to_top" href="#top">Back to top</a>
|
<a class="back_to_top" href="#top">Back to top</a>
|
||||||
|
| <a class="back_to_top" href="#categories_tags">Back to categories and tags</a>
|
||||||
|
| <a class="back_to_top" href="#nav_menu">Back to menu</a>
|
||||||
<br />{{ replace . "{Year}" now.Year | markdownify}}
|
<br />{{ replace . "{Year}" now.Year | markdownify}}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .GitInfo}}
|
{{ if .GitInfo}}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav id="nav_menu">
|
||||||
<ul class="menu">
|
<ul class="menu">
|
||||||
{{ range .Site.Menus.main }}
|
{{ range .Site.Menus.main }}
|
||||||
<li><a href="{{ .URL | relURL }}">{{ .Name }}</a></li>
|
<li><a href="{{ .URL | relURL }}">{{ .Name }}</a></li>
|
||||||
|
|
|
@ -12,23 +12,25 @@
|
||||||
|
|
||||||
{{ if (gt .Date 0) }}<h4 class="date">Published: {{ .Date.Format "2006/01/02" }}</h4>{{ end }}
|
{{ if (gt .Date 0) }}<h4 class="date">Published: {{ .Date.Format "2006/01/02" }}</h4>{{ end }}
|
||||||
{{ if (gt .Lastmod 0) }}<h4 class="date">Last Modified: {{ .Lastmod.Format "2006/01/02" }}</h4>{{ end }}
|
{{ if (gt .Lastmod 0) }}<h4 class="date">Last Modified: {{ .Lastmod.Format "2006/01/02" }}</h4>{{ end }}
|
||||||
<p class="terms">
|
|
||||||
{{ range $i := (slice "categories" "tags") }}
|
|
||||||
{{ with ($.Param $i) }}
|
|
||||||
{{ $i | title }}: {{ range $k := . }}<a href="{{ relURL (print "/" $i "/" $k | urlize) }}">{{$k}}</a> {{ end }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
</p>
|
|
||||||
<p class="terms">
|
|
||||||
{{ partial "related.html" . }}
|
|
||||||
</p>
|
|
||||||
<p>
|
<p>
|
||||||
{{ if (gt .ReadingTime 0) }}<small>Reading Time: {{ .ReadingTime }} minutes</small>{{ end }}
|
{{ if (gt .ReadingTime 0) }}<small>Reading Time: {{ .ReadingTime }} minutes</small>{{ end }}
|
||||||
|
|
|
|
||||||
{{ if (gt .WordCount 0) }}<small>Word Count: {{ .WordCount }} words</small>{{ end }}
|
{{ if (gt .WordCount 0) }}<small>Word Count: {{ .WordCount }} words</small>{{ end }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<p class="terms">
|
||||||
|
{{ partial "categories_tags.html" . }}
|
||||||
|
</p>
|
||||||
|
<p class="terms">
|
||||||
|
{{ partial "related.html" . }}
|
||||||
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<a id="top" />
|
||||||
|
|
||||||
{{ if .Params.toc }}
|
{{ if .Params.toc }}
|
||||||
{{ .TableOfContents }}
|
{{ .TableOfContents }}
|
||||||
|
{{ else }}
|
||||||
{{ end }}
|
{{ end }}
|
|
@ -1,3 +1,5 @@
|
||||||
|
<a id="related" />
|
||||||
|
|
||||||
{{ range first 1 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
|
{{ range first 1 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
|
||||||
{{ $.Scratch.Set "has_related" true }}
|
{{ $.Scratch.Set "has_related" true }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in a new issue