We've observed an inconsistent behavior in the generation of Atom feed links, specifically regarding the construction of the href attribute for the visit_the_site link. The issue arises depending on the skin variable's value in the config.toml file. When the skin variable is not set (i.e., left as an empty string ""), the XPath expression /atom:feed/atom:link[2]/@href successfully retrieves the intended URL stored in config.base_url. However, when the skin variable is initialized with a value (e.g., "red"), the mentioned XPath expression fails to function as intended, leading to incorrect href values in the generated Atom feed.
This behavior suggests that the insertion of an additional <link> element related to the skin configuration alters the document structure, affecting the index-based XPath selection.
Changes
To address this variability and ensure a more stable and reliable generation of the visit_the_site link, irrespective of the skin configuration or any other dynamic content that might affect the <link> elements order, we propose to directly use the /atom:feed/@xml:base XPath expression. This expression directly targets the xml:base attribute of the <feed> element, which consistently contains the config.base_url value.
This solution offers a more robust approach to determining the href attribute for the visit_the_site link, as it does not rely on the specific order or presence of <link> elements within the Atom feed. It ensures that the link always correctly points to the base URL as defined in the site's configuration, regardless of any changes to other parts of the feed structure.
The suggested change involves modifying the XSL transformation used to generate the Atom feed's HTML representation. Specifically, we will replace the /atom:feed/atom:link[2]/@href expression with /atom:feed/@xml:base for setting the href attribute of the visit_the_site link.
Type of change
[x] Bug fix (fixes an issue without altering functionality)
Summary
We've observed an inconsistent behavior in the generation of Atom feed links, specifically regarding the construction of the
href
attribute for thevisit_the_site
link. The issue arises depending on theskin
variable's value in theconfig.toml
file. When theskin
variable is not set (i.e., left as an empty string ""), the XPath expression/atom:feed/atom:link[2]/@href
successfully retrieves the intended URL stored inconfig.base_url
. However, when theskin
variable is initialized with a value (e.g., "red"), the mentioned XPath expression fails to function as intended, leading to incorrecthref
values in the generated Atom feed.This behavior suggests that the insertion of an additional
<link>
element related to the skin configuration alters the document structure, affecting the index-based XPath selection.Changes
To address this variability and ensure a more stable and reliable generation of the
visit_the_site
link, irrespective of theskin
configuration or any other dynamic content that might affect the<link>
elements order, we propose to directly use the/atom:feed/@xml:base
XPath expression. This expression directly targets thexml:base
attribute of the<feed>
element, which consistently contains theconfig.base_url
value.This solution offers a more robust approach to determining the
href
attribute for thevisit_the_site link
, as it does not rely on the specific order or presence of<link>
elements within the Atom feed. It ensures that the link always correctly points to the base URL as defined in the site's configuration, regardless of any changes to other parts of the feed structure.The suggested change involves modifying the XSL transformation used to generate the Atom feed's HTML representation. Specifically, we will replace the
/atom:feed/atom:link[2]/@href
expression with/atom:feed/@xml:base
for setting thehref
attribute of thevisit_the_site link
.Type of change
Checklist
theme.toml
with a sane default for the featureconfig.toml
commentstheme.toml
comments