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

80 lines
No EOL
3.1 KiB
HTML

{{ define "body" }}
<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>
<p class="list-permalink">h-feed URL: <a href="{{.Permalink}}" rel="self" class="u-url">{{.Permalink}}</a></p>
{{- 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>
{{- end }}
<hr>
</div>
</header>
{{ "<!-- list the pages in this section/taxonomy/term/etc -->" | safeHTML }}
<section class="list-pages section">
<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>
{{- 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>
<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>
{{- end }}
{{- end }}{{/* end if-title post type check */ -}}
{{- end }}{{/* end range over pages */ -}}
</ol>
</div>
</section>
</main>
</body>
{{ end }}{{/* end define-body */ -}}