mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-10 00:12:09 +00:00
Fix some metadata
- Use mainEntity correctly - Support legacy microformats for date updated - Formatting
This commit is contained in:
parent
f0623a7185
commit
d4951890a5
2 changed files with 43 additions and 14 deletions
|
@ -1,23 +1,24 @@
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
|
<div itemprop="blogPost mainEntity" itemscope itemtype="https://schema.org/BlogPosting">
|
||||||
<article itemprop="mainEntityOfPage" class="h-entry hentry">
|
<article class="h-entry hentry">
|
||||||
<header id="post-header">
|
<header id="post-header">
|
||||||
<h1 itemprop="name headline" class="p-name entry-title">{{ .Title }}</h1>
|
<h1 itemprop="name headline" class="p-name entry-title">{{ .Title }}</h1>
|
||||||
{{ if lt .Date .Lastmod -}}
|
<span class="dateline">
|
||||||
Posted <time class="dt-published published" itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time> by {{- partial "indieweb-author.html" -}} on his <a rel="canonical" class="u-url url" href="https://seirdy.one{{ .RelPermalink }}">Website</a>
|
Posted <time itemprop="datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
|
||||||
|
</span>
|
||||||
|
<span class="byline">
|
||||||
|
by {{- partial "indieweb-author.html" -}}</span> on his <a rel="canonical" itemprop="mainEntityOfPage" class="u-url url" href="https://seirdy.one{{ .RelPermalink }}">Website</a>
|
||||||
{{ with .OutputFormats.Get "gemtext" -}}
|
{{ with .OutputFormats.Get "gemtext" -}}
|
||||||
and <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini capsule</a>
|
and <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini capsule</a>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{ if lt .Date .Lastmod -}}
|
||||||
<br>
|
<br>
|
||||||
Last updated <time itemprop="dateModified" class="dt-updated" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }}">Changelog</a>
|
Last updated <time itemprop="dateModified" class="dt-updated updated" datetime="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Lastmod.Format "2006-01-02" }}</time>. <a href="{{ .Site.Params.logUrlPrefix }}content/{{ .File.Path }}">Changelog</a>
|
||||||
{{ else -}}
|
|
||||||
Posted <time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time> by {{- partial "indieweb-author.html" -}} on his <a rel="canonical" class="u-url url" href="https://seirdy.one{{ .RelPermalink }}">Website</a>
|
|
||||||
{{- with .OutputFormats.Get "gemtext" -}}
|
|
||||||
and <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini capsule</a>
|
|
||||||
{{- end -}}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<br>
|
<br>
|
||||||
<small><span itemprop="wordCount">{{ .WordCount }}</span> words, a <span itemprop="timeRequired" content="PT{{ .ReadingTime }}M">{{ .ReadingTime }} minute</span> read</small>
|
<small>
|
||||||
|
<span itemprop="wordCount">{{ .WordCount }}</span> words, a <span itemprop="timeRequired" content="PT{{ .ReadingTime }}M">{{ .ReadingTime }} minute</span> read
|
||||||
|
</small>
|
||||||
</header>
|
</header>
|
||||||
<section class="e-content entry-content" itemprop="articlebody">
|
<section class="e-content entry-content" itemprop="articlebody">
|
||||||
{{ partial "processed-content" . -}}
|
{{ partial "processed-content" . -}}
|
||||||
|
|
|
@ -1,4 +1,32 @@
|
||||||
<!-- re-using the indefinetly-cached favicon to avoid bloating page size -->
|
<!-- re-using the favicon for the author photo -->
|
||||||
{{ $favicon := resources.Get "/favicon.png" -}}
|
{{- $favicon := resources.Get "/favicon.png" -}}
|
||||||
{{- $favicon_base64 := $favicon.Content | base64Encode -}}
|
{{- $favicon_base64 := $favicon.Content | base64Encode -}}
|
||||||
<span itemprop="author" itemscope itemtype="https://schema.org/Person" class="h-card p-author author vcard"><a itemprop="url" href="https://seirdy.one" rel="author home" class="u-url url"><img itemprop="image" class="u-photo photo" src="data:image/png;base64,{{ $favicon_base64 }}" width="16" height="16" alt="Rohan Kumar"> <span itemprop="name" class="p-name fn n"><span itemprop="givenName" class="p-given-name given-name">Rohan</span> <span itemprop="familyName" class="p-family-name family-name">Kumar</span></span></a></span>
|
<!--
|
||||||
|
Reader mode implementations use .p-author, itemprop=author, and/or .author to add
|
||||||
|
a byline. Some also strip elements matching the "byline" class to avoid duplicating
|
||||||
|
the byline. Mozilla Readability uses both microformats1 and microformats2 while
|
||||||
|
Chromium Distiller uses microdata + schema.org. This site also needs to be Indieweb
|
||||||
|
compatible for webmentions and such. To support them all, I ended up with
|
||||||
|
microdata, microformats2, microformats1, and the "byline" class.
|
||||||
|
|
||||||
|
I put the byline class around the html that includes this partial so it can hide
|
||||||
|
the whole line.
|
||||||
|
|
||||||
|
Jesus christ.
|
||||||
|
|
||||||
|
Abominations like this also appear elsewhere in the blog btw. This is just the best
|
||||||
|
example. Oh, and then i need to support some parts of hNews as well as hentry *and*
|
||||||
|
h-entry.
|
||||||
|
|
||||||
|
This would be so much simpler if all the parsers just had a mode to detect
|
||||||
|
schema.org and a mode to detect microformats2, and then stuck to those standards.
|
||||||
|
|
||||||
|
(btw this is all made of <span> cuz it is supposed to be inline)
|
||||||
|
-->
|
||||||
|
<span itemprop="author" itemscope itemtype="https://schema.org/Person" class="h-card p-author author vcard">
|
||||||
|
<a itemprop="url" href="https://seirdy.one" rel="author home" class="u-url url">
|
||||||
|
<img itemprop="image" class="u-photo photo" src="data:image/png;base64,{{ $favicon_base64 }}" alt="" width="16" height="16">
|
||||||
|
<span itemprop="name" class="p-name fn n">
|
||||||
|
<span itemprop="givenName" class="p-given-name given-name">Rohan</span>
|
||||||
|
<span itemprop="familyName" class="p-family-name family-name">Kumar</span></span></a>
|
||||||
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue