Skip to content

Commit

Permalink
Initial migration layout
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-cummins committed Sep 2, 2024
1 parent 5ad2c6c commit 6eeae61
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
9 changes: 9 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -122,6 +125,12 @@ defaults:
type: "posts"
values:
permalink: /blog/:title/
-
scope:
type: "migrations"
values:
layout: migration-guide
toc: true
-
scope:
type: redirects
Expand Down
83 changes: 83 additions & 0 deletions _layouts/migration-guide.html
Original file line number Diff line number Diff line change
@@ -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' %}

<section class="full-width-version-bg flexfilterbar guides">
<div class="guideflexcontainer">
<div class="docslink">
<a class="returnlink" href="{{site.baseurl}}/migrations/"> Back to Migration Guides</a>
</div>
</div>
</section>

<div class="guide">
<div class="grid-wrapper">
<div class="grid__item width-8-12 width-12-12-m">
{% if docversion == 'latest' or docversion == 'main' %}
<a class="editlink" href="https://github.com/quarkusio/quarkusio.github.io/edit/main/_migrations/{{ page_filename }}">{{site.data.guides.texts.edit_this_page}}</a>
{% endif %}
<h1 class="text-caps">{{page.title}} {{page.docversion}}</h1>
{{ content }}
</div>
<div class="grid__item width-4-12 width-12-12-m tocwrapper">
<div class="hide-mobile toc">{{ page.document | tocify_asciidoc }}</div>
</div>
</div>
{% if relations and relations[guide_url] -%}
<h2>{{site.data.guides.texts.related_content}}</h2>
<div class="grid-wrapper relations">
{% if relations[guide_url].sameExtensions -%}
<div class="grid__item width-6-12 width-12-12-m">
<h3>{{site.data.guides.texts.on_the_same_extensions}}</h3>
<ul class="related-content">
{% for guide in relations[guide_url].sameExtensions -%}
{% assign is_external_guide = guide.url | startswith: 'http' %}
{% if is_external_guide %}
{% assign related_guide_url = include.url %}
{% elsif docversion == 'latest' %}
{% assign related_guide_url = site.baseurl | append: guide.url %}
{% else %}
{% assign related_guide_url = site.baseurl | append: '/version/' | append: docversion | append: guide.url %}
{% endif %}
<li class="{{ guide.type }}"><a href="{{ related_guide_url }}">{{ guide.title }}</a></li>
{% endfor -%}
</ul>
</div>
{% endif -%}
{% if relations[guide_url].sameTopics -%}
<div class="grid__item width-6-12 width-12-12-m">
<h3>{{site.data.guides.texts.on_the_same_topics}}</h3>
<ul class="related-content">
{% for guide in relations[guide_url].sameTopics limit:20 -%}
{% assign is_external_guide = guide.url | startswith: 'http' %}
{% if is_external_guide %}
{% assign related_guide_url = include.url %}
{% elsif docversion == 'latest' %}
{% assign related_guide_url = site.baseurl | append: guide.url %}
{% else %}
{% assign related_guide_url = site.baseurl | append: '/version/' | append: docversion | append: guide.url %}
{% endif %}
<li class="{{ guide.type }}"><a href="{{ related_guide_url }}">{{ guide.title }}</a></li>
{% endfor -%}
</ul>
</div>
{% endif -%}
</div>
{% endif -%}
</div>
14 changes: 14 additions & 0 deletions migrations.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
layout: base
---

<h1>Migration Guides</h1>

{% assign doclist = site.migrations %}
<ul>
{% for doc in doclist %}
{% assign page_filename = doc.path | replace: '_migrations/', '' | replace: 'Migration-Guide-', '' | replace: '.adoc', '' | replace: '.asciidoc', '' %}
<li><a href="{{ site.baseurl }}{{ doc.url }}">{{ page_filename }} </a></li>
{% endfor %}
</ul>

0 comments on commit 6eeae61

Please sign in to comment.