From 42dc7ed8fd84d9160e65b0b50f66d0b9bfd0e3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Dvo=C5=99=C3=A1k?= <xdvora19@fi.muni.cz> Date: Thu, 19 Dec 2024 13:04:31 +0100 Subject: [PATCH] preparation for parallel pages --- .gitlab-ci.yml | 2 +- README.md | 10 +++-- overrides/partials/header.html | 77 ++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 overrides/partials/header.html diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2dd6f00..006bff8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,4 +61,4 @@ pages: paths: - public only: - - main + - change-me diff --git a/README.md b/README.md index 0ea5973..ea3d40e 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ For that, we are going to create a new branch named after the release name, and The main difference between the main page of docs and paraller is that paraller has a postfix in the URL and is thus not the primary site. When setting up the version, you need to make a few adjustments to the gitlab-ci.yml. -### Parallel page setup from the main page +### 1. Parallel page setup from the main page In the file `gitlab-ci.yml` the following lines need to be added under the `pages` stage when creating a new parallel page from the main page: ``` @@ -97,7 +97,7 @@ This means that a new page will be generated under the URL: https://inject.pages You also need to specify the expiration time of this deployment since, by default, they are set to expire in a set amount of time. -### Setup shared for all versions +### 2. Setup shared for all versions Another part that needs to be adjusted for each page upon new release is the menu for switching versions. It's located in `overrides/partials/header.html`. Here you can find the lines: @@ -107,6 +107,7 @@ It's located in `overrides/partials/header.html`. Here you can find the lines: <select onchange="window.location.href=this.value;"> <option value="#">Citadel</option> <option value="/bastion/">Bastion</option> + <option value="/aegis/">Aegis</option> </select> </div> ``` @@ -117,7 +118,8 @@ On a parallel page, it looks like: <div class="md-header__dropdown"> <select onchange="window.location.href=this.value;"> <option value="#">Bastion</option> - <option value="../">Citadel</option> + <option value="/">Citadel</option> + <option value="/aegis/">Aegis</option> </select> </div> ``` @@ -127,7 +129,7 @@ When adding a new page, you will need to add a new option to this list. A few th * value="/" points to the main page from the parallel page * value="/{branch-name}/" points to a parallel page -### Tip +### 3. Finishing touches To avoid accidental publishing, the tag `only:` should always be set to the name of the branch where it is located. Also, the main branch should never have a valid gitlab-ci.yml that can publish pages. diff --git a/overrides/partials/header.html b/overrides/partials/header.html new file mode 100644 index 0000000..52fa368 --- /dev/null +++ b/overrides/partials/header.html @@ -0,0 +1,77 @@ +{#- + This file was automatically generated - do not edit + -#} + {% set class = "md-header" %} + {% if "navigation.tabs.sticky" in features %} + {% set class = class ~ " md-header--shadow md-header--lifted" %} + {% elif "navigation.tabs" not in features %} + {% set class = class ~ " md-header--shadow" %} + {% endif %} + <header class="{{ class }}" data-md-component="header"> + <nav class="md-header__inner md-grid" aria-label="{{ lang.t('header') }}"> + <a href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}" title="{{ config.site_name | e }}" class="md-header__button md-logo" aria-label="{{ config.site_name }}" data-md-component="logo"> + {% include "partials/logo.html" %} + </a> + <label class="md-header__button md-icon" for="__drawer"> + {% set icon = config.theme.icon.menu or "material/menu" %} + {% include ".icons/" ~ icon ~ ".svg" %} + </label> + <div class="md-header__title" data-md-component="header-title"> + <div class="md-header__ellipsis"> + <div class="md-header__topic"> + <span class="md-ellipsis"> + {{ config.site_name }} + </span> + </div> + <div class="md-header__topic" data-md-component="header-topic"> + <span class="md-ellipsis"> + {% if page.meta and page.meta.title %} + {{ page.meta.title }} + {% else %} + {{ page.title }} + {% endif %} + </span> + </div> + </div> + </div> + + <!-- Dropdown Menu for Page Versions --> + <!-- remove this line + <div class="md-header__dropdown"> + <select onchange="window.location.href=this.value;"> + <option value="#">Version 2.0</option> + <option value="/1-0/">Version 1.0</option> + </select> + </div> + --> remove this line + + {% if config.theme.palette %} + {% if not config.theme.palette is mapping %} + {% include "partials/palette.html" %} + {% endif %} + {% endif %} + {% if not config.theme.palette is mapping %} + {% include "partials/javascripts/palette.html" %} + {% endif %} + {% if config.extra.alternate %} + {% include "partials/alternate.html" %} + {% endif %} + {% if "material/search" in config.plugins %} + <label class="md-header__button md-icon" for="__search"> + {% set icon = config.theme.icon.search or "material/magnify" %} + {% include ".icons/" ~ icon ~ ".svg" %} + </label> + {% include "partials/search.html" %} + {% endif %} + {% if config.repo_url %} + <div class="md-header__source"> + {% include "partials/source.html" %} + </div> + {% endif %} + </nav> + {% if "navigation.tabs.sticky" in features %} + {% if "navigation.tabs" in features %} + {% include "partials/tabs.html" %} + {% endif %} + {% endif %} + </header> -- GitLab