summaryrefslogtreecommitdiff
path: root/sysret.org/themes/tabi-lean/templates/atom.xml
blob: 3e5b55c482455d92b42ebc3c5f16d2b124cb995b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
{%- import "macros/translate.html" as macros_translate -%}
{%- import "macros/settings.html" as macros_settings -%}
{#- Load the internationalisation data -#}
{%- set language_strings = load_data(path="i18n/" ~ lang ~ '.toml', required=false) -%}
{%- if not language_strings -%}
    {%- set language_strings = load_data(path="themes/tabi/i18n/" ~ lang ~ ".toml", required=false) -%}
{%- endif -%}
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="{{ get_url(path='/feed_style.xsl', trailing_slash=false) | safe }}" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}">
    <tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
        <tabi:base_url>{{ config.base_url }}</tabi:base_url>
        <tabi:separator>
            {{  config.extra.separator | default(value="•") }}
        </tabi:separator>
        <tabi:about_feeds>
            {{- macros_translate::translate(key="about_feeds", default="This is a web feed, also known as an Atom feed. Subscribe by copying the URL from the address bar into your newsreader", language_strings=language_strings) -}}
        </tabi:about_feeds>
        <tabi:visit_the_site>
            {{- macros_translate::translate(key="visit_the_site", default="Visit website", language_strings=language_strings) -}}
        </tabi:visit_the_site>
        <tabi:recent_posts>
            {{- macros_translate::translate(key="recent_posts", default="Recent posts", language_strings=language_strings) -}}
        </tabi:recent_posts>
        <tabi:last_updated_on>
            {{- macros_translate::translate(key="last_updated_on", default="Updated on $DATE", language_strings=language_strings) -}}
        </tabi:last_updated_on>
        <tabi:default_theme>
            {{- config.extra.default_theme | default(value="") -}}
        </tabi:default_theme>
        <tabi:post_listing_date>
            {{- config.extra.post_listing_date | default(value="date") -}}
        </tabi:post_listing_date>
        <tabi:current_section>
            {%- if term -%}
                {{ term.name }}
            {%- elif section.title -%}
                {{ section.title }}
            {%- else -%}
                {{ config.title }}
            {%- endif -%}
        </tabi:current_section>
    </tabi:metadata>

    {#- Load extra CSS (skin) if set in config.toml -#}
    {%- if config.extra.skin -%}
        <link rel="extra-stylesheet" href="{{ get_url(path='skins/' ~ config.extra.skin ~ '.css', cachebust=true) | safe }}" />
    {%- endif -%}

    <title>{{ config.title | striptags | safe }}
    {%- if term %} - {{ term.name }}
    {%- elif section.title %} - {{ section.title }}
    {%- endif -%}
    </title>
    {%- if config.description %}
        <subtitle>{{ config.description }}</subtitle>
    {%- endif %}
    <link href="{{ feed_url | safe }}" rel="self" type="application/atom+xml"/>
    <link href="
        {%- if term -%}
            {{ term.permalink | escape_xml | safe }}
        {%- elif section -%}
            {{ section.permalink | escape_xml | safe }}
        {%- else -%}
            {{ get_url(path="/", lang=lang) | escape_xml | safe }}
        {%- endif -%}
    " rel="alternate" type="text/html"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    {%- if last_updated -%}
    <updated>{{ last_updated | date(format="%+") }}</updated>
    {%- endif -%}
    <id>{{ feed_url | safe }}</id>
    {%- for page in pages %}
    {%- if macros_settings::evaluate_setting_priority(setting="hide_from_feed", page=page, default_global_value=false) == "true" -%}
        {%- continue -%}
    {%- endif -%}
    {#- Skip if hide_from_main_feed is true and this is the main feed -#}
    {%- if macros_settings::evaluate_setting_priority(setting="hide_from_main_feed", page=page, default_global_value=false) == "true"
         and not section
         and not term -%}
        {%- continue -%}
    {%- endif -%}
    <entry xml:lang="{{ page.lang }}">
        <title>{{ page.title }}</title>
        <published>{{ page.date | date(format="%+") }}</published>
        <updated>{{ page.updated | default(value=page.date) | date(format="%+") }}</updated>
        <author>
            <name>
            {%- if page.authors -%}
                {{ page.authors[0] }}
            {%- elif config.author -%}
                {{ config.author }}
            {%- else -%}
                Unknown
            {%- endif -%}
            </name>
        </author>
        <link rel="alternate" href="{{ page.permalink | safe }}" type="text/html"/>
        <id>{{ page.permalink | safe }}</id>
        {% if config.extra.full_content_in_feed %}
            <content type="html">{{ page.content }}</content>
        {% endif -%}
        {% if page.description -%}
            <summary type="html">{{ page.description }}</summary>
        {% elif page.summary -%}
            <summary type="html">{{ page.summary | striptags | trim_end_matches(pat=".") | safe }}</summary>
        {% endif -%}
    </entry>
    {%- endfor %}
</feed>