Skip to content

Commit

Permalink
✨ feat(feed): make "Visit website" link context-aware (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
welpo authored Sep 19, 2024
1 parent 52979f7 commit adfe28e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
9 changes: 7 additions & 2 deletions static/feed_style.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@
</p>
<a class="readmore">
<xsl:attribute name="href">
<xsl:value-of select="/atom:feed/@xml:base"/>
<xsl:value-of select="/atom:feed/atom:link[@rel='alternate']/@href"/>
</xsl:attribute>
<xsl:value-of select="/atom:feed/tabi:metadata/tabi:visit_the_site" />&#160;<span class="arrow">→</span>
<xsl:value-of select="/atom:feed/tabi:metadata/tabi:visit_the_site" />
<xsl:if test="/atom:feed/tabi:metadata/tabi:current_section != /atom:feed/atom:title">
<xsl:text>: </xsl:text>
<xsl:value-of select="/atom:feed/tabi:metadata/tabi:current_section" />
</xsl:if>
<span class="arrow"> →</span>
</a>
<p></p>
</section>
Expand Down
15 changes: 13 additions & 2 deletions templates/atom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{%- 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 }}" xml:base="{{ config.base_url }}">
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}">
<tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
<tabi:separator>
{{ config.extra.separator | default(value="•") }}
Expand All @@ -30,6 +30,15 @@
<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 -#}
Expand All @@ -47,7 +56,9 @@
{%- endif %}
<link href="{{ feed_url | safe }}" rel="self" type="application/atom+xml"/>
<link href="
{%- if section -%}
{%- if term -%}
{{ term.permalink | escape_xml | safe }}
{%- elif section -%}
{{ section.permalink | escape_xml | safe }}
{%- else -%}
{{ get_url(path="/", lang=lang) | escape_xml | safe }}
Expand Down

0 comments on commit adfe28e

Please sign in to comment.