webmasterish / vuepress-plugin-feed

RSS, Atom, and JSON feeds generator plugin for VuePress 1.x
MIT License
48 stars 13 forks source link

Allow canonical_base to contain a path #10

Closed florimondmanca closed 4 years ago

florimondmanca commented 4 years ago

Hey,

Thanks for putting this other VuePress plugin together!

While integrating with my blog, I encountered the same issue than in https://github.com/webmasterish/vuepress-plugin-autometa/pull/6, i.e. if canonical_base contains a path, e.g. https://example.com/blog, then the path part of the URL isn't present in URLs rendered by the plugin. In particular, URLs of feed items don't contain the path prefix.

The fix is the same: use a custom resolve_url() helper instead of URL.resolve(). :-)

florimondmanca commented 4 years ago

After installing from this commit:

$ yarn add -D "florimondmanca/vuepress-plugin-feed#893e9f57dc4a7d242faaaa0bef91cf11a127624b"

I can confirm that the path prefix is added correctly, e.g. this test from https://github.com/florimondmanca/www/pull/24 passes:

https://github.com/florimondmanca/www/blob/d219736eaf2869dc6231959916433f14fd72b62e/tests/test_blog.py#L61-L72

The last assert there used to fail because the generated URL was https://florimond.dev/feed.rss (note it did not contain /blog).

webmasterish commented 4 years ago

Thanks again @florimondmanca for your contribution!