Created
June 11, 2017 03:25
-
-
Save zmoazeni/4241c4908cb3f9ced40482e100560b6c 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 VersionedPage < Page | |
def initialize(site, base, dir, version, post) | |
@site = site | |
@base = base | |
@dir = dir | |
@name = "#{version}/#{post.url}#{post.data["ext"]}" | |
process(@name) | |
self.content = post.content | |
self.data = post.data | |
self.data["layout"] = "#{version}/post" | |
end | |
end | |
class VersionGenerator < Generator | |
VERSIONS = ["v2013"] | |
def generate(site) | |
VERSIONS.each do |version| | |
site.posts.docs.each do |post| | |
site.pages << VersionedPage.new(site, site.source, "", version, post) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment