1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-10 00:12:09 +00:00
seirdy.one/layouts/partials/posts.html
Rohan Kumar 1aed7a66d4
Switch to XHTML5 markup
The site now has polygot markup and can handle both XHTML5 and HTML5
parsing rules. My staging site will be XHTML but my main site will be
HTML5, just in case of parse errors.

If other tools (e.g. LightHouse) end up supporting XHTML5, I'll consider
switching the content-type to XHTML.
2022-05-30 17:39:45 -07:00

57 lines
2.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{- $isStandalone := false -}}
{{- if and (ne .Permalink .Site.BaseURL) (ne .RelPermalink "/") -}}
{{- $isStandalone = true -}}
{{- end -}}
{{- if $isStandalone -}}
<main itemprop="mainEntity" class="h-feed hfeed" itemscope="" itemtype="https://schema.org/CompleteDataFeed">
<h1 class="p-name" itemprop="name headline" id="posts">Posts</h1>
<p>These are all of my posts, sorted by date (newest first).</p>
<p>An <a href="./atom.xml">Atom</a> and <a href="./index.xml">RSS</a> feed is availabe, containing the full text of all my posts.</p>
{{- else -}}
<section class="h-feed hfeed" itemprop="hasPart" itemscope="" itemtype="https://schema.org/DataFeed">
<h2 class="p-name" itemprop="name" id="posts">Posts</h2>
<p>Heres a selection of my best posts, in featured order. To see the rest, visit <a href="posts/">my Posts page</a>.</p>
{{- end }}
<p>I edit some of these posts quite often; some are updated indefinitely. Check the “updated” timestamps.</p>
<p role="doc-tip">
Timestamp format: <code>YYYY-MM-DD</code>, as per <cite><a href="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a></cite> and <cite><a href="https://xkcd.com/1179/">ISO 8601</a></cite>
</p>
<ol>
{{- $posts := (where site.RegularPages "Section" "posts") -}}
{{- if not $isStandalone -}}
{{- $posts = sort (where $posts "Params.featured" ">" 0) "Params.featured" -}}
{{- end -}}
{{- range $posts -}}
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" -}}
<li itemprop="dataFeedElement" itemscope="" itemtype="https://schema.org/DataFeedItem">
<article class="h-entry hentry" itemprop="item" itemscope="" itemtype="https://schema.org/BlogPosting" itemid="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">
{{ if $isStandalone -}}
<h2
{{- else -}}
<h3
{{- end }}
itemprop="name headline" class="p-name entry-title">
<a href="{{ .Permalink }}" itemprop="url" class="u-url url" rel="bookmark">
{{ .Title }}
</a>
{{ if $isStandalone -}}
</h2>
{{- else -}}
</h3>
{{- end }}
Posted <time itemprop="datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02 15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
{{- if lt .Date .Lastmod -}}
, updated <time{{ if not (.Params.evergreen) }} itemprop="dateModified" class="dt-updated updated"{{ end }} datetime="{{ .Lastmod.Format "2006-01-02 15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>
{{- end }}
<p class="p-summary entry-summary" itemprop="description">{{ .Description }}</p>
<p>{{- partial "wordcount.html" . -}}</p>
</article>
</li>
{{- end }}
</ol>
{{ if $isStandalone -}}
</main>
{{ else -}}
</section>
{{ end }}