juusaw / amp-jekyll

Build Accelerated Mobile Page versions of your Jekyll posts
MIT License
281 stars 59 forks source link

Uses master post and URL to set @url and @name. #39

Open njpearman opened 6 years ago

njpearman commented 6 years ago

Hi. I've been using your amp-jekyll plugin on a blog, but I've had a problem when using it with the jekyll-sitemap plugin. The AMP files were added to the sitemap, but the .html extension for the generated AMP posts was excluded, meaning the sitemap links where broken. This is because the jekyll-sitemap plugin uses Jekyll::Page#url to output the <loc> of each post in the generated sitemap, and amp-jekyll overrides @url with dir, which doesn't include the extension.

I've made this change, which uses the Jekyll::URL class to set @url in the Jekyll::AmpPage constructor. This fixes my problem above. I don't know whether this negatively impacts things elsewhere though... :S

Does this work as a general enhancement to amp-jekyll? I can tidy up the changes, such as constructor args if it does.