diff --git a/_config.yml b/_config.yml index 1242e93e292..194e6599d6b 100755 --- a/_config.yml +++ b/_config.yml @@ -78,6 +78,9 @@ collections: versions: output: true permalink: /version/:path + migrations: + output: true + permalink: /migration-guides/:version # Exclude from processing. # The following items will not be processed, by default. Create a custom list @@ -122,6 +125,14 @@ defaults: type: "posts" values: permalink: /blog/:title/ + - + scope: + type: "migrations" + values: + layout: migration-guide + toc: true + version_regex: "Migration-Guide-" + # permalink needs be defined above, with the collection definition - scope: type: redirects diff --git a/_layouts/migration-guide.html b/_layouts/migration-guide.html new file mode 100644 index 00000000000..4138bf4506e --- /dev/null +++ b/_layouts/migration-guide.html @@ -0,0 +1,83 @@ +--- +layout: base +--- +{% assign versioned_page = page.url | startswith: '/version/' %} +{% if versioned_page %} +{% assign docversion = page.url | replace_regex: '^/version/([^/]+)/.*', '\1' %} +{% else %} +{% assign docversion = 'latest' %} +{% endif %} +{% assign docversion_index = docversion | replace: '.', '-' %} +{% comment %} +'page.path' pattern is different depending on the version +- "Main - SNAPSHOT" -> _versions/main/guides/*.adoc +- "x.x.x - Latest" -> _guides/*.adoc +=> to extract the page filename you need two different replacement tokens +{% endcomment %} +{% assign page_filename = page.path | replace: '_migrations/', '' %} +{% assign relations = site.data.versioned[docversion_index].index.relations %} +{% assign guide_url = page.url | replace_regex: '^/version/[^/]+(/.*)', '\1' %} + +
+ +