The problem#
In an RSS/Atom feed, relative links are a bad idea
because it's unclear what they're relative to. There are ways to specify
a base for them to be relative to, but since feed readers
do not consistently respect those mechanisms, it's
safer to just always use absolute URLs in feeds. And Pelican
recommends setting RELATIVE_URLS = False
to always
generate absolute URLs. But that setting does not apply to the anchor
links generated by the Markdown toc extension to link to
headers.
The solution#
I wrote a Pelican plugin, absolute_anchors
which
rewrites all link destinations starting with #
in every article to add
the absolute URL of the article at the beginning of the link.