trwnh.com/unified.test.hugo/layouts/_default/list.html

84 lines
3.3 KiB
HTML
Raw Normal View History

2024-10-05 06:27:07 +00:00
{{ define "body" }}
2024-10-05 19:56:14 +00:00
<body class="layout-_default-list">
<main class="h-feed hfeed" id="main">
{{ "<!-- the main header contains list metadata -->" | safeHTML }}
<header class="list-header section">
<div class="container">
<h1 class="list-title p-name">{{.Title}}</h1>
{{ with .Summary }}<p class="list-summary p-summary">{{ . }}</p>{{ end }}
{{- with (index .Site.Data.people "trwnh.com").a }}{{/* TODO: make author a variable instead of assuming it's always me */}}
<p class="list-author p-author">
{{- partial "mf2/h-card.html" . }}
</p>
{{ end -}}{{/* end with author h-card */ -}}
<div class="list-content e-content hugo-content">
{{- .Content }}
</div>
2024-10-16 07:34:56 +00:00
<a href="#items" class="skip-to-items">Skip to the feed items</a>
<p class="list-permalink">h-feed URL: <a href="{{.Permalink}}" rel="self" class="u-url">{{.Permalink}}</a></p>
2024-10-16 05:34:37 +00:00
{{- with .AlternativeOutputFormats }}
<div class="list-alt-formats">
<p>Alternate formats:</p>
<ul class="alt-formats-list">
{{- range . }}
<li class="alt-formats-list-item"><a href="{{.Permalink}}" rel="alternate">{{.Name}} ({{.MediaType}}): <span class="path">{{.RelPermalink}}</span></a></li>
{{- end }}
</ul>
</div>
2024-10-16 05:34:37 +00:00
{{- end }}
<hr>
2024-10-16 05:34:37 +00:00
</div>
</header>
{{ "<!-- list the pages in this section/taxonomy/term/etc -->" | safeHTML }}
2024-10-16 07:34:56 +00:00
<section class="list-pages section" id="items">
<div class="container">
<ol class="pages-list">
{{- range .Pages }}
{{- if .Title }}{{/* indieweb post kind is probably article */}}
<li class="pages-list__item">
<article class="h-entry hentry">
<header style="display: contents">
<span><time class="dt-published published" datetime="{{.Date.Format "2006-01-02T15:04:05Z"}}">{{.Date.Format "2006-01-02"}}</time>: <a class="u-url url" href="{{.Permalink}}"><h2 class="p-name entry-title">{{.Title}}</h2></a></span>
{{- if isset .Params "summary" }}{{/* only use explicitly-set summaries, not auto-generated ones */ -}}
<br>
<span class="p-summary entry-summary">{{.Summary}}</span>
{{- end }}{{/* end if isset .Params "summary" */ -}}
</header>
</article>
</li>
2024-10-16 05:34:37 +00:00
{{- else }}{{/* indieweb post kind is probably note */}}
{{- if eq .Content (truncate 1000 "..." .Content) }}{{/* if it's short enough, render the whole thing. */}}
<li class="pages-list__item">
<article class="h-entry hentry">
<header>
<p><span><time class="dt-published published" datetime="{{.Date.Format "2006-01-02T15:04:05Z"}}">{{.Date.Format "2006-01-02"}}</time>: <a href="{{.Permalink}}">untitled post</a></span></p>
</header>
2024-10-16 05:34:37 +00:00
<section class="e-content entry-content">
{{- .Content }} {{/* TODO: better representation? */}}
</section>
</article>
</li>
{{- else }}{{/* otherwise render a truncated summary. */}}
<li class="pages-list__item">
<article class="h-entry hentry">
<header>
<p><span><time class="dt-published published" datetime="{{.Date.Format "2006-01-02T15:04:05Z"}}">{{.Date.Format "2006-01-02"}}</time>: <a href="{{.Permalink}}">untitled post</a></span></p>
</header>
<section class="e-content entry-content">
{{- .Summary }} {{/* TODO: better representation? */}}
<p><a href="{{.Permalink}}">Read more</a></p>
</section>
</article>
</li>
2024-10-16 05:34:37 +00:00
{{- end }}
{{- end }}{{/* end if-title post type check */ -}}
{{- end }}{{/* end range over pages */ -}}
</ol>
</div>
</section>
2024-10-16 07:34:56 +00:00
<footer>
<a href="#main" class="back-to-top">Go back to the top</a>
</footer>
</main>
2024-10-05 06:27:07 +00:00
</body>
{{ end }}{{/* end define-body */ -}}