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

Atom feed: use different <logo>, formatting

The spec recommends that the <logo> element is twice as wide as tall:
https://validator.w3.org/feed/docs/atom.html#optionalFeedElements

Add yet another site icon that fits that recommendation. Tidy up the
feed in the meantime.
This commit is contained in:
Rohan Kumar 2022-08-01 21:28:32 -07:00
parent 7716ffb06c
commit 385ea60c55
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 26 additions and 31 deletions

1
assets/atom.svg Normal file
View file

@ -0,0 +1 @@
<svg height="72" width="144" viewBox="0 0 144 72" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h144v72H0z"/><path d="M60.51 50.71c-.72 0-1.42-.11-2.1-.33-.69-.21-1.28-.57-1.78-1.07-.51-.51-.87-1.1-1.08-1.78-.22-.69-.33-1.39-.33-2.11s.11-1.42.33-2.1c.21-.69.57-1.28 1.08-1.78.5-.51 1.09-.87 1.78-1.08.68-.22 1.38-.32 2.1-.32s1.42.1 2.1.32c.69.21 1.28.57 1.78 1.08.51.5.87 1.09 1.08 1.78.22.68.33 1.38.33 2.1s-.11 1.42-.33 2.11c-.21.68-.57 1.27-1.08 1.78-.5.5-1.09.86-1.78 1.07-.68.22-1.38.33-2.1.33zm0-18.88c-.72 0-1.42-.11-2.1-.33-.69-.21-1.28-.57-1.78-1.07-.51-.51-.87-1.1-1.08-1.78-.22-.69-.33-1.39-.33-2.11s.11-1.42.33-2.1c.21-.68.57-1.28 1.08-1.78.5-.51 1.09-.86 1.78-1.08.68-.22 1.38-.32 2.1-.32s1.42.1 2.1.32c.69.22 1.28.57 1.78 1.08.51.5.87 1.1 1.08 1.78.22.68.33 1.38.33 2.1s-.11 1.42-.33 2.11c-.21.68-.57 1.27-1.08 1.78-.5.5-1.09.86-1.78 1.07-.68.22-1.38.33-2.1.33zm21.52 29.5-4.01-3.12c2.12-2.52 3.64-5.04 4.53-7.56-.82-.1-1.59-.4-2.29-.89-.7-.48-1.2-1.12-1.51-1.91-.3-.79-.46-1.6-.46-2.43 0-.72.11-1.42.33-2.1.21-.69.57-1.28 1.08-1.78.5-.51 1.09-.87 1.78-1.08.68-.22 1.38-.32 2.1-.32s1.42.1 2.1.32c.69.21 1.28.57 1.78 1.08.51.5.87 1.09 1.08 1.78.22.68.33 1.38.33 2.1v.27c-.08 5.22-2.32 10.43-6.75 15.64zm1.46-29.5c-.72 0-1.42-.11-2.1-.33-.69-.21-1.28-.57-1.78-1.07-.51-.51-.87-1.1-1.08-1.78-.22-.69-.33-1.39-.33-2.11s.11-1.42.33-2.1c.21-.68.57-1.28 1.08-1.78.5-.51 1.09-.86 1.78-1.08.68-.22 1.38-.32 2.1-.32s1.42.1 2.1.32c.69.22 1.28.57 1.78 1.08.51.5.87 1.1 1.08 1.78.22.68.33 1.38.33 2.1s-.11 1.42-.33 2.11c-.21.68-.57 1.27-1.08 1.78-.5.5-1.09.86-1.78 1.07-.68.22-1.38.33-2.1.33z" fill="#fff"/></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -1,16 +1,16 @@
{{- $pages := (where site.RegularPages "Section" .Section) -}}
{{- $period := "daily" -}}
{{- $title := .Section | humanize -}}
{{- if .IsHome }}
{{- if .IsHome -}}
{{- $title = "All content" -}}
{{- $pages = where .Site.RegularPages "Date" "!=" (time "0001-01-01") -}}
{{- $period = "hourly" -}}
{{ end -}}
{{- end -}}
{{- if eq .Section "notes" -}}
{{- $period = "hourly" -}}
{{- end -}}
{{- $icon_svg := resources.Get "/favicon.svg" | resources.Fingerprint "md5" -}}
{{- $icon_png := resources.Get "/favicon192.png" | resources.Fingerprint "md5" -}}
{{- $icon := resources.Get "/favicon.svg" | resources.Fingerprint "md5" -}}
{{- $logo := resources.Get "/atom.svg" | resources.Fingerprint "md5" -}}
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed
xmlns="http://www.w3.org/2005/Atom"
@ -22,9 +22,6 @@
xmlns:thr="http://purl.org/syndication/thread/1.0"
xml:lang="{{ .Site.LanguageCode }}">
<title>{{ $title }} on {{ .Site.Title }}</title>
<link rel="self" type="application/atom+xml" href="{{ .Permalink }}atom.xml" />
<logo>{{ $icon_png.Permalink }}</logo>
<icon>{{ .Site.Params.icon | absURL }}</icon>
<subtitle>
{{- if .Params.Description -}}
{{- .Params.Description -}}
@ -32,6 +29,8 @@
{{- .Site.Params.Description -}}
{{- end -}}
</subtitle>
<icon>{{ $icon.Permalink }}</icon><logo>{{ $logo.Permalink }}</logo>
<link rel="self" type="application/atom+xml" href="{{ .Permalink }}atom.xml" />
<sy:updatePeriod>{{ $period }}</sy:updatePeriod>
<sy:updateFrequency>2</sy:updateFrequency>
<author>
@ -44,43 +43,38 @@
<updated>{{ now.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
<id>{{ .Permalink }}</id>
{{ range $pages -}}
{{- if not .Params.Private }}
{{- if not .Params.Private -}}
<entry>
<title>{{ .Title }}</title>
<link rel="alternate" type="text/html" href="{{ .Permalink }}" />
<published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published>
<updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
<author>
<name>Rohan Kumar</name>
<uri>https://seirdy.one/</uri>
</author>
<id>{{ .Permalink }}</id>
<rights>CC-BY-SA 4.0 by Rohan Kumar</rights>
{{- with .Params.replyURI }}
<link rel="alternate" type="text/html" href="{{ .Permalink }}" /><id>{{ .Permalink }}</id>
<published>{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</published><updated>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</updated>
<author><name>Rohan Kumar</name><uri>https://seirdy.one/</uri></author>
<rights>CC-BY-SA 4.0 by Rohan Kumar</rights>
{{- with .Params.replyURI -}}
<thr:in-reply-to ref="{{ . }}" href="{{ . }}" />
{{- end -}}
{{- with .Params.replyAuthorURI }}
{{- with .Params.replyAuthorURI -}}
<link rel="mentioned" ostatus:object-type="http://activitystrea.ms/schema/1.0/person" href="{{ . }}"/>
{{- end -}}
<content type="xhtml" xml:base="{{ .Permalink }}">
<div xmlns="http://www.w3.org/1999/xhtml">
{{- if .Params.replyURI -}}
{{- partial "reply-context" .Params | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | safeHTML }}
{{- end -}}
{{ partial "processed-content.html" . | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | replaceRE `<meta content="true" ?/>` "" | safeHTML }}
</div>
</content>
{{- $type := "article" -}}
{{- if eq .Section "notes" -}}
{{- $type = "note" -}}
{{- end -}}
<activity:object-type>http://activitystrea.ms/schema/1.0/{{ $type }}</activity:object-type>
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
{{ with .Params.image -}}
{{- with .Params.image -}}
{{- $image := resources.Get (printf "/p/%s" . ) | resources.Fingerprint "md5" -}}
<media:thumbnail url="{{ $image.Permalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}" />
{{- end }}
</entry>
{{- end -}}
{{- end -}}
<content type="xhtml" xml:base="{{ .Permalink }}">
<div xmlns="http://www.w3.org/1999/xhtml">
{{- if .Params.replyURI -}}
{{- partial "reply-context" .Params | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | safeHTML }}
{{- end -}}
{{ partial "processed-content.html" . | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | replaceRE `<meta content="true" ?/>` "" | safeHTML -}}
</div>
</content>
</entry>
{{ end -}}
{{- end }}
</feed>