Created
May 12, 2019 12:35
-
-
Save uliwitness/99a8072f6e940c4714cfc01b0e1a8abb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jekyll | |
class PageVariationsGenerator < Generator | |
safe true | |
def generate(site) | |
pagesCopy = site.pages.dup | |
site.config['pagevariations'].each_entry do |variation| | |
pagesCopy.each_entry do |page| | |
pageCopy = page.dup | |
oldPermalink = pageCopy.data['permalink'] | |
pageCopy.data['permalink'] = oldPermalink[".html"] = variation + ".htm" | |
site.pages << pageCopy | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment