|
| 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: '_guides/', '' | replace: '_versions/main/guides/', '' %} |
| 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> |
0 commit comments