11ty / eleventy-plugin-rss

A pack of Eleventy plugins for generating an RSS feed.
https://www.11ty.dev/docs/plugins/rss/
MIT License
92 stars 22 forks source link

Relative anchor links not resolving to absolute URLs #20

Closed ambrwlsn closed 3 years ago

ambrwlsn commented 3 years ago

Edit:

I use NewNewsWire rss reader, which resolves [next section](#example-app) to https://amberwilson.co.uk/rss.xml#example-app 🤦🏻‍♀️

I tried InoReader rss reader, and this one resolves [next section](#example-app) to https://amberwilson.co.uk/#example-app.

It sucks that link resolution depends on the rss reader. But what you gonna do?

Problem: In my markdown file - [next section](#example-app) resolves to https://amberwilson.co.uk/rss.xml#example-app

Cause: https://github.com/11ty/eleventy-plugin-rss/blob/a62d9dfbb32ce2f6b39568062c437e7d2b8631fa/src/htmlToAbsoluteUrls.js#L14

Is there an explanation for why anchor links are exlcuded from this function?

Currently, I am running the plugin locally so I can avoid this issue. If I remove line 14-17 in the above linked file, I get my solution.

Solution: Remove L14-17 in https://github.com/11ty/eleventy-plugin-rss/blob/a62d9dfbb32ce2f6b39568062c437e7d2b8631fa/src/htmlToAbsoluteUrls.js

Result: In my markdown file - [next section](#example-app) resolves to https://amberwilson.co.uk/blog/#example-app

zachleat commented 3 years ago

Hmm. Good question. This was a bit ago but I would guess it was so that anchor links inside the post would work anchor on the page inside of different readers. Looks like that’s a bad assumption.

I did test Feedbin just now and they transform the anchor links to include my domain so I’m going to just fix this wholesale.