diff options
author | tdro <tdro@noreply.example.com> | 2022-12-01 23:35:55 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-12-01 23:35:55 -0500 |
commit | f174703fafd064be06552fd73c992b0b87fd92b3 (patch) | |
tree | 7aefb8f91ba418f84f13063a34a8cd8ee7a80c04 /themes/default/layouts/_default | |
parent | 2445874d6bba90c816f8537268d7f985316b1ce8 (diff) | |
download | canory-f174703fafd064be06552fd73c992b0b87fd92b3.tar.gz canory-f174703fafd064be06552fd73c992b0b87fd92b3.tar.bz2 canory-f174703fafd064be06552fd73c992b0b87fd92b3.zip |
themes/default/layouts/_default/rss.xml: Add atom:author to entry
To show name and image. Add feed generator signature to channel
Diffstat (limited to 'themes/default/layouts/_default')
-rw-r--r-- | themes/default/layouts/_default/home.xslt.xsl | 8 | ||||
-rw-r--r-- | themes/default/layouts/_default/rss.xml | 42 |
2 files changed, 42 insertions, 8 deletions
diff --git a/themes/default/layouts/_default/home.xslt.xsl b/themes/default/layouts/_default/home.xslt.xsl index e271d67..c242f70 100644 --- a/themes/default/layouts/_default/home.xslt.xsl +++ b/themes/default/layouts/_default/home.xslt.xsl @@ -81,12 +81,12 @@ <micro-thumbnail> <figure> <a> - <xsl:attribute name="href"><xsl:value-of select="/rss/channel/link"/></xsl:attribute> + <xsl:attribute name="href"><xsl:value-of select="link"/></xsl:attribute> <picture> <img> - <xsl:attribute name="alt"><xsl:value-of select="/rss/channel/category"/></xsl:attribute> - <xsl:attribute name="title"><xsl:value-of select="/rss/channel/category"/></xsl:attribute> - <xsl:attribute name="src"><xsl:value-of select="/rss/channel/image/url"/></xsl:attribute> + <xsl:attribute name="alt"><xsl:value-of select="atom:author/atom:name"/></xsl:attribute> + <xsl:attribute name="title"><xsl:value-of select="atom:author/atom:name"/></xsl:attribute> + <xsl:attribute name="src"><xsl:value-of select="atom:author/atom:uri"/></xsl:attribute> </img> </picture> </a> diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml index d6a8f46..562da9e 100644 --- a/themes/default/layouts/_default/rss.xml +++ b/themes/default/layouts/_default/rss.xml @@ -10,9 +10,9 @@ {{- $lastBuildDate = .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}} {{- end -}} -{{- $author := partial "function-authors-data.html" . -}} {{- $title := partial "base-title.html" . -}} {{- $description := partial "base-title.html" . -}} +{{- $author := partial "function-authors-data.html" . -}} {{- if (eq .Page.Kind "section") -}} {{- $title = $author.name -}} @@ -55,7 +55,10 @@ {{- printf `<?xml version="1.0" encoding="utf-8" standalone="yes"?>` | safeHTML }} {{ printf `<?xml-stylesheet href="/rss.xsl" type="text/xsl"?>` | safeHTML }} -<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> +<rss + version="2.0" + xmlns:atom="http://www.w3.org/2005/Atom" +> <channel> <title>{{ $title }}</title> <link>{{ .Permalink }}</link> @@ -67,13 +70,40 @@ <url>{{ $image.Permalink }}</url> <link>{{ .Permalink }}</link> </image> + <generator>Hugo {{ hugo.Version }}</generator> <lastBuildDate>{{ $lastBuildDate }}</lastBuildDate> {{ $atomSelf }} {{ $atomPrevious }} {{ $atomNext }} - {{- range first $limit .Paginator.Pages }} + {{ range first $limit .Paginator.Pages }} + + {{- $author = partial "function-authors-data.html" . -}} + {{- $profile = $author.picture.profile -}} + {{- $file = not (urls.Parse $profile).Host -}} + + {{- if $file -}} + {{- $profile = print $author.user "/" $profile -}} + {{- end -}} + + {{- $image = partial "function-caches-images.html" + (dict + "Source" $profile + "Fit" "160x160" + "Target" (print (partial "function-paths.html" "media") "/" $author.user "/") + "Copy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.Base $profile)) + "AlternateCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" (path.BaseName $profile) ".webp") + ) + -}} + + {{- $atomAuthorUri := $image.Permalink -}} + {{- $atomAuthorName := or .Params.Feed.name $author.name -}} + + {{- if .Params.Feed.favicon -}} + {{- $atomAuthorUri = .Params.Feed.favicon | absURL -}} + {{- end -}} + {{ if and (not .Params.Unlisted) (not .ExpiryDate) }} <item> <title>{{ .Summary | htmlUnescape }}</title> @@ -85,8 +115,12 @@ {{- print "<br>" | html -}} {{- partial "rss-tags.html" . | html -}} </description> + <atom:author> + <atom:name>{{ $atomAuthorName }}</atom:name> + <atom:uri>{{ $atomAuthorUri }}</atom:uri> + </atom:author> </item> - {{- end -}} + {{ end -}} {{ end }} </channel> </rss> |