mirror of
https://git.sr.ht/~seirdy/seirdy.one
synced 2024-11-23 12:52:10 +00:00
Add RSS feed for notes, part 1
Add an RSS feed for notes. Next up, replacing the RSS navlink with a page containing links to both my posts and notes RSS feeds. When I get ATOM and WebSub, it'll have links ot those too. Also fixed some typos and switched "Posted" to "Noted" in the context of notes.
This commit is contained in:
parent
69a49b5dc0
commit
38c0d38fa4
6 changed files with 26 additions and 10 deletions
|
@ -2,6 +2,7 @@
|
|||
<main itemprop="mainEntity" class="h-feed hfeed" itemscope itemtype="https://schema.org/DataFeed">
|
||||
<h1 class="p-name" itemprop="name headline" id="posts">Notes</h1>
|
||||
<p>This is my microblog. These are my short informal posts, sorted by date (newest first). For longer posts, <a href="./posts.html">see my blog</a>.</p>
|
||||
<p>An <a href="./notes/index.xml">RSS feed for these notes</a> is available.</p>
|
||||
<p role="doc-tip">
|
||||
Timestamp format: <code>YYYY-MM-DD HH:MM:SS</code>, as per <cite><a href="https://www.ietf.org/rfc/rfc3339.txt">RFC 3339</a></cite>
|
||||
</p>
|
||||
|
@ -16,8 +17,8 @@
|
|||
{{ .Title }}
|
||||
</a>
|
||||
</h2>
|
||||
Posted <time itemprop="datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02 15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02 15:04:05" }}</time>
|
||||
{{- if lt .Date .Lastmod -}}
|
||||
Noted <time itemprop="datePublished" class="dt-published published" datetime="{{ .Date.Format "2006-01-02 15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02 15:04:05" }}</time>
|
||||
{{ if gt (sub .Lastmod.Unix .Date.Unix) 3600 -}}
|
||||
, 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 15:04:05" }}</time>
|
||||
{{- end }}
|
||||
<div class="e-content entry-content" itemprop="articleBody">{{ .Content }}</div>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- end -}}
|
||||
{{- $currentSection := .Section -}}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
|
@ -27,7 +28,7 @@
|
|||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{ end }}
|
||||
{{ range where .Site.Pages "Kind" "page" }}
|
||||
{{ if or (eq .Section "posts") (eq .Section "post") }}
|
||||
{{ if (eq .Section $currentSection ) }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
|
|
|
@ -9,7 +9,16 @@
|
|||
<link href="{{ .Site.Params.WebmentionEndpoint }}" rel="webmention">
|
||||
{{ $webmanifest := resources.Get "/manifest.webmanifest" | resources.ExecuteAsTemplate "manifest.webmanifest" . | resources.Minify | resources.Fingerprint "md5" -}}
|
||||
{{- printf `<link href="%s" rel="manifest">` $webmanifest.RelPermalink | safeHTML }}
|
||||
<link rel="alternate" type="application/rss+xml" href="{{ site.BaseURL }}posts/index.xml" title="{{ $.Site.Title }}">
|
||||
<!--Feeds for both notes and posts; posts come first unless we're in the notes section.-->
|
||||
{{- $isNotes := false -}}
|
||||
{{- if or (eq .Section "notes") (eq .Title "Notes") -}}
|
||||
{{- $isNotes = true -}}
|
||||
<link rel="alternate" type="application/rss+xml" href="{{ site.BaseURL }}notes/index.xml" title="Notes">
|
||||
{{- end }}
|
||||
<link rel="alternate" type="application/rss+xml" href="{{ site.BaseURL }}posts/index.xml" title="Posts">
|
||||
{{ if not $isNotes -}}
|
||||
<link rel="alternate" type="application/rss+xml" href="{{ site.BaseURL }}notes/index.xml" title="Notes">
|
||||
{{- end }}
|
||||
<title>{{ .Title }}{{ if and (lt (len .Title) 54) (ne $canonicalRelPermalink "/") }} - Seirdy{{ end }}</title>
|
||||
{{ $description := .Site.Params.Description -}}
|
||||
{{- if .Params.description -}}
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
{{ $isNote := (eq .Page.Section "notes") -}}
|
||||
{{- $canonicalRelPermalink := .RelPermalink | replaceRE "^/~seirdy/" "/" -}}
|
||||
{{- $isNotes := false -}}
|
||||
{{- $action := "Posted" -}}
|
||||
{{- $logURL := printf "%scontent/%s" .Site.Params.logUrlPrefix .File.Path -}}
|
||||
{{- if not $isNote -}}
|
||||
{{- if or (eq .Page.Section "notes") (eq .Page.Title "Notes") -}}
|
||||
{{- $isNotes = true -}}
|
||||
{{- $action = "Noted" -}}
|
||||
{{- else -}}
|
||||
{{- $logURL = $logURL | strings.ReplaceRE `\.md` `.gmi` -}}
|
||||
{{- end -}}
|
||||
Posted <time{{ if not (.Params.evergreen) }} itemprop="dateCreated datePublished" class="dt-published published"{{ end }} datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format "2006-01-02" }}</time>
|
||||
{{- $action }} <time{{ if not (.Params.evergreen) }} itemprop="dateCreated datePublished" class="dt-published published"{{ end }} 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" itemprop="mainEntityOfPage url" class="u-url url" href="{{ .Site.Params.CanonicalBaseURL }}{{ $canonicalRelPermalink }}">Website</a>{{- with .OutputFormats.Get "gemtext" -}}{{- printf " " -}}and <a rel="syndication" class="u-syndication" href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini capsule</a>{{- end -}}.
|
||||
{{ if lt .Date .Lastmod -}}
|
||||
{{ if gt (sub .Lastmod.Unix .Date.Unix) 3600 -}}
|
||||
<br>
|
||||
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="{{ $logURL }}">Changelog</a>.
|
||||
{{- end }}
|
||||
{{ if not $isNote -}}
|
||||
{{ if not $isNotes -}}
|
||||
<br>
|
||||
{{ partial "wordcount.html" . -}}
|
||||
{{ end }}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<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="./posts/index.xml">RSS feed for these posts</a> is available.</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>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<h2 id="continue-hd">Continue reading</h2>
|
||||
<ul>
|
||||
{{- with .PrevInSection }}
|
||||
<li>Previous {{ $name }} <a href="{{ .Permalink }}" rel="prev">{{ .Title }}</a></li>
|
||||
<li>Previous {{ $name }}: <a href="{{ .Permalink }}" rel="prev">{{ .Title }}</a></li>
|
||||
{{- end -}}
|
||||
{{- with .NextInSection }}
|
||||
<li>Next {{ $name }}: <a href="{{ .Permalink }}" rel="next">{{ .Title }}</a></li>
|
||||
|
|
Loading…
Reference in a new issue