♻️ refactor: improve stylised feed translations & consolidate XSL/CSS loading (#98)

main
Óscar 2 years ago committed by GitHub
parent 86ab1c5f06
commit 32b1177140
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -21,7 +21,6 @@ default_language = "en"
title = "~/tabi"
description = "tabi es un tema de Zola rápido, liviano y moderno con JavaScript opcional y una puntuación perfecta en Lighthouse."
generate_feed = true
# If you're using feeds, you might want to create/translate the static/feed_style/{lang}.xsl file.
compile_sass = true
minify_html = true
@ -33,7 +32,6 @@ taxonomies = [
title = "~/tabi"
description = "tabi és un tema de Zola ràpid, lleuger i modern amb JavaScript opcional i una puntuació perfecta a Lighthouse."
generate_feed = true
# If you're using feeds, you might want to create/translate the static/feed_style/{lang}.xsl file.
compile_sass = true
minify_html = true
@ -74,6 +72,16 @@ load_comments = "Cargar comentarios"
# Quotation marks for multilingual quote shortcode.
open_quotation_mark = "«"
close_quotation_mark = "»"
# Translations for stylised Atom feed.
this_is_a_web_feed = "Esta es una fuente web"
also_known_as_an_Atom_feed = "también conocida como fuente Atom"
subscribe = "Suscríbete"
by_copying_the_URL_from_the_address_bar_into_your_newsreader = "copiando la URL de la barra de direcciones en tu lector de noticias"
visit = "Visita"
to_learn_more_and_get_started = "para aprender más y empezar"
it_s_free = "Es gratis"
website = "la web"
recent_posts = "Publicaciones recientes"
[languages.ca.translations]
language_name = "Català"
@ -108,6 +116,16 @@ load_comments = "Carregar comentaris"
# Quotation marks for multilingual quote shortcode.
open_quotation_mark = "«"
close_quotation_mark = "»"
# Translations for stylised Atom feed.
this_is_a_web_feed = "Aquest és un canal web"
also_known_as_an_Atom_feed = "també conegut com a canal Atom"
subscribe = "Subscriu-te"
by_copying_the_URL_from_the_address_bar_into_your_newsreader = "copiant l'URL de la barra d'adreces al teu lector de notícies"
visit = "Visita"
to_learn_more_and_get_started = "per aprendre més i començar"
it_s_free = "És gratuït"
website = "la web"
recent_posts = "Publicacions recents"
[extra]

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom">
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:base="http://purl.org/atompub/base/1.0/" xmlns:str="https://github.com/welpo/tabi">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
@ -11,15 +11,13 @@
<meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!-- Fallback for languages without their own .xsl -->
<link rel="stylesheet" href="../main.css"/>
<link rel="stylesheet" href="/main.css"/>
<link rel="stylesheet" href="{/atom:feed/@base:base}/main.css"/>
</head>
<body>
<div class="content">
<main>
<div class="info-box">
<strong>This is a web feed</strong>, also known as an Atom feed. <strong>Subscribe</strong> by copying the URL from the address bar into your newsreader. Visit <a href="https://aboutfeeds.com">About Feeds</a> to learn more and get started. Its free.
<strong><xsl:value-of select="/atom:feed/str:translations/str:this_is_a_web_feed" /></strong>, <xsl:value-of select="/atom:feed/str:translations/str:also_known_as_an_Atom_feed" />. <strong><xsl:value-of select="/atom:feed/str:translations/str:subscribe" /></strong> <xsl:text> </xsl:text><xsl:value-of select="/atom:feed/str:translations/str:by_copying_the_URL_from_the_address_bar_into_your_newsreader" />.<xsl:text> </xsl:text><xsl:value-of select="/atom:feed/str:translations/str:visit" /><xsl:text> </xsl:text><a href="https://aboutfeeds.com">About Feeds</a><xsl:text> </xsl:text><xsl:value-of select="/atom:feed/str:translations/str:to_learn_more_and_get_started" />.<xsl:text> </xsl:text><xsl:value-of select="/atom:feed/str:translations/str:it_s_free" />.
</div>
<section id="banner-home-subtitle">
<div class="padding-top home-title">
@ -32,11 +30,11 @@
<xsl:attribute name="href">
<xsl:value-of select="/atom:feed/atom:link[2]/@href"/>
</xsl:attribute>
Visit Website → </a><p></p>
<xsl:value-of select="/atom:feed/str:translations/str:visit" /><xsl:text> </xsl:text><xsl:value-of select="/atom:feed/str:translations/str:website" /><xsl:text> </xsl:text></a><p></p>
</section>
<div class="padding-top listing-title bottom-divider">
<h1>Recent Posts</h1>
<h1><xsl:value-of select="/atom:feed/str:translations/str:recent_posts" /></h1>
</div>
<div class="bloglist-container">
<xsl:for-each select="/atom:feed/atom:entry">

@ -1,71 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ca">
<head>
<title>
<xsl:value-of select="/atom:feed/atom:title"/> • Canal Atom
</title>
<meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="../main.css"/>
</head>
<body>
<div class="content">
<main>
<div class="info-box">
<strong>Aquest és un canal web</strong>, també conegut com a canal Atom. <strong>Subscriu-te</strong> copiant l'URL de la barra d'adreces al teu lector de notícies. Visita <a href="https://aboutfeeds.com">Sobre Feeds</a> (en anglès) per aprendre més i començar. És gratuït.
</div>
<section id="banner-home-subtitle">
<div class="padding-top home-title">
<xsl:value-of select="/atom:feed/atom:title"/>
</div>
<p>
<xsl:value-of select="/atom:feed/atom:subtitle"/>
</p>
<a class="readmore">
<xsl:attribute name="href">
<xsl:value-of select="/atom:feed/atom:link[2]/@href"/>
</xsl:attribute>
Visita la web → </a><p></p>
</section>
<div class="padding-top listing-title bottom-divider">
<h1>Publicacions recents</h1>
</div>
<div class="bloglist-container">
<xsl:for-each select="/atom:feed/atom:entry">
<section class="bloglist-row bottom-divider">
<div class="date">
<xsl:value-of select="substring(atom:published, 0, 11)"/>
</div>
<div class="bloglist-content">
<div class="bloglist-title">
<a>
<xsl:attribute name="href">
<xsl:value-of select="atom:link/@href"/>
</xsl:attribute>
<xsl:value-of select="atom:title"/>
</a>
</div>
<div class="description">
<xsl:value-of select="atom:summary"/>
</div>
<a class="readmore" href="">
<xsl:attribute name="href">
<xsl:value-of select="atom:link/@href"/>
</xsl:attribute>
</a>
</div>
</section>
</xsl:for-each>
</div>
</main>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

@ -1,71 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="es">
<head>
<title>
<xsl:value-of select="/atom:feed/atom:title"/> • Canal Atom
</title>
<meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="../main.css"/>
</head>
<body>
<div class="content">
<main>
<div class="info-box">
<strong>Esta es una fuente web</strong>, también conocida como fuente Atom. <strong>Suscríbete</strong> copiando la URL de la barra de direcciones en tu lector de noticias. Visita <a href="https://aboutfeeds.com">Acerca de Feeds</a> (en inglés) para aprender más y empezar. Es gratis.
</div>
<section id="banner-home-subtitle">
<div class="padding-top home-title">
<xsl:value-of select="/atom:feed/atom:title"/>
</div>
<p>
<xsl:value-of select="/atom:feed/atom:subtitle"/>
</p>
<a class="readmore">
<xsl:attribute name="href">
<xsl:value-of select="/atom:feed/atom:link[2]/@href"/>
</xsl:attribute>
Visita la web → </a><p></p>
</section>
<div class="padding-top listing-title bottom-divider">
<h1>Publicaciones recientes</h1>
</div>
<div class="bloglist-container">
<xsl:for-each select="/atom:feed/atom:entry">
<section class="bloglist-row bottom-divider">
<div class="date">
<xsl:value-of select="substring(atom:published, 0, 11)"/>
</div>
<div class="bloglist-content">
<div class="bloglist-title">
<a>
<xsl:attribute name="href">
<xsl:value-of select="atom:link/@href"/>
</xsl:attribute>
<xsl:value-of select="atom:title"/>
</a>
</div>
<div class="description">
<xsl:value-of select="atom:summary"/>
</div>
<a class="readmore" href="">
<xsl:attribute name="href">
<xsl:value-of select="atom:link/@href"/>
</xsl:attribute>
</a>
</div>
</section>
</xsl:for-each>
</div>
</main>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

@ -1,9 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Load the default stylesheet (English) first, as fallback. -->
<?xml-stylesheet href="{{ get_url(path='/feed_style/en.xsl', trailing_slash=false) | safe }}" type="text/xsl"?>
<?xml-stylesheet href="{{ get_url(path='/feed_style/' ~ lang ~ '.xsl', trailing_slash=false) | safe }}" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}">
<title>{{ config.title }}
<?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 }}">
{# This section stores the strings/translations for the stylised feed. If the translation is not found, the default English text will be used. #}
<str:translations xmlns:str="https://github.com/welpo/tabi">
<str:this_is_a_web_feed>
{%- if lang != config.default_language -%} {{ trans(key="this_is_a_web_feed" | safe, lang=lang) }} {%- else -%} This is a web feed {%- endif -%}
</str:this_is_a_web_feed>
<str:also_known_as_an_Atom_feed>
{%- if lang != config.default_language -%} {{ trans(key="also_known_as_an_Atom_feed" | safe, lang=lang) }} {%- else -%} also known as an Atom feed {%- endif -%}
</str:also_known_as_an_Atom_feed>
<str:subscribe>
{%- if lang != config.default_language -%} {{ trans(key="subscribe" | safe, lang=lang) }} {%- else -%} Subscribe {%- endif -%}
</str:subscribe>
<str:by_copying_the_URL_from_the_address_bar_into_your_newsreader>
{%- if lang != config.default_language -%} {{ trans(key="by_copying_the_URL_from_the_address_bar_into_your_newsreader" | safe, lang=lang) }} {%- else -%} by copying the URL from the address bar into your newsreader {%- endif -%}
</str:by_copying_the_URL_from_the_address_bar_into_your_newsreader>
<str:visit>
{%- if lang != config.default_language -%} {{ trans(key="visit" | safe, lang=lang) }} {%- else -%} Visit {%- endif -%}
</str:visit>
<str:to_learn_more_and_get_started>
{%- if lang != config.default_language -%} {{ trans(key="to_learn_more_and_get_started" | safe, lang=lang) }} {%- else -%} to learn more and get started {%- endif -%}
</str:to_learn_more_and_get_started>
<str:it_s_free>
{%- if lang != config.default_language -%} {{ trans(key="it_s_free" | safe, lang=lang) }} {%- else -%} It's free {%- endif -%}
</str:it_s_free>
<str:website>
{%- if lang != config.default_language -%} {{ trans(key="website" | safe, lang=lang) }} {%- else -%} website {%- endif -%}
</str:website>
<str:recent_posts>
{%- if lang != config.default_language -%} {{ trans(key="recent_posts" | safe, lang=lang) }} {%- else -%} Recent posts {%- endif -%}
</str:recent_posts>
</str:translations>
<title>{{ config.title | striptags | safe }}
{%- if term %} - {{ term.name }}
{%- elif section.title %} - {{ section.title }}
{%- endif -%}

Loading…
Cancel
Save