cmd: support site & per-topic rss links
This commit is contained in:
parent
428df548a9
commit
99827b58af
6 changed files with 116 additions and 14 deletions
15
_config.yml
15
_config.yml
|
@ -109,3 +109,18 @@ deploy:
|
||||||
type: git
|
type: git
|
||||||
repo: git@github.com:thislight/thislight.github.io.git
|
repo: git@github.com:thislight/thislight.github.io.git
|
||||||
branch: master
|
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
|
||||||
|
|
|
@ -15,3 +15,21 @@ my_mastodon: "https://mastodon.social/@thislight"
|
||||||
footer_links:
|
footer_links:
|
||||||
GitHub: "https://github.com/thislight"
|
GitHub: "https://github.com/thislight"
|
||||||
GitLab: "https://gitlab.com/thislight"
|
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
|
|
@ -31,3 +31,19 @@ my_mastodon: https://mastodon.example.com/@example
|
||||||
footer_links:
|
footer_links:
|
||||||
Link 1: "https://example.org"
|
Link 1: "https://example.org"
|
||||||
Link 2: "https://example.com"
|
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
|
||||||
|
|
|
@ -1,21 +1,51 @@
|
||||||
{% extends 'includes/layout.swig' %}
|
{% extends 'includes/layout.swig' %}
|
||||||
|
|
||||||
|
{% import "includes/paginator.swig" as P %}
|
||||||
|
{% import "includes/tags.swig" as T %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div id="category">
|
<div id="category">
|
||||||
<h1>{{ page.category }}</h1>
|
<div class="card z-depth-0">
|
||||||
{% for postItem in page.posts.toArray() %}
|
<h2 style="margin-left: 1rem; margin-bottom: 0;">{{page.category}}<i class="mdi mdi-tag" style="font-size: 2rem; color: #ee6e73;"></i></h2>
|
||||||
<div class="category-item">
|
{% if site.data.theme.topic_rss and site.data.theme.topic_rss.category %}
|
||||||
<a href="{{ url_for(postItem.path) }}">
|
{% set category_rss = site.data.theme.topic_rss.category %}
|
||||||
{{ postItem.title }}
|
{% set rss_name = category_rss.name_lowercase? page.category.toLowerCase(): page.category %}
|
||||||
</a>
|
<div class="card-action">
|
||||||
<time datetime="{{ date_xml(postItem.date) }}">
|
{% if category_rss.atom_suffix %}
|
||||||
{{ date(postItem.date) }}
|
<a href="{{ full_url_for(category_rss.prefix + rss_name + category_rss.atom_suffix) }}">Feed (Atom)</a>
|
||||||
</time>
|
{% endif %}
|
||||||
|
{% if category_rss.rss_suffix %}
|
||||||
|
<a href="{{ full_url_for(category_rss.rss_suffix + rss_name + category_rss.rss_suffix) }}">Feed (RSS)</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<ul class="collapsible popout">
|
||||||
|
{% for article in page.posts.toArray() %}
|
||||||
|
<li>
|
||||||
|
<div class="collapsible-header">
|
||||||
|
<div class="row" style="margin: 0;">
|
||||||
|
<div class="row" style="margin-left: 4px; margin-bottom: 0.5rem;"><div class="col s12"><h3 style="font-size: 1.2rem; margin: 0; margin-top: 8px;">{{article.title}}</h3></div></div>
|
||||||
|
<div class="row" style="margin-left: 0; margin-bottom: 0;"><div class="col s12">{{ T.PostTags(article) }}</div></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="collapsible-body small-padding">
|
||||||
|
<div style="padding-left: 1rem">
|
||||||
|
<div class="mdi mdi-clock" style="padding-bottom: 8px">{{ date(article.date) }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="entry">{{article.excerpt}}</div>
|
||||||
|
<div class="card z-depth-0">
|
||||||
|
<div class="card-action" style="padding-bottom: 0; padding-left: 14px;">
|
||||||
|
<a href="{% if article.link %}{{article.link}}{% else %}{{url_for(article.path)}}{% endif %}">Go To "{{article.title}}"</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</ul>
|
||||||
|
|
||||||
<div id="paginator">
|
<div id="center">
|
||||||
{{ paginator() }}
|
{{ P.Paginiation() }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -41,6 +41,15 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<link rel="stylesheet" href="/materialize/css/materialize.css">
|
<link rel="stylesheet" href="/materialize/css/materialize.css">
|
||||||
|
|
||||||
|
{% if site.data.theme.site_rss %}
|
||||||
|
{% if site.data.theme.site_rss.rss %}
|
||||||
|
<link rel="alternate" type="application/rss+xml" title="{{ config.title }}" href="{{ full_url_for(site.data.theme.site_rss.rss) }}" />
|
||||||
|
{% endif %}
|
||||||
|
{% if site.data.theme.site_rss.atom %}
|
||||||
|
<link rel="alternate" type="application/atom+xml" title="{{ config.title }}" href="{{ full_url_for(site.data.theme.site_rss.atom) }}" />
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block add_head %}{% endblock %}
|
{% block add_head %}{% endblock %}
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -4,7 +4,21 @@
|
||||||
{% import "includes/tags.swig" as T %}
|
{% import "includes/tags.swig" as T %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h2 style="margin-left: 1rem">{{page.tag}}<i class="mdi mdi-tag" style="font-size: 2rem; color: #ee6e73;"></i></h2>
|
<div class="card z-depth-0">
|
||||||
|
<h2 style="margin-left: 1rem; margin-bottom: 0;">{{page.tag}}<i class="mdi mdi-tag" style="font-size: 2rem; color: #ee6e73;"></i></h2>
|
||||||
|
{% 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 %}
|
||||||
|
<div class="card-action">
|
||||||
|
{% if tag_rss.atom_suffix %}
|
||||||
|
<a href="{{ full_url_for(tag_rss.prefix + rss_name + tag_rss.atom_suffix) }}">Feed (Atom)</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if tag_rss.rss_suffix %}
|
||||||
|
<a href="{{ full_url_for(tag_rss.rss_suffix + rss_name + tag_rss.rss_suffix) }}">Feed (RSS)</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
<ul class="collapsible popout">
|
<ul class="collapsible popout">
|
||||||
{% for article in page.posts.toArray() %}
|
{% for article in page.posts.toArray() %}
|
||||||
<li>
|
<li>
|
||||||
|
|
Loading…
Reference in a new issue