1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-23 12:52:10 +00:00

Add comment-count to atom feed, better varnames

This commit is contained in:
Rohan Kumar 2023-11-28 19:45:12 -08:00
parent 9ae8d87908
commit 41106cc9fd
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
2 changed files with 9 additions and 6 deletions

View file

@ -9,9 +9,9 @@
{{- if eq .Section "notes" -}} {{- if eq .Section "notes" -}}
{{- $period = "hourly" -}} {{- $period = "hourly" -}}
{{- end -}} {{- end -}}
{{- $icon := resources.Get "/favicon.svg" | resources.Fingerprint "md5" -}} {{- $faviconSvg := resources.Get "/favicon.svg" | resources.Fingerprint "md5" -}}
{{- $image := resources.Get "/favicon192.png" | resources.Fingerprint "md5" -}} {{- $image := resources.Get "/favicon192.png" | resources.Fingerprint "md5" -}}
{{- $logo := resources.Get "/atom.svg" | resources.Fingerprint "md5" -}} {{- $atomLogo := resources.Get "/atom.svg" | resources.Fingerprint "md5" -}}
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed <feed
xmlns="http://www.w3.org/2005/Atom" xmlns="http://www.w3.org/2005/Atom"
@ -22,6 +22,7 @@
xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0"
xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:poco="http://portablecontacts.net/spec/1.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:thr="http://purl.org/syndication/thread/1.0"
xmlns:webfeeds="http://webfeeds.org/rss/1.0"> xmlns:webfeeds="http://webfeeds.org/rss/1.0">
@ -34,10 +35,10 @@
{{- end -}} {{- end -}}
</subtitle> </subtitle>
<link rel="self" type="application/atom+xml" href="{{ .Permalink }}atom.xml" /> <link rel="self" type="application/atom+xml" href="{{ .Permalink }}atom.xml" />
<icon>{{ $icon.Permalink }}</icon> <icon>{{ $faviconSvg.Permalink }}</icon>
<webfeeds:icon>{{ $icon.Permalink }}</webfeeds:icon> <webfeeds:icon>{{ $image.Permalink }}</webfeeds:icon>
<webfeeds:cover>{{ $logo.Permalink }}</webfeeds:cover> <webfeeds:cover>{{ $atomLogo.Permalink }}</webfeeds:cover>
<logo>{{ $logo.Permalink }}</logo> <logo>{{ $atomLogo.Permalink }}</logo>
<webfeeds:accentColor>191919</webfeeds:accentColor> <webfeeds:accentColor>191919</webfeeds:accentColor>
<sy:updatePeriod>{{ $period }}</sy:updatePeriod> <sy:updatePeriod>{{ $period }}</sy:updatePeriod>
<sy:updateFrequency>2</sy:updateFrequency> <sy:updateFrequency>2</sy:updateFrequency>
@ -90,6 +91,7 @@
{{ partial "processed-content.html" . | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | replaceRE `<meta content="true" ?/>` "" | safeHTML -}} {{ partial "processed-content.html" . | replaceRE `(?: )?(?:item(type|scope|prop|id|ref)="[^"]*"|class="language-figure")` "" | replaceRE `<meta content="true" ?/>` "" | safeHTML -}}
</div> </div>
</content> </content>
<slash:comments>{{ .Page.Scratch.Get "webmentionCount" }}</slash:comments>
</entry> </entry>
{{ end -}} {{ end -}}
{{- end }} {{- end }}

View file

@ -25,6 +25,7 @@
{{- end -}} {{- end -}}
{{- /* Render webmentions if they exist */ -}} {{- /* Render webmentions if they exist */ -}}
{{- $count := (len $webmentions) -}} {{- $count := (len $webmentions) -}}
{{- .Page.Scratch.Set "webmentionCount" $count -}}<!--For use in atom feed-->
{{- if gt $count 0 -}} {{- if gt $count 0 -}}
<details> <details>
<summary>Toggle {{ $count }} Webmentions</summary> <summary>Toggle {{ $count }} Webmentions</summary>