Link changelog feed items to anchor links on the changelog pages

This commit is contained in:
Helen Chong 2025-03-19 11:28:54 +08:00
parent eecd07ac95
commit 46ff1182be
2 changed files with 17 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
date: 2025-03-19T11:28:25+0800
---
* In the website's RSS feed, changelog items are now linked to its anchor links on the corresponding year's changelog page, instead of the website's home page.

View File

@ -20,11 +20,21 @@ eleventyComputed:
</author>
{%- for item in collections["feed items"] | reverse | itemLimit(15) %}
{% set absolutePostUrl %}{{ item.url | absoluteUrl(feedMeta.baseUrl) }}{% endset %}
{% set absoluteChangelogUrl %}{{ feedMeta.baseUrl }}changelogs/{{ item.fileSlug.substring(0, 4) }}/#{{ item.fileSlug }}{% endset %}
{% set absoluteItemUrl %}
{% if item.data.tags.includes("changelogs") %}
{{ absoluteChangelogUrl }}
{% else %}
{{ absolutePostUrl }}
{% endif %}
{% endset %}
<entry>
<title>{{ item.data.title | safe }}</title>
<link href="{{ feedMeta.baseUrl if absolutePostUrl.includes("false") else absolutePostUrl }}"/>
<link href="{{ absoluteItemUrl }}"/>
<updated>{{ item.date | dateToRfc3339 }}</updated>
<id>{{ feedMeta.baseUrl if absolutePostUrl.includes("false") else absolutePostUrl }}</id>
<id>{{ absoluteItemUrl }}</id>
<content type="html">{{ item.content | renderTransforms(item.data.page, feedMeta.baseUrl) }}</content>
</entry>
{%- endfor %}