🐛 fix(feed): resolve Atom feed validation issues (#393)

main
Óscar 5 months ago committed by GitHub
parent 1ffe43f934
commit 52979f7f54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:base="http://purl.org/atompub/base/1.0/" xmlns:str="https://github.com/welpo/tabi"> xmlns:atom="http://www.w3.org/2005/Atom" xmlns:tabi="https://github.com/welpo/tabi">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/"> <xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<xsl:attribute name="data-theme"> <xsl:attribute name="data-theme">
<xsl:value-of select="/atom:feed/str:translations/str:default_theme"/> <xsl:value-of select="/atom:feed/tabi:metadata/tabi:default_theme"/>
</xsl:attribute> </xsl:attribute>
<head> <head>
<title> <title>
@ -24,13 +24,13 @@
<div class="info-box"> <div class="info-box">
<!-- This block replaces the text "About Feeds" with a hyperlink in the translated string --> <!-- This block replaces the text "About Feeds" with a hyperlink in the translated string -->
<xsl:choose> <xsl:choose>
<xsl:when test="contains(/atom:feed/str:translations/str:about_feeds, 'About Feeds')"> <xsl:when test="contains(/atom:feed/tabi:metadata/tabi:about_feeds, 'About Feeds')">
<xsl:value-of select="substring-before(/atom:feed/str:translations/str:about_feeds, 'About Feeds')"/> <xsl:value-of select="substring-before(/atom:feed/tabi:metadata/tabi:about_feeds, 'About Feeds')"/>
<a href="https://aboutfeeds.com/" target="_blank">About Feeds</a> <a href="https://aboutfeeds.com/" target="_blank">About Feeds</a>
<xsl:value-of select="substring-after(/atom:feed/str:translations/str:about_feeds, 'About Feeds')"/> <xsl:value-of select="substring-after(/atom:feed/tabi:metadata/tabi:about_feeds, 'About Feeds')"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="/atom:feed/str:translations/str:about_feeds"/> <xsl:value-of select="/atom:feed/tabi:metadata/tabi:about_feeds"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</div> </div>
@ -45,14 +45,14 @@
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="/atom:feed/@xml:base"/> <xsl:value-of select="/atom:feed/@xml:base"/>
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="/atom:feed/str:translations/str:visit_the_site" />&#160;<span class="arrow"></span> <xsl:value-of select="/atom:feed/tabi:metadata/tabi:visit_the_site" />&#160;<span class="arrow"></span>
</a> </a>
<p></p> <p></p>
</section> </section>
<div class="padding-top listing-title bottom-divider"> <div class="padding-top listing-title bottom-divider">
<h1><xsl:value-of select="/atom:feed/str:translations/str:recent_posts" /></h1> <h1><xsl:value-of select="/atom:feed/tabi:metadata/tabi:recent_posts" /></h1>
</div> </div>
<xsl:variable name="post_listing_date" select="/atom:feed/atom:post_listing_date"/> <xsl:variable name="post_listing_date" select="/atom:feed/tabi:metadata/tabi:post_listing_date"/>
<div class="bloglist-container"> <div class="bloglist-container">
<xsl:for-each select="/atom:feed/atom:entry"> <xsl:for-each select="/atom:feed/atom:entry">
<section class="bloglist-row bottom-divider"> <section class="bloglist-row bottom-divider">
@ -68,13 +68,13 @@
<xsl:if test="$show_date and $show_updated"> <xsl:if test="$show_date and $show_updated">
<li class="mobile-only"> <li class="mobile-only">
<xsl:value-of select="/atom:feed/str:translations/str:separator"/> <xsl:value-of select="/atom:feed/tabi:metadata/tabi:separator"/>
</li> </li>
</xsl:if> </xsl:if>
<xsl:if test="$show_updated"> <xsl:if test="$show_updated">
<li class="date"> <li class="date">
<xsl:variable name="update_string" select="/atom:feed/str:translations/str:last_updated_on"/> <xsl:variable name="update_string" select="/atom:feed/tabi:metadata/tabi:last_updated_on"/>
<xsl:variable name="update_date" select="substring(atom:updated, 0, 11)"/> <xsl:variable name="update_date" select="substring(atom:updated, 0, 11)"/>
<xsl:value-of select="substring-before($update_string, '$DATE')"/> <xsl:value-of select="substring-before($update_string, '$DATE')"/>
<xsl:value-of select="$update_date"/> <xsl:value-of select="$update_date"/>

@ -7,27 +7,30 @@
{%- endif -%} {%- endif -%}
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="{{ get_url(path='/feed_style.xsl', trailing_slash=false) | safe }}" type="text/xsl"?> <?xml-stylesheet href="{{ get_url(path='/feed_style.xsl', trailing_slash=false) | safe }}" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:base="http://purl.org/atompub/base/1.0/" xml:lang="{{ lang }}" xml:base="{{ config.base_url }}"> <feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}" xml:base="{{ config.base_url }}">
<str:translations xmlns:str="https://github.com/welpo/tabi"> <tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
<str:separator> <tabi:separator>
{{ config.extra.separator | default(value="•") }} {{ config.extra.separator | default(value="•") }}
</str:separator> </tabi:separator>
<str:about_feeds> <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) -}} {{- 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) -}}
</str:about_feeds> </tabi:about_feeds>
<str:visit_the_site> <tabi:visit_the_site>
{{- macros_translate::translate(key="visit_the_site", default="Visit website", language_strings=language_strings) -}} {{- macros_translate::translate(key="visit_the_site", default="Visit website", language_strings=language_strings) -}}
</str:visit_the_site> </tabi:visit_the_site>
<str:recent_posts> <tabi:recent_posts>
{{- macros_translate::translate(key="recent_posts", default="Recent posts", language_strings=language_strings) -}} {{- macros_translate::translate(key="recent_posts", default="Recent posts", language_strings=language_strings) -}}
</str:recent_posts> </tabi:recent_posts>
<str:last_updated_on> <tabi:last_updated_on>
{{- macros_translate::translate(key="last_updated_on", default="Updated on $DATE", language_strings=language_strings) -}} {{- macros_translate::translate(key="last_updated_on", default="Updated on $DATE", language_strings=language_strings) -}}
</str:last_updated_on> </tabi:last_updated_on>
<str:default_theme> <tabi:default_theme>
{{- config.extra.default_theme | default(value="") -}} {{- config.extra.default_theme | default(value="") -}}
</str:default_theme> </tabi:default_theme>
</str:translations> <tabi:post_listing_date>
{{- config.extra.post_listing_date | default(value="date") -}}
</tabi:post_listing_date>
</tabi:metadata>
{#- Load extra CSS (skin) if set in config.toml -#} {#- Load extra CSS (skin) if set in config.toml -#}
{%- if config.extra.skin -%} {%- if config.extra.skin -%}
@ -43,14 +46,13 @@
<subtitle>{{ config.description }}</subtitle> <subtitle>{{ config.description }}</subtitle>
{%- endif %} {%- endif %}
<link href="{{ feed_url | safe }}" rel="self" type="application/atom+xml"/> <link href="{{ feed_url | safe }}" rel="self" type="application/atom+xml"/>
<post_listing_date>{{ config.extra.post_listing_date | default(value="date") }}</post_listing_date>
<link href=" <link href="
{%- if section -%} {%- if section -%}
{{ section.permalink | escape_xml | safe }} {{ section.permalink | escape_xml | safe }}
{%- else -%} {%- else -%}
{{ get_url(path="/", lang=lang) | escape_xml | safe }} {{ get_url(path="/", lang=lang) | escape_xml | safe }}
{%- endif -%} {%- endif -%}
"/> " rel="alternate" type="text/html"/>
<generator uri="https://www.getzola.org/">Zola</generator> <generator uri="https://www.getzola.org/">Zola</generator>
<updated>{{ last_updated | date(format="%+") }}</updated> <updated>{{ last_updated | date(format="%+") }}</updated>
<id>{{ feed_url | safe }}</id> <id>{{ feed_url | safe }}</id>

Loading…
Cancel
Save