Skip to content

Commit 6eeae61

Browse files
committed
Initial migration layout
1 parent 5ad2c6c commit 6eeae61

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed

_config.yml

+9
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ collections:
7878
versions:
7979
output: true
8080
permalink: /version/:path
81+
migrations:
82+
output: true
83+
permalink: /migration/:path
8184

8285
# Exclude from processing.
8386
# The following items will not be processed, by default. Create a custom list
@@ -122,6 +125,12 @@ defaults:
122125
type: "posts"
123126
values:
124127
permalink: /blog/:title/
128+
-
129+
scope:
130+
type: "migrations"
131+
values:
132+
layout: migration-guide
133+
toc: true
125134
-
126135
scope:
127136
type: redirects

_layouts/migration-guide.html

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
layout: base
3+
---
4+
{% assign versioned_page = page.url | startswith: '/version/' %}
5+
{% if versioned_page %}
6+
{% assign docversion = page.url | replace_regex: '^/version/([^/]+)/.*', '\1' %}
7+
{% else %}
8+
{% assign docversion = 'latest' %}
9+
{% endif %}
10+
{% assign docversion_index = docversion | replace: '.', '-' %}
11+
{% comment %}
12+
'page.path' pattern is different depending on the version
13+
- "Main - SNAPSHOT" -> _versions/main/guides/*.adoc
14+
- "x.x.x - Latest" -> _guides/*.adoc
15+
=> to extract the page filename you need two different replacement tokens
16+
{% endcomment %}
17+
{% assign page_filename = page.path | replace: '_migrations/', '' %}
18+
{% assign relations = site.data.versioned[docversion_index].index.relations %}
19+
{% assign guide_url = page.url | replace_regex: '^/version/[^/]+(/.*)', '\1' %}
20+
21+
<section class="full-width-version-bg flexfilterbar guides">
22+
<div class="guideflexcontainer">
23+
<div class="docslink">
24+
<a class="returnlink" href="{{site.baseurl}}/migrations/"> Back to Migration Guides</a>
25+
</div>
26+
</div>
27+
</section>
28+
29+
<div class="guide">
30+
<div class="grid-wrapper">
31+
<div class="grid__item width-8-12 width-12-12-m">
32+
{% if docversion == 'latest' or docversion == 'main' %}
33+
<a class="editlink" href="https://github.com/quarkusio/quarkusio.github.io/edit/main/_migrations/{{ page_filename }}">{{site.data.guides.texts.edit_this_page}}</a>
34+
{% endif %}
35+
<h1 class="text-caps">{{page.title}} {{page.docversion}}</h1>
36+
{{ content }}
37+
</div>
38+
<div class="grid__item width-4-12 width-12-12-m tocwrapper">
39+
<div class="hide-mobile toc">{{ page.document | tocify_asciidoc }}</div>
40+
</div>
41+
</div>
42+
{% if relations and relations[guide_url] -%}
43+
<h2>{{site.data.guides.texts.related_content}}</h2>
44+
<div class="grid-wrapper relations">
45+
{% if relations[guide_url].sameExtensions -%}
46+
<div class="grid__item width-6-12 width-12-12-m">
47+
<h3>{{site.data.guides.texts.on_the_same_extensions}}</h3>
48+
<ul class="related-content">
49+
{% for guide in relations[guide_url].sameExtensions -%}
50+
{% assign is_external_guide = guide.url | startswith: 'http' %}
51+
{% if is_external_guide %}
52+
{% assign related_guide_url = include.url %}
53+
{% elsif docversion == 'latest' %}
54+
{% assign related_guide_url = site.baseurl | append: guide.url %}
55+
{% else %}
56+
{% assign related_guide_url = site.baseurl | append: '/version/' | append: docversion | append: guide.url %}
57+
{% endif %}
58+
<li class="{{ guide.type }}"><a href="{{ related_guide_url }}">{{ guide.title }}</a></li>
59+
{% endfor -%}
60+
</ul>
61+
</div>
62+
{% endif -%}
63+
{% if relations[guide_url].sameTopics -%}
64+
<div class="grid__item width-6-12 width-12-12-m">
65+
<h3>{{site.data.guides.texts.on_the_same_topics}}</h3>
66+
<ul class="related-content">
67+
{% for guide in relations[guide_url].sameTopics limit:20 -%}
68+
{% assign is_external_guide = guide.url | startswith: 'http' %}
69+
{% if is_external_guide %}
70+
{% assign related_guide_url = include.url %}
71+
{% elsif docversion == 'latest' %}
72+
{% assign related_guide_url = site.baseurl | append: guide.url %}
73+
{% else %}
74+
{% assign related_guide_url = site.baseurl | append: '/version/' | append: docversion | append: guide.url %}
75+
{% endif %}
76+
<li class="{{ guide.type }}"><a href="{{ related_guide_url }}">{{ guide.title }}</a></li>
77+
{% endfor -%}
78+
</ul>
79+
</div>
80+
{% endif -%}
81+
</div>
82+
{% endif -%}
83+
</div>

migrations.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
layout: base
3+
---
4+
5+
<h1>Migration Guides</h1>
6+
7+
{% assign doclist = site.migrations %}
8+
<ul>
9+
{% for doc in doclist %}
10+
{% assign page_filename = doc.path | replace: '_migrations/', '' | replace: 'Migration-Guide-', '' | replace: '.adoc', '' | replace: '.asciidoc', '' %}
11+
<li><a href="{{ site.baseurl }}{{ doc.url }}">{{ page_filename }} </a></li>
12+
{% endfor %}
13+
</ul>
14+

0 commit comments

Comments
 (0)