[postgis-tickets] [SCM] postgis.net branch website-pr updated. 54f9dd86fc58b3e488a6c79107c5c5c57dd27550

git at osgeo.org git at osgeo.org
Thu May 11 08:30:41 PDT 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "postgis.net".

The branch, website-pr has been updated
       via  54f9dd86fc58b3e488a6c79107c5c5c57dd27550 (commit)
      from  57deb9c9c0a31ec5a5740d51efe556ab6ae007e1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 54f9dd86fc58b3e488a6c79107c5c5c57dd27550
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Thu May 11 08:30:23 2023 -0700

    add rss feed

diff --git a/config.toml b/config.toml
index 25a3988..a34ed2e 100644
--- a/config.toml
+++ b/config.toml
@@ -24,6 +24,14 @@ enableRobotsTXT = true
   tag = "tags"
   event = "events"
 
+[services.rss]
+  limit = 10
+
+[outputFormats]
+[outputFormats.RSS]
+  mediatype = "application/rss"
+  baseName = "feed"
+
 [params]
 
   # (Optional, default 6) Set how many table of contents levels to be showed on page.
diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml
new file mode 100644
index 0000000..9c21f62
--- /dev/null
+++ b/layouts/_default/rss.xml
@@ -0,0 +1,40 @@
+{{- $pctx := . -}}
+{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- $pages := slice -}}
+{{- if or $.IsHome $.IsSection -}}
+{{- $pages = $pctx.RegularPages -}}
+{{- $pages = (where (where $pctx.RegularPages ".Section" "news") "Kind" "page")  -}}
+{{- else -}}
+{{- $pages = $pctx.Pages -}}
+{{- $pages = (where (where $pctx.Pages ".Section" "news") "Kind" "page")  -}}{{- end -}}
+{{- $limit := .Site.Config.Services.RSS.Limit -}}
+{{- if ge $limit 1 -}}
+{{- $pages = $pages | first $limit -}}
+{{- end -}}
+{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+  <channel>
+    <title>{{ .Site.Title }}</title>
+    <link>{{ .Permalink }}</link>
+    <description>Recent content on {{ .Site.Title }}</description>
+    <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
+    <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
+    <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
+    <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
+    <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
+    <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
+    {{- with .OutputFormats.Get "RSS" -}}
+    {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
+    {{- end -}}
+    {{ range $pages }}
+    <item>
+      <title>{{ .Title }}</title>
+      <link>{{ .Permalink }}</link>
+      <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
+      {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
+      <guid>{{ .Permalink }}</guid>
+      <description>{{ .Summary | html }}</description>
+    </item>
+    {{ end }}
+  </channel>
+</rss>
diff --git a/layouts/partials/head/custom.html b/layouts/partials/head/custom.html
new file mode 100644
index 0000000..c391ddc
--- /dev/null
+++ b/layouts/partials/head/custom.html
@@ -0,0 +1,3 @@
+{{ with .OutputFormats.Get "rss" -}}
+    {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
+{{ end -}}

-----------------------------------------------------------------------

Summary of changes:
 config.toml                       |  8 ++++++++
 layouts/_default/rss.xml          | 40 +++++++++++++++++++++++++++++++++++++++
 layouts/partials/head/custom.html |  3 +++
 3 files changed, 51 insertions(+)
 create mode 100644 layouts/_default/rss.xml
 create mode 100644 layouts/partials/head/custom.html


hooks/post-receive
-- 
postgis.net


More information about the postgis-tickets mailing list