aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2022-12-06 22:13:01 -0500
committertdro <tdro@noreply.example.com>2022-12-06 22:13:01 -0500
commitabcab1b57d6bc3e6e44ff4d143f33bee8cc15a4d (patch)
treec8b4a1bac29ecd349a4d8e76ee264dbb21f1768e /themes/default/layouts/_default
parent848f6a7f9dc8db283766e657c19aa7d2bfecfb2a (diff)
downloadcanory-abcab1b57d6bc3e6e44ff4d143f33bee8cc15a4d.tar.gz
canory-abcab1b57d6bc3e6e44ff4d143f33bee8cc15a4d.tar.bz2
canory-abcab1b57d6bc3e6e44ff4d143f33bee8cc15a4d.zip
themes/default/layouts/_default/sitemap.xml: Add schema and transform0.11.8
Validate with schema. Switch to xml-data identifier attribute and adjust file name-spacing in configuration
Diffstat (limited to 'themes/default/layouts/_default')
-rw-r--r--themes/default/layouts/_default/home.xslt.rss.xsl (renamed from themes/default/layouts/_default/home.xslt.xsl)2
-rw-r--r--themes/default/layouts/_default/home.xslt.sitemap.xsl97
-rw-r--r--themes/default/layouts/_default/sitemap.xml68
3 files changed, 146 insertions, 21 deletions
diff --git a/themes/default/layouts/_default/home.xslt.xsl b/themes/default/layouts/_default/home.xslt.rss.xsl
index c242f70..e0be815 100644
--- a/themes/default/layouts/_default/home.xslt.xsl
+++ b/themes/default/layouts/_default/home.xslt.rss.xsl
@@ -8,7 +8,7 @@
>
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" data="xml">
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" xml-data="">
<head>
{{ printf `<title><xsl:value-of select="/rss/channel/title"/> Web Feed</title>` | safeHTML }}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
diff --git a/themes/default/layouts/_default/home.xslt.sitemap.xsl b/themes/default/layouts/_default/home.xslt.sitemap.xsl
new file mode 100644
index 0000000..167b773
--- /dev/null
+++ b/themes/default/layouts/_default/home.xslt.sitemap.xsl
@@ -0,0 +1,97 @@
+{{- printf `<?xml version="1.0" encoding="utf-8"?>` | safeHTML }}
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
+ version="1.1"
+>
+ <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
+ <xsl:template match="/">
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" xml-data="sitemap">
+ <head>
+ <title>{{ $.Site.Title }} Site Map</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
+ {{- $default := resources.Get "css/default.css" -}}
+ {{- if .Site.Params.site.production -}}
+ {{ $css := slice $default | resources.Concat "css/bundle.css" | resources.Minify | fingerprint }}
+ <link rel="stylesheet" type="text/css" href="{{ $css.Permalink }}"/>
+ {{- else }}
+ <link rel="stylesheet" type="text/css" href="{{ $default.Permalink }}"/>
+ {{- end }}
+ </head>
+ <body>
+ <column-left>
+ </column-left>
+ <column-middle>
+ <main>
+ <nav>
+ <icon-button>
+ <a onclick="window.history.go(-1); return false;">
+ {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/arrow-left.svg")) }}
+ <small>Back</small>
+ </a>
+ </icon-button>
+ <section>
+ <h2>{{ $.Site.Title }} Site Map</h2>
+ <small>Site Map Preview</small>
+ </section>
+ {{ if .Site.Menus.main }}
+ {{ range .Site.Menus.main }}
+ <icon-navigator hidden="">
+ <icon-button>
+ <a
+ id="nav-middle-{{ path.Base .Identifier }}"
+ href="{{ .URL | absURL }}"
+ >
+ {{ with .Identifier }} {{ $icon := print (partial
+ "function-paths.html" "static") "/icons/" . ".svg" }} {{ safeHTML
+ (readFile $icon) }} {{ end }}
+ <small>{{ delimit (first 1 (split .Name " ")) " " }}</small>
+ </a>
+ </icon-button>
+ </icon-navigator>
+ {{ end }}
+ {{ end }}
+ </nav>
+ <navigation-separator><hr hidden=""></hr></navigation-separator>
+ <section>
+ <table>
+ <thead>
+ <tr>
+ <th>
+ <code>
+ <xsl:value-of select="count(sitemap:urlset/sitemap:url)"/>
+ Uniform Resource Locators (URLs)
+ </code>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <xsl:for-each select="sitemap:urlset/sitemap:url">
+ <tr>
+ <td>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:value-of select="sitemap:loc" />
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ Last Modified: <xsl:value-of select="sitemap:lastmod" />
+ Frequency: <xsl:value-of select="sitemap:changefreq" />
+ Priority: <xsl:value-of select="sitemap:priority" />
+ </xsl:attribute>
+ <xsl:value-of select="sitemap:loc" />
+ </a>
+ </td>
+ </tr>
+ </xsl:for-each>
+ </tbody>
+ </table>
+ </section>
+ </main>
+ </column-middle>
+ <column-right>
+ </column-right>
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>
diff --git a/themes/default/layouts/_default/sitemap.xml b/themes/default/layouts/_default/sitemap.xml
index 63f5119..b751f65 100644
--- a/themes/default/layouts/_default/sitemap.xml
+++ b/themes/default/layouts/_default/sitemap.xml
@@ -1,22 +1,50 @@
-{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
-<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
- xmlns:xhtml="http://www.w3.org/1999/xhtml">
- {{ range .Data.Pages }}
- <url>
- <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
- <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
- <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
- <priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
- <xhtml:link
- rel="alternate"
- hreflang="{{ .Language.Lang }}"
- href="{{ .Permalink }}"
- />{{ end }}
- <xhtml:link
- rel="alternate"
- hreflang="{{ .Language.Lang }}"
- href="{{ .Permalink }}"
- />{{ end }}
- </url>
+{{- printf `<?xml version="1.0" encoding="utf-8" standalone="yes"?>` | safeHTML }}
+{{ printf `<?xml-stylesheet href="/sitemap.xsl" type="text/xsl"?>` | safeHTML }}
+
+{{- $changefreq := "weekly" -}}
+{{- $priority := 0.5 -}}
+{{- $lastmod := now.Format "2006-01-02T15:04:05-07:00" }}
+
+<urlset
+ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml"
+>
+ {{- $notExpired := where .Data.Pages "Params.expirydate" "eq" nil -}}
+ {{- $notUnlisted := where .Data.Pages "Params.unlisted" "eq" nil -}}
+ {{- $filteredPages := $notExpired | intersect $notUnlisted -}}
+ {{- range $filteredPages }}
+
+ {{- with .Sitemap.ChangeFreq -}}
+ {{- $changefreq = . -}}
+ {{- end -}}
+
+ {{- if ge .Sitemap.Priority 0.0 -}}
+ {{- $priority = .Sitemap.Priority -}}
+ {{- end -}}
+
+ {{- if not .Lastmod.IsZero -}}
+ {{- $lastmod = safeHTML (.Lastmod.Format "2006-01-02T15:04:05-07:00") -}}
+ {{- end }}
+
+ <url>
+ <loc>{{ .Permalink }}</loc>
+ <lastmod>{{ $lastmod }}</lastmod>
+ <changefreq>{{ $changefreq }}</changefreq>
+ <priority>{{ $priority }}</priority>
+ {{- if .IsTranslated -}}
+ {{ range .Translations }}
+ <xhtml:link
+ rel="alternate"
+ hreflang="{{ .Language.Lang }}"
+ href="{{ .Permalink }}"
+ />
+ {{- end -}}
+ <xhtml:link
+ rel="alternate"
+ hreflang="{{ .Language.Lang }}"
+ href="{{ .Permalink }}"
+ />
+ {{ end }}
+ </url>
{{ end }}
</urlset>