aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-11-03 05:38:00 -0400
committertdro <tdro@noreply.example.com>2022-11-03 05:38:00 -0400
commit47bf369d7ef8ba967a51c964eaed0f286b345c5a (patch)
treeac9d0c2c3f7d39d83b3746a7a0d883ca55b4503e /themes/default/layouts/_default
parentbf1926903403a77767efb8bbbcde6b32c8929179 (diff)
downloadcanory-47bf369d7ef8ba967a51c964eaed0f286b345c5a.tar.gz
canory-47bf369d7ef8ba967a51c964eaed0f286b345c5a.tar.bz2
canory-47bf369d7ef8ba967a51c964eaed0f286b345c5a.zip
themes/default/layouts/_default/rss: Paginate
Firefox has issues with [xmlns] use [data="xml"] in stylesheet. Add previous and next to xslt sheet.
Diffstat (limited to 'themes/default/layouts/_default')
-rw-r--r--themes/default/layouts/_default/home.xslt.xsl25
-rw-r--r--themes/default/layouts/_default/rss.xml46
2 files changed, 49 insertions, 22 deletions
diff --git a/themes/default/layouts/_default/home.xslt.xsl b/themes/default/layouts/_default/home.xslt.xsl
index 05a35ea..1085ef5 100644
--- a/themes/default/layouts/_default/home.xslt.xsl
+++ b/themes/default/layouts/_default/home.xslt.xsl
@@ -2,7 +2,7 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="3.0">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
- <html xmlns="http://www.w3.org/1999/xhtml">
+ <html data="xml" xmlns="http://www.w3.org/1999/xhtml">
<head>
{{ print "<title><xsl:value-of select=\"/rss/channel/title\"/> Web Feed</title>" | safeHTML }}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
@@ -22,7 +22,17 @@
<main>
<nav>
<icon-button>
- <a href="/" onclick="window.history.go(-1); return false;">
+ <a onclick="window.history.go(-1); return false;">
+ <xsl:choose>
+ <xsl:when test="/rss/channel/atom:link[@rel='previous']/@href">
+ <xsl:attribute name="href">
+ <xsl:value-of select="/rss/channel/atom:link[@rel='previous']/@href"/>
+ </xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="href">/</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
{{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-left.svg")) }}
<small>Back</small>
</a>
@@ -31,6 +41,17 @@
<h2><xsl:value-of select="/rss/channel/title"/>'s Feed</h2>
<small>Web Feed Preview</small>
</section>
+ <xsl:if test="/rss/channel/atom:link[@rel='next']/@href">
+ <icon-button>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="/rss/channel/atom:link[@rel='next']/@href"/>
+ </xsl:attribute>
+ {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-right.svg")) }}
+ <small>Next</small>
+ </a>
+ </icon-button>
+ </xsl:if>
{{ if .Site.Menus.main }}
{{ range .Site.Menus.main }}
<icon-navigator hidden="">
diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml
index 3eee035..d6a8f46 100644
--- a/themes/default/layouts/_default/rss.xml
+++ b/themes/default/layouts/_default/rss.xml
@@ -1,14 +1,7 @@
-{{- $pageContext := . -}}
-
-{{- if .IsHome -}}
- {{- $pageContext = .Site -}}
-{{- end -}}
-
-{{- $pages := $pageContext.RegularPages -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
-{{- if ge $limit 1 -}}
- {{- $pages = $pages | first $limit -}}
+{{- if lt $limit 1 -}}
+ {{- $limit = .Paginator.TotalNumberOfElements -}}
{{- end -}}
{{- $lastBuildDate := now.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}}
@@ -17,14 +10,7 @@
{{- $lastBuildDate = .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML -}}
{{- end -}}
-{{- $atomLink := "" -}}
-
-{{- with .OutputFormats.Get "RSS" -}}
- {{- $atomLink = printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML -}}
-{{- end -}}
-
{{- $author := partial "function-authors-data.html" . -}}
-
{{- $title := partial "base-title.html" . -}}
{{- $description := partial "base-title.html" . -}}
@@ -50,8 +36,24 @@
)
-}}
-{{- print "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
-{{ print "<?xml-stylesheet href=\"/rss.xsl\" type=\"text/xsl\"?>" | safeHTML }}
+{{- $atomSelf := "" -}}
+{{- $atomPrevious := "" -}}
+{{- $atomNext := "" -}}
+
+{{- with .OutputFormats.Get "RSS" -}}
+ {{- $atomSelf = printf `<atom:link rel="self" href=%q type=%q />` .Permalink .MediaType | safeHTML -}}
+
+ {{- with $.Paginator.Prev -}}
+ {{- $atomPrevious = printf `<atom:link rel="previous" href=%q />` .URL | safeHTML -}}
+ {{- end -}}
+
+ {{- with $.Paginator.Next -}}
+ {{- $atomNext = printf `<atom:link rel="next" href=%q />` .URL | safeHTML -}}
+ {{- end -}}
+{{- end -}}
+
+{{- 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">
<channel>
@@ -66,8 +68,12 @@
<link>{{ .Permalink }}</link>
</image>
<lastBuildDate>{{ $lastBuildDate }}</lastBuildDate>
- {{ $atomLink }}
- {{- range $pages }}
+
+ {{ $atomSelf }}
+ {{ $atomPrevious }}
+ {{ $atomNext }}
+
+ {{- range first $limit .Paginator.Pages }}
{{ if and (not .Params.Unlisted) (not .ExpiryDate) }}
<item>
<title>{{ .Summary | htmlUnescape }}</title>