diff --git a/_config.yml b/_config.yml index 79bd160..c9ae23c 100644 --- a/_config.yml +++ b/_config.yml @@ -109,3 +109,18 @@ deploy: type: git repo: git@github.com:thislight/thislight.github.io.git branch: master + + +feed: + limit: 20 + order_by: "-date" + tag_dir: "feeds/by-tag" + category_dir: "feeds/by-category" + rss: + enable: true + output: "rss.xml" + atom: + enable: true + output: "atom.xml" + jsonFeed: + enable: false diff --git a/source/_data/theme.yaml b/source/_data/theme.yaml index 4f1ae0a..2e0ed11 100644 --- a/source/_data/theme.yaml +++ b/source/_data/theme.yaml @@ -14,4 +14,22 @@ my_mastodon: "https://mastodon.social/@thislight" footer_links: GitHub: "https://github.com/thislight" - GitLab: "https://gitlab.com/thislight" \ No newline at end of file + GitLab: "https://gitlab.com/thislight" + Feed (Atom): "/atom.xml" + Feed (RSS): "/rss.xml" + +site_rss: + atom: /atom.xml + rss: /rss.xml + +topic_rss: + tag: + prefix: "/feeds/by-tag/" + atom_suffix: /atom.xml + rss_suffix: /rss.xml + name_lowercase: true + category: + prefix: /feeds/by-category/ + atom_suffix: /atom.xml + rss_suffix: /rss.xml + name_lowercase: true \ No newline at end of file diff --git a/themes/cmd/_config.yml b/themes/cmd/_config.yml index c7e0d9f..3a7ac99 100644 --- a/themes/cmd/_config.yml +++ b/themes/cmd/_config.yml @@ -31,3 +31,19 @@ my_mastodon: https://mastodon.example.com/@example footer_links: Link 1: "https://example.org" Link 2: "https://example.com" + +site_rss: + atom: /atom.xml + rss: /rss.xml + +topic_rss: + tag: + prefix: "/feeds/by-tag/" + atom_suffix: /atom.xml + rss_suffix: /rss.xml + name_lowercase: true + category: + prefix: /feeds/by-category/ + atom_suffix: /atom.xml + rss_suffix: /rss.xml + name_lowercase: true diff --git a/themes/cmd/layout/category.swig b/themes/cmd/layout/category.swig index 4724973..d5ae5f0 100644 --- a/themes/cmd/layout/category.swig +++ b/themes/cmd/layout/category.swig @@ -1,21 +1,51 @@ {% extends 'includes/layout.swig' %} +{% import "includes/paginator.swig" as P %} +{% import "includes/tags.swig" as T %} + {% block body %}
-

{{ page.category }}

- {% for postItem in page.posts.toArray() %} -
- - {{ postItem.title }} - - +
+

{{page.category}}

+ {% if site.data.theme.topic_rss and site.data.theme.topic_rss.category %} + {% set category_rss = site.data.theme.topic_rss.category %} + {% set rss_name = category_rss.name_lowercase? page.category.toLowerCase(): page.category %} +
+ {% if category_rss.atom_suffix %} + Feed (Atom) + {% endif %} + {% if category_rss.rss_suffix %} + Feed (RSS) + {% endif %} +
+ {% endif %} +
+
+ -
- {{ paginator() }} +
+ {{ P.Paginiation() }} +
{% endblock %} diff --git a/themes/cmd/layout/includes/layout.swig b/themes/cmd/layout/includes/layout.swig index 616ccff..5a94c08 100644 --- a/themes/cmd/layout/includes/layout.swig +++ b/themes/cmd/layout/includes/layout.swig @@ -41,6 +41,15 @@ {% endif %} + {% if site.data.theme.site_rss %} + {% if site.data.theme.site_rss.rss %} + + {% endif %} + {% if site.data.theme.site_rss.atom %} + + {% endif %} + {% endif %} + {% block add_head %}{% endblock %} diff --git a/themes/cmd/layout/tag.swig b/themes/cmd/layout/tag.swig index a7c037f..73fea8b 100644 --- a/themes/cmd/layout/tag.swig +++ b/themes/cmd/layout/tag.swig @@ -4,7 +4,21 @@ {% import "includes/tags.swig" as T %} {% block body %} -

{{page.tag}}

+
+

{{page.tag}}

+ {% if site.data.theme.topic_rss and site.data.theme.topic_rss.tag %} + {% set tag_rss = site.data.theme.topic_rss.tag %} + {% set rss_name = tag_rss.name_lowercase? page.tag.toLowerCase(): page.tag %} +
+ {% if tag_rss.atom_suffix %} + Feed (Atom) + {% endif %} + {% if tag_rss.rss_suffix %} + Feed (RSS) + {% endif %} +
+ {% endif %} +