aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-11-14 13:40:08 -0300
committerEuAndreh <eu@euandre.org>2020-11-14 13:51:07 -0300
commitb611e04abd4576e65d2a9d9dd070d09a02d97aab (patch)
tree61089943b323ab0be6fd493e3fdde632c153afc5
parentInclude link to categories feeds on categories pages (diff)
downloadeuandre.org-b611e04abd4576e65d2a9d9dd070d09a02d97aab.tar.gz
euandre.org-b611e04abd4576e65d2a9d9dd070d09a02d97aab.tar.xz
Generate feed files for all collections and languages
-rw-r--r--_config.yml34
-rw-r--r--_includes/link-listing.html2
-rw-r--r--_layouts/default.html8
-rw-r--r--_layouts/slides.html2
-rw-r--r--_plugins/generate-feeds-for-categories.rb30
-rw-r--r--feed.articles.en.atom3
-rw-r--r--feed.articles.eo.atom3
-rw-r--r--feed.articles.fr.atom3
-rw-r--r--feed.articles.pt.atom3
-rw-r--r--feed.pastebins.en.atom3
-rw-r--r--feed.pastebins.eo.atom3
-rw-r--r--feed.pastebins.fr.atom3
-rw-r--r--feed.pastebins.pt.atom3
-rw-r--r--feed.slides.en.atom3
-rw-r--r--feed.slides.eo.atom3
-rw-r--r--feed.slides.fr.atom3
-rw-r--r--feed.slides.pt.atom3
-rw-r--r--feed.tils.en.atom3
-rw-r--r--feed.tils.eo.atom3
-rw-r--r--feed.tils.fr.atom3
-rw-r--r--feed.tils.pt.atom3
21 files changed, 51 insertions, 73 deletions
diff --git a/_config.yml b/_config.yml
index 7bec895..49a94de 100644
--- a/_config.yml
+++ b/_config.yml
@@ -6,6 +6,8 @@ author:
name: EuAndreh
email: eu@euandre.org
+langs: ['en', 'pt', 'fr', 'eo']
+
permalink: /:year/:month/:day/:title:output_ext
markdown: kramdown # default markdown renderer for Jekyll
@@ -83,10 +85,10 @@ t:
fr: "Blogue d'EuAndreh"
eo: "Blogo de EuAndreh"
url:
- en: "feed.articles.en.atom"
- pt: "feed.articles.pt.atom"
- fr: "feed.articles.fr.atom"
- eo: "feed.articles.eo.atom"
+ en: "/feed.articles.en.atom"
+ pt: "/feed.articles.pt.atom"
+ fr: "/feed.articles.fr.atom"
+ eo: "/feed.articles.eo.atom"
pastebins:
listing:
en: "Pastebins listing"
@@ -100,10 +102,10 @@ t:
fr: "Pastebins d'EuAndreh"
eo: "Pastebins de EuAndreh"
url:
- en: "feed.pastebins.en.atom"
- pt: "feed.pastebins.pt.atom"
- fr: "feed.pastebins.fr.atom"
- eo: "feed.pastebins.eo.atom"
+ en: "/feed.pastebins.en.atom"
+ pt: "/feed.pastebins.pt.atom"
+ fr: "/feed.pastebins.fr.atom"
+ eo: "/feed.pastebins.eo.atom"
tils:
name:
en: "TIL"
@@ -127,10 +129,10 @@ t:
fr: "AJA d'EuAndreh"
eo: "HML de EuAndreh"
url:
- en: "feed.tils.en.atom"
- pt: "feed.tils.pt.atom"
- fr: "feed.tils.fr.atom"
- eo: "feed.tils.eo.atom"
+ en: "/feed.tils.en.atom"
+ pt: "/feed.tils.pt.atom"
+ fr: "/feed.tils.fr.atom"
+ eo: "/feed.tils.eo.atom"
slides:
name:
en: "Slides"
@@ -154,10 +156,10 @@ t:
fr: "Diapositives d'EuAndreh"
eo: "Lumbildoj de EuAndreh"
url:
- en: "feed.slides.en.atom"
- pt: "feed.slides.pt.atom"
- fr: "feed.slides.fr.atom"
- eo: "feed.slides.eo.atom"
+ en: "/feed.slides.en.atom"
+ pt: "/feed.slides.pt.atom"
+ fr: "/feed.slides.fr.atom"
+ eo: "/feed.slides.eo.atom"
posted_on:
en: "Posted on"
pt: "Postado em"
diff --git a/_includes/link-listing.html b/_includes/link-listing.html
index 2ceaf6a..9252b7b 100644
--- a/_includes/link-listing.html
+++ b/_includes/link-listing.html
@@ -1,6 +1,6 @@
<h2>
{{ site.t[include.kind].listing[page.lang] }}
- <a href="{% link {{ site.t[include.kind].feed.url[page.lang] }} %}">
+ <a href="{{ site.t[include.kind].feed.url[page.lang] }}">
<img class="simple-icon" src="/images/atom.svg" alt="{{ site.t.alt.atom[page.lang] }}" />
</a>
</h2>
diff --git a/_layouts/default.html b/_layouts/default.html
index 71c4069..704525b 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -4,10 +4,10 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/styles.css" />
- <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.articles.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.articles.feed.title[page.lang] }}" />
- <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.pastebins.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.pastebins.feed.title[page.lang] }}" />
- <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.tils.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.tils.feed.title[page.lang] }}" />
- <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.slides.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.slides.feed.title[page.lang] }}" />
+ <link rel="alternate" type="application/atom+xml" href="{{ site.t.articles.feed.url[page.lang] }}" hreflang="{{ page.lang}}" title="{{ site.t.articles.feed.title[page.lang] }}" />
+ <link rel="alternate" type="application/atom+xml" href="{{ site.t.pastebins.feed.url[page.lang] }}" hreflang="{{ page.lang}}" title="{{ site.t.pastebins.feed.title[page.lang] }}" />
+ <link rel="alternate" type="application/atom+xml" href="{{ site.t.tils.feed.url[page.lang] }}" hreflang="{{ page.lang}}" title="{{ site.t.tils.feed.title[page.lang] }}" />
+ <link rel="alternate" type="application/atom+xml" href="{{ site.t.slides.feed.url[page.lang] }}" hreflang="{{ page.lang}}" title="{{ site.t.slides.feed.title[page.lang] }}" />
<title>{{ page.title }} - EuAndreh</title>
<meta property="og:site_name" content="{{ site.title }}" />
diff --git a/_layouts/slides.html b/_layouts/slides.html
index 839fe2a..4f99f52 100644
--- a/_layouts/slides.html
+++ b/_layouts/slides.html
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <link rel="alternate" type="application/atom+xml" href="{% link {{ site.t.slides.feed.url[page.lang] }} %}" hreflang="{{ page.lang}}" title="{{ site.t.slides.feed.title[page.lang] }}" />
+ <link rel="alternate" type="application/atom+xml" href="{{ site.t.slides.feed.url[page.lang] }}" hreflang="{{ page.lang}}" title="{{ site.t.slides.feed.title[page.lang] }}" />
<title>{{ page.title }} - EuAndreh</title>
diff --git a/_plugins/generate-feeds-for-categories.rb b/_plugins/generate-feeds-for-categories.rb
index f5cc8db..9958fba 100644
--- a/_plugins/generate-feeds-for-categories.rb
+++ b/_plugins/generate-feeds-for-categories.rb
@@ -1,5 +1,5 @@
module Jekyll
- class FeedsForCategoriesGenerator < Generator
+ class FeedsGenerator < Generator
safe true
def gen_categories_index(site)
@@ -23,7 +23,8 @@ module Jekyll
categories_index
end
- def generate(site)
+ def feeds_by_category(site)
+ feed_pages = []
gen_categories_index(site).each do |collection_name, langs|
langs.each do |lang, categories|
categories.each do |category_name, articles|
@@ -33,10 +34,33 @@ module Jekyll
page.content = <<-EOF
{% include feed.atom entries=site.#{collection_name} kind="#{collection_name}" lang="#{lang}" categories_filter="#{category_name}" %}
EOF
- site.pages << page
+ feed_pages << page
end
end
end
+ feed_pages
+ end
+
+ def global_feeds(site)
+ feed_pages = []
+ langs = site.config['langs']
+ collections = site.config['collections'].keys
+ langs.each do |lang|
+ collections.each do |collection|
+ feed_name = "feed.#{collection}.#{lang}.atom"
+ page = PageWithoutAFile.new(site, site.source, "", feed_name)
+ page.content = <<-EOF
+{% include feed.atom entries=site.#{collection} kind="#{collection}" lang="#{lang}" %}
+ EOF
+ feed_pages << page
+ end
+ end
+ feed_pages
+ end
+
+ def generate(site)
+ site.pages.concat(feeds_by_category(site))
+ site.pages.concat(global_feeds(site))
end
end
diff --git a/feed.articles.en.atom b/feed.articles.en.atom
deleted file mode 100644
index 929e9c8..0000000
--- a/feed.articles.en.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.articles kind="articles" lang="en" %}
diff --git a/feed.articles.eo.atom b/feed.articles.eo.atom
deleted file mode 100644
index 8e80177..0000000
--- a/feed.articles.eo.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.articles kind="articles" lang="eo" %}
diff --git a/feed.articles.fr.atom b/feed.articles.fr.atom
deleted file mode 100644
index 8c52673..0000000
--- a/feed.articles.fr.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.articles kind="articles" lang="fr" %}
diff --git a/feed.articles.pt.atom b/feed.articles.pt.atom
deleted file mode 100644
index f4f58ca..0000000
--- a/feed.articles.pt.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.articles kind="articles" lang="pt" %}
diff --git a/feed.pastebins.en.atom b/feed.pastebins.en.atom
deleted file mode 100644
index ea7e4bd..0000000
--- a/feed.pastebins.en.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.pastebins kind="pastebins" lang="en" %}
diff --git a/feed.pastebins.eo.atom b/feed.pastebins.eo.atom
deleted file mode 100644
index a95f6d4..0000000
--- a/feed.pastebins.eo.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.pastebins kind="pastebins" lang="eo" %}
diff --git a/feed.pastebins.fr.atom b/feed.pastebins.fr.atom
deleted file mode 100644
index 1e77095..0000000
--- a/feed.pastebins.fr.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.pastebins kind="pastebins" lang="fr" %}
diff --git a/feed.pastebins.pt.atom b/feed.pastebins.pt.atom
deleted file mode 100644
index 1e77095..0000000
--- a/feed.pastebins.pt.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.pastebins kind="pastebins" lang="fr" %}
diff --git a/feed.slides.en.atom b/feed.slides.en.atom
deleted file mode 100644
index 6874fc1..0000000
--- a/feed.slides.en.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.slides kind="slides" lang="en" %}
diff --git a/feed.slides.eo.atom b/feed.slides.eo.atom
deleted file mode 100644
index ddf55c1..0000000
--- a/feed.slides.eo.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.slides kind="slides" lang="eo" %}
diff --git a/feed.slides.fr.atom b/feed.slides.fr.atom
deleted file mode 100644
index 2476160..0000000
--- a/feed.slides.fr.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.slides kind="slides" lang="fr" %}
diff --git a/feed.slides.pt.atom b/feed.slides.pt.atom
deleted file mode 100644
index 4d44562..0000000
--- a/feed.slides.pt.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.slides kind="slides" lang="pt" %}
diff --git a/feed.tils.en.atom b/feed.tils.en.atom
deleted file mode 100644
index 97be510..0000000
--- a/feed.tils.en.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.tils kind="tils" lang="en" %}
diff --git a/feed.tils.eo.atom b/feed.tils.eo.atom
deleted file mode 100644
index 82ea975..0000000
--- a/feed.tils.eo.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.tils kind="tils" lang="eo" %}
diff --git a/feed.tils.fr.atom b/feed.tils.fr.atom
deleted file mode 100644
index 938c32d..0000000
--- a/feed.tils.fr.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.tils kind="tils" lang="fr" %}
diff --git a/feed.tils.pt.atom b/feed.tils.pt.atom
deleted file mode 100644
index d646e94..0000000
--- a/feed.tils.pt.atom
+++ /dev/null
@@ -1,3 +0,0 @@
----
----
-{% include feed.atom entries=site.tils kind="tils" lang="pt" %}