[pitivi-web] Generate RSS feeds



commit 646ff3d28579f4ac3a5d5032af7c3a468256d116
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Tue May 10 03:06:29 2022 +0200

    Generate RSS feeds

 _redirects                   |    1 +
 config.toml                  |    1 +
 content/contact.html         |    2 +-
 layouts/partials/footer.html |    2 +-
 layouts/partials/head.html   |    5 +-
 layouts/rss.xml              |   39 +
 static/planet/atom.xml       | 3536 ------------------------------------------
 static/planet/feeds.html     |   26 -
 static/planet/index.html     |    2 +
 9 files changed, 48 insertions(+), 3566 deletions(-)
---
diff --git a/_redirects b/_redirects
index 1e9ec90..64b4a70 100644
--- a/_redirects
+++ b/_redirects
@@ -5,3 +5,4 @@
 /pitivi-web/?go=download /pitivi-web/download/ 301
 /pitivi-web/?go=showcase /pitivi-web/showcase/ 301
 /pitivi-web/?go=tour /pitivi-web/tour/ 301
+/pitivi-web/planet/atom.xml /pitivi-web/index.xml 301
diff --git a/config.toml b/config.toml
index def5b1b..00a5b37 100644
--- a/config.toml
+++ b/config.toml
@@ -1,3 +1,4 @@
+title = "Pitivi"
 baseURL = "https://www.pitivi.org/";
 languageCode = "en-us"
 
diff --git a/content/contact.html b/content/contact.html
index 327e349..4886c7c 100644
--- a/content/contact.html
+++ b/content/contact.html
@@ -24,7 +24,7 @@ title: "Contact"
     
 <section class="auto-column-half">
     <h1>At a public event</h1>
-    <p>We attend various conferences and hackfests. To know where and when you might be able to meet us in 
person, follow us on <a href="https://www.pitivi.org/planet/";>Pitivi planet</a>, <a 
href="https://twitter.com/pitivi";>on Twitter</a>, or take a look at our public calendar below:</p>
+    <p>We attend various conferences and hackfests. To know where and when you might be able to meet us in 
person, follow us on <a href="https://twitter.com/pitivi";>Twitter</a>, watch our <a 
href="https://www.pitivi.org/index.xml";>RSS feed</a>, or take a look at our public calendar below:</p>
     <iframe 
src="https://www.google.com/calendar/embed?showTitle=0&amp;showPrint=0&amp;showCalendars=0&amp;height=300&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=m4r5pf5da7c8kdba1cjq2d3jb4%40group.calendar.google.com&amp;color=%23AB8B00&amp";
 style=" border-width:0 " width="440" height="300" frameborder="0" scrolling="no"></iframe>
 </section>
     
\ No newline at end of file
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index b86825d..e415a0d 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -16,7 +16,7 @@
     <div class="footer-box">
         {{ $editPath := "" }}
         {{- if .File }}
-        {{- $editPath = printf "content/%s" .Path }}
+        {{- $editPath = printf "content/%s" .File.Path }}
         {{- else if .IsHome }}
         {{- $editPath = "layouts/index.html" }}
         {{- end }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 4d15080..41fde19 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -9,7 +9,8 @@
     <!-- https://stackoverflow.com/questions/2268204/favicon-dimensions -->
     <link rel="icon" type="image/png" href="/i/pitivi-2019-icon-16.png" sizes="16x16" />
     <link rel="icon" type="image/png" href="/i/pitivi-2019-icon-32.png" sizes="32x32" />
-    <!-- Allow feed readers to pick up our Planet feed from any page !-->
-    <link rel="alternate" type="application/atom+xml" title="Planet Pitivi Atom 1.0" 
href="https://www.pitivi.org/planet/atom.xml";>
+    {{ range .AlternativeOutputFormats -}}
+        {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink 
$.Site.Title | safeHTML }}
+    {{ end -}}
     <script src="https://kit.fontawesome.com/762a6b0d58.js"; crossorigin="anonymous"></script>
 </head>
diff --git a/layouts/rss.xml b/layouts/rss.xml
new file mode 100644
index 0000000..ed64337
--- /dev/null
+++ b/layouts/rss.xml
@@ -0,0 +1,39 @@
+{{- $pctx := . -}}
+{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
+{{- $pages := slice -}}
+{{- if or $.IsHome $.IsSection -}}
+{{- $pages = $pctx.RegularPages -}}
+{{- else -}}
+{{- $pages = $pctx.Pages -}}
+{{- 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>{{ if eq  .Title  .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ 
.Site.Title }}{{ end }}</title>
+    <link>{{ .Permalink }}</link>
+    <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}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>{{ .Content | html }}</description>
+    </item>
+    {{ end }}
+  </channel>
+</rss>
\ No newline at end of file
diff --git a/static/planet/index.html b/static/planet/index.html
index f64959d..c7c8c56 100644
--- a/static/planet/index.html
+++ b/static/planet/index.html
@@ -24,6 +24,8 @@
 
 <body>
 
+<h1 style="color: red; margin: 2em;">Go check the <a href="/news/">latest news</a>. This page serves for 
historical purposes and is not updated anymore.</h1>
+
 <!-- hack de kiddo pour empêcher le bg bleu de déconner vu que j'ai pas de header !-->
 <div id="page" style="background-image:none;">
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]