From 52979f7f5439e486377a36d3d6be806b51ced58f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar?= Date: Fri, 20 Sep 2024 01:44:32 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(feed):=20resolve=20Atom=20fe?= =?UTF-8?q?ed=20validation=20issues=20(#393)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/feed_style.xsl | 22 +++++++++++----------- templates/atom.xml | 36 +++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/static/feed_style.xsl b/static/feed_style.xsl index 75835c7..187c131 100644 --- a/static/feed_style.xsl +++ b/static/feed_style.xsl @@ -1,11 +1,11 @@ + xmlns:atom="http://www.w3.org/2005/Atom" xmlns:tabi="https://github.com/welpo/tabi"> - + @@ -24,13 +24,13 @@ <div class="info-box"> <!-- This block replaces the text "About Feeds" with a hyperlink in the translated string --> <xsl:choose> - <xsl:when test="contains(/atom:feed/str:translations/str:about_feeds, 'About Feeds')"> - <xsl:value-of select="substring-before(/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/tabi:metadata/tabi:about_feeds, 'About Feeds')"/> <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: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:choose> </div> @@ -45,14 +45,14 @@ <xsl:attribute name="href"> <xsl:value-of select="/atom:feed/@xml:base"/> </xsl:attribute> - <xsl:value-of select="/atom:feed/str:translations/str:visit_the_site" /> <span class="arrow">→</span> + <xsl:value-of select="/atom:feed/tabi:metadata/tabi:visit_the_site" /> <span class="arrow">→</span> </a> <p></p> </section> <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> - <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"> <xsl:for-each select="/atom:feed/atom:entry"> <section class="bloglist-row bottom-divider"> @@ -68,13 +68,13 @@ <xsl:if test="$show_date and $show_updated"> <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> </xsl:if> <xsl:if test="$show_updated"> <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:value-of select="substring-before($update_string, '$DATE')"/> <xsl:value-of select="$update_date"/> diff --git a/templates/atom.xml b/templates/atom.xml index 933e7d8..a5135b4 100644 --- a/templates/atom.xml +++ b/templates/atom.xml @@ -7,27 +7,30 @@ {%- 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" xmlns:base="http://purl.org/atompub/base/1.0/" xml:lang="{{ lang }}" xml:base="{{ config.base_url }}"> - <str:translations xmlns:str="https://github.com/welpo/tabi"> - <str:separator> +<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}" xml:base="{{ config.base_url }}"> + <tabi:metadata xmlns:tabi="https://github.com/welpo/tabi"> + <tabi:separator> {{ config.extra.separator | default(value="•") }} - </str:separator> - <str:about_feeds> + </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) -}} - </str:about_feeds> - <str:visit_the_site> + </tabi:about_feeds> + <tabi:visit_the_site> {{- macros_translate::translate(key="visit_the_site", default="Visit website", language_strings=language_strings) -}} - </str:visit_the_site> - <str:recent_posts> + </tabi:visit_the_site> + <tabi:recent_posts> {{- macros_translate::translate(key="recent_posts", default="Recent posts", language_strings=language_strings) -}} - </str:recent_posts> - <str:last_updated_on> + </tabi:recent_posts> + <tabi:last_updated_on> {{- macros_translate::translate(key="last_updated_on", default="Updated on $DATE", language_strings=language_strings) -}} - </str:last_updated_on> - <str:default_theme> + </tabi:last_updated_on> + <tabi:default_theme> {{- config.extra.default_theme | default(value="") -}} - </str:default_theme> - </str:translations> + </tabi:default_theme> + <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 -#} {%- if config.extra.skin -%} @@ -43,14 +46,13 @@ <subtitle>{{ config.description }}</subtitle> {%- endif %} <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=" {%- if 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> <updated>{{ last_updated | date(format="%+") }}</updated> <id>{{ feed_url | safe }}</id>