From 6eeae61d54a0b0a8483f170bc5e4b879f4e59661 Mon Sep 17 00:00:00 2001 From: Holly Cummins Date: Mon, 2 Sep 2024 21:29:13 +0100 Subject: [PATCH] Initial migration layout --- _config.yml | 9 ++++ _layouts/migration-guide.html | 83 +++++++++++++++++++++++++++++++++++ migrations.html | 14 ++++++ 3 files changed, 106 insertions(+) create mode 100644 _layouts/migration-guide.html create mode 100644 migrations.html diff --git a/_config.yml b/_config.yml index 1242e93e29..9acc7ca3d0 100755 --- a/_config.yml +++ b/_config.yml @@ -78,6 +78,9 @@ collections: versions: output: true permalink: /version/:path + migrations: + output: true + permalink: /migration/:path # Exclude from processing. # The following items will not be processed, by default. Create a custom list @@ -122,6 +125,12 @@ defaults: type: "posts" values: permalink: /blog/:title/ + - + scope: + type: "migrations" + values: + layout: migration-guide + toc: true - scope: type: redirects diff --git a/_layouts/migration-guide.html b/_layouts/migration-guide.html new file mode 100644 index 0000000000..7438449583 --- /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' %} + +
+ +
+ +
+
+
+ {% if docversion == 'latest' or docversion == 'main' %} + {{site.data.guides.texts.edit_this_page}} + {% endif %} +

{{page.title}} {{page.docversion}}

+ {{ content }} +
+
+
{{ page.document | tocify_asciidoc }}
+
+
+ {% if relations and relations[guide_url] -%} +

{{site.data.guides.texts.related_content}}

+
+ {% if relations[guide_url].sameExtensions -%} +
+

{{site.data.guides.texts.on_the_same_extensions}}

+ +
+ {% endif -%} + {% if relations[guide_url].sameTopics -%} +
+

{{site.data.guides.texts.on_the_same_topics}}

+ +
+ {% endif -%} +
+ {% endif -%} +
diff --git a/migrations.html b/migrations.html new file mode 100644 index 0000000000..c54cfb05bc --- /dev/null +++ b/migrations.html @@ -0,0 +1,14 @@ +--- +layout: base +--- + +

Migration Guides

+ +{% assign doclist = site.migrations %} + +