-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Guillaume's suggested versioning scheme, migration-guides/3.16
- Loading branch information
1 parent
6eeae61
commit b902de0
Showing
5 changed files
with
55 additions
and
16 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module VersionPermalink | ||
class VersionPermalink < Jekyll::Generator | ||
safe true | ||
priority :low | ||
|
||
def generate(site) | ||
# fill in version information from the filename | ||
collection = site.collections["migrations"] | ||
collection.docs.each { |doc| | ||
data = doc.data | ||
reg_str = data["version_regex"] | ||
repl_str = "" | ||
re = Regexp.new reg_str | ||
|
||
# This will be returned | ||
puts "got regex" | ||
version = data["slug"].gsub re, repl_str | ||
puts doc.data["version_regex"] | ||
doc.data.merge!('version' => version) | ||
|
||
} | ||
end | ||
|
||
Jekyll::Hooks.register :migrations, :pre_render do |doc| | ||
begin | ||
# check if jekyll can resolve the url template | ||
doc.url | ||
rescue NoMethodError => error | ||
begin | ||
def doc.url_template | ||
custom_permalink_placeholders = ["version"] | ||
@custom_url_template ||= custom_permalink_placeholders.inject(collection.url_template) { |o, m| o.sub ":" + m, version.to_s } | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
layout: base | ||
--- | ||
|
||
<h1>Migration Guides</h1> | ||
|
||
{% assign doclist = site.migrations %} | ||
<ul> | ||
{% for doc in doclist %} | ||
<li><a href="{{ site.baseurl }}{{ doc.url }}">{{ doc.version }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
|
This file was deleted.
Oops, something went wrong.