forked from deepStateMirrors/tabi
🐛 fix(feed): styling now works in all website paths
The feed's stylesheet now uses the base URL from Zola's configuration, ensuring correct stylesheet loading in all contexts (root path, subdirectories, and subdomains). Previously, the stylesheet URLs could break when feeds were in subdirectories.
This commit is contained in:
parent
402965786b
commit
45fe170467
2 changed files with 3 additions and 7 deletions
|
@ -14,13 +14,8 @@
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
<!-- The base URL is assumed to be the first URL in the sitemap. -->
|
<xsl:variable name="baseUrl" select="/atom:feed/tabi:metadata/tabi:base_url"/>
|
||||||
<xsl:variable name="baseUrl" select="(sitemap:urlset/sitemap:url)[1]/sitemap:loc"/>
|
<link rel="stylesheet" href="{$baseUrl}/main.css"/>
|
||||||
<!-- Remove http[s]:// -->
|
|
||||||
<xsl:variable name="baseUrlWithoutProtocol" select="substring-after($baseUrl, '://')"/>
|
|
||||||
<!-- Remove trailing slash -->
|
|
||||||
<xsl:variable name="clean_base_url" select="substring-before($baseUrlWithoutProtocol, '/')"/>
|
|
||||||
<link rel="stylesheet" href="{$baseUrl}main.css"/>
|
|
||||||
<link rel="stylesheet" href="{/atom:feed/atom:link[@rel='extra-stylesheet']/@href}" />
|
<link rel="stylesheet" href="{/atom:feed/atom:link[@rel='extra-stylesheet']/@href}" />
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<?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" xml:lang="{{ lang }}">
|
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}">
|
||||||
<tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
|
<tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
|
||||||
|
<tabi:base_url>{{ config.base_url }}</tabi:base_url>
|
||||||
<tabi:separator>
|
<tabi:separator>
|
||||||
{{ config.extra.separator | default(value="•") }}
|
{{ config.extra.separator | default(value="•") }}
|
||||||
</tabi:separator>
|
</tabi:separator>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue