Open seamusharris opened 5 years ago
https://github.com/brycewray/hugo_site/blob/main/layouts/sitemap/single.html
{{ define "main" }}
<div class="container-narrower sitemapDiv">
<h1>Sitemap</h1>
<div class="post-line"></div>
<h2>Main pages</h2>
<ul>
<li><a href="{{ .Site.BaseURL }}">Home page</a></li>
<li><a href="{{ .Site.BaseURL }}about/">About me</li>
<li><a href="{{ .Site.BaseURL }}privacy/">Site’s privacy policy</a></li>
<li><a href="{{ .Site.BaseURL }}contact/">How to contact me</a></li>
</ul>
<h2>Posts</h2>
<ul>
<li><a href="/posts"><strong>Complete list</strong></a> <em>(first page of paginated list; five posts per page)</em></li>
{{- range where .Site.Pages.ByPublishDate.Reverse ".Type" "posts" -}}
{{- if (ne .Title "Posts") -}}
<li><strong><a href="{{ .Permalink }}">{{ .Title | .Page.RenderString }}</a></strong> • {{ .PublishDate.Format "January 2, 2006" }}<br />
<em class="description">{{ .Description | .Page.RenderString }}</em></li>
{{- end -}}
{{- end -}}
</ul>
</div>
{{ end }}
Currently linked from footer to /sitemap.hml.
Hugo automatically creates an XML sitemaps but we should also have an HTML one for users to browse. Particularly useful until we implement search.