Skip to content

Commit

Permalink
Use canonicalUrl filter in Atom feed (#272)
Browse files Browse the repository at this point in the history
Switching to using the custom `canonicalUrl` filter defined in this plugin rather than the `absoluteUrl` filter defined in the `eleventy-plugin-rss` plugin, so the URLs will include any `pathPrefix` defined in the Eleventy config.
  • Loading branch information
frankieroberto authored Apr 22, 2024
1 parent d8bfa15 commit 6e48d64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions layouts/feed.njk
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ options.url }}">
<title>{{ options.homeKey }}</title>
<link href="{{ permalink | absoluteUrl(options.url) }}" rel="self"/>
<link href="{{ permalink | canonicalUrl }}" rel="self"/>
<link href="{{ options.url }}"/>
<updated>{{ collections.post | getNewestCollectionItemDate | dateToRfc3339 }}</updated>
<id>{{ options.url }}/</id>
{%- for item in pagination.items %}
{%- set absolutePostUrl = item.url | absoluteUrl(options.url) %}
{%- set absolutePostUrl = item.url | canonicalUrl %}
<entry>
<title>{{ item.data.title }}</title>
<link href="{{ absolutePostUrl }}"/>
Expand Down

0 comments on commit 6e48d64

Please sign in to comment.