1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-09-19 20:02:10 +00:00

Add u-syndication, clean up interactions

Add a new "Interactions" section to my pages that contain both
Syndication and Webmentions. Make the Syndication links u-syndication.

Make both these things children of the <article> h-entry.
This commit is contained in:
Rohan Kumar 2022-11-20 13:26:57 -08:00
parent 5037e399d1
commit 36c049d0ef
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
8 changed files with 137 additions and 106 deletions

View file

@ -6,7 +6,15 @@ replyTitle: "Maintaining a blog is probably the best method I have found to hono
replyType: "SocialMediaPosting"
replyAuthor: "Adrian Rosell"
replyAuthorURI: "https://adrianroselli.com/"
syndicatedCopies:
- title: 'The Fediverse'
url: 'https://pleroma.envs.net/notice/APnxPeFcKz4HvBrckS'
- title: 'IndieNews'
url: 'https://news.indieweb.org/en'
- title: 'IndieForums'
url: 'https://www.indieforums.net'
---
The "Don't Repeat Yourself" (<abbr>DRY</abbr>) principle is my main motivation for adding content to my site---especially to [my "notes" section]({{<relref "/notes">}}). I've gone as far as linking my own website in online class discussions (not as a citation; just for <abbr>DRY</abbr>).
This also combines really well with the [Publish on your Own Site, Syndicate Elsewhere](https://indieweb.org/POSSE) (<abbr>POSSE</abbr>) principle. Often, a post of mine syndicates well to multiple destinations. I might reply to a forum on my site and syndicate it to both that forum and to the Fediverse. People reply in both places, and Webmentions aggregate them together on my site (though I often have to send myself those mentions). I only have to write something once.

View file

@ -2,7 +2,9 @@
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
<main
itemprop="mainEntity" itemscope="" itemtype="https://schema.org/Article" itemid="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">
<article class="h-entry hentry">
{{ partial "full-article.html" . }}
{{ partial "webmentions.html" . }}
{{ partial "interact.html" . }}
</article>
</main>
{{ end }}

View file

@ -2,9 +2,11 @@
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
<main
itemprop="hasPart" itemscope="" itemtype="https://schema.org/SocialMediaPosting" itemid="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">
<link itemprop="isPartOf" href="{{ .Site.Params.CanonicalBaseURL }}/" />
<link itemprop="isPartOf" href="{{ .Site.Params.CanonicalBaseURL }}/" />
<article class="h-entry hentry">
{{ partial "full-article.html" . }}
{{ partial "webmentions.html" . }}
{{ partial "interact.html" . }}
</article>
</main>
{{ partial "prev-next.html" . -}}
{{- end }}

View file

@ -1,4 +1,3 @@
<article class="h-entry hentry"><!--Once WAI-ARIA 1.3 gains traction, I'll add aria-details for webmentions.-->
<header>
<h1 itemprop="name headline" class="p-name entry-title" id="h1" tabindex="-1">{{ .Title }}</h1>
{{- if not .Params.disableMeta -}}
@ -14,4 +13,3 @@
{{- end -}}
{{- partial "processed-content" . -}}
</div>
</article>

View file

@ -0,0 +1,7 @@
<hr />
<footer aria-labelledby="interact">
<h2 id="interact" tabindex="-1">Interact</h2>
<p>You can interact by <a href="#webmentions">sending webmentions</a> or by visiting a syndicated copy of this post.</p>
{{- partial "syndication.html" . -}}
{{- partial "webmentions.html" . -}}
</footer>

View file

@ -0,0 +1,15 @@
{{ with .Params.syndicatedCopies }}
<h3>Syndication</h3>
<p>This post has been syndicated to:</p>
<ul>
{{- range . -}}
{{- $type := "SocialMediaPosting" -}}
{{- with ".type" -}}
{{- $type = . -}}
{{- end }}
<li>
<a itemprop="discussionUrl" class="u-syndication" rel="syndication" href="{{ .url }}">{{ .title }}</a>
</li>
{{- end -}}
</ul>
{{- end -}}

View file

@ -4,22 +4,20 @@
{{- range $i, $r := (getCSV "," "/csv/rewrites.csv") -}}
{{- $rewritesDict = merge $rewritesDict (dict (index $r 0) (index $r 1)) -}}
{{- end -}}
<hr />
<section aria-labelledby="webmentions" data-nosnippet=""><!--data-nosnippet means this content shouldn't be used for url summaries in search engines.-->
<h2 id="webmentions" tabindex="-1">Web&#173;mentions</h2>
<p>This site supports <a href="https://indieweb.org/webmention">Webmentions</a>, a backlink-based alternative to traditional comment forms.</p>
{{ partial "webmention-form.html" . }}
{{- $target := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
{{ $url1 := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $target -}}
{{ $webmentions := (getJSON $url1) -}}
{{- if lt .Date.Unix 1653616670 -}}{{- /* commit c84c8d4 changed my URL schemes, so fetch menchies for the legacy scheme on old posts. */ -}}
<h3 id="webmentions" tabindex="-1">Web&#173;mentions</h3>
<p>This site supports <a href="https://indieweb.org/webmention">Webmentions</a>, a backlink-based alternative to traditional comment forms.</p>
{{ partial "webmention-form.html" . }}
{{- $target := .RelPermalink | replaceRE "^/~seirdy/" "/" }}
{{ $url1 := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $target -}}
{{ $webmentions := (getJSON $url1) -}}
{{- if lt .Date.Unix 1653616670 -}}{{- /* commit c84c8d4 changed my URL schemes, so fetch menchies for the legacy scheme on old posts. */ -}}
{{- $oldTarget := $target | replaceRE "/posts" "" | replaceRE "/$" ".html" -}}
{{- $url2 := printf "https://seirdy.one/webmentions/get?status=approved&target=https://seirdy.one%s" $oldTarget -}}
{{- $webmentions = $webmentions | append (getJSON $url2) -}}
{{- end -}}
{{- if gt (len $webmentions) 0 -}}
<p>Webmentions received for this post appear in the following list after I approve them. I sometimes send Webmentions to myself on behalf of linking sites that dont support them. I auto-replace broken links with <a href="https://web.archive.org/">Wayback Machine</a> snapshots, if they exist.</p>
<details>
{{- end -}}
{{- if gt (len $webmentions) 0 -}}
<p>Webmentions received for this post appear in the following list after I approve them. I sometimes send Webmentions to myself on behalf of linking sites that dont support them. I auto-replace broken links with <a href="https://web.archive.org/">Wayback Machine</a> snapshots, if they exist.</p>
<details>
<summary>Toggle Webmentions</summary>
<dl>
{{ range sort $webmentions "created_at" -}}
@ -98,9 +96,8 @@
</div>
{{- end -}}
</dl>
</details>
{{ else -}}
<p>This post does not have any approved Webmentions yet.</p>
{{- end }}
<p>Feel free to contact me directly with feedback; <a href="{{ .Site.BaseURL }}about/#location-seirdy-online">heres my contact info</a></p>
</section>
</details>
{{ else -}}
<p>This post does not have any approved Webmentions yet.</p>
{{- end }}
<p>Feel free to contact me directly with feedback; <a href="{{ .Site.BaseURL }}about/#location-seirdy-online">heres my contact info</a></p>

View file

@ -3,9 +3,11 @@
{{- .Scratch.Set "codeIndex" 1 -}}
<main
itemprop="mainEntity" itemscope="" itemtype="https://schema.org/BlogPosting{{ with .Params.articleType }} https://schema.org/{{ . }}{{ end }}" itemid="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">
<link itemprop="isPartOf" href="{{ .Site.Params.CanonicalBaseURL }}/" />
<link itemprop="isPartOf" href="{{ .Site.Params.CanonicalBaseURL }}/" />
<article class="h-entry hentry">
{{ partial "full-article.html" . }}
{{ partial "webmentions.html" . }}
{{ partial "interact.html" . }}
</article>
</main>
{{ partial "prev-next.html" . -}}
{{- end }}