From 26724ae29e177a11a4287c82cfd783b8566801c2 Mon Sep 17 00:00:00 2001 From: Sheogorath <sheogorath@shivering-isles.com> Date: Sun, 12 Jun 2022 05:40:18 +0200 Subject: [PATCH] docs: Add external links workaround This patch adds some external links to the docs navigation section. Since mdbooks doesn't support this by default, this adds a JS file as workaround, which avoids forking the theme or writing an extension for mdbooks. References: https://github.com/rust-lang/mdBook/issues/1354 --- docs/book.toml | 1 + docs/external-links.js | 15 +++++++++++++++ docs/src/SUMMARY.md | 4 ++++ 3 files changed, 20 insertions(+) create mode 100644 docs/external-links.js diff --git a/docs/book.toml b/docs/book.toml index b6571d0ef..d56324109 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -12,3 +12,4 @@ src = "src" git-repository-icon = "fa-gitlab" git-repository-url = "https://git.shivering-isles.com/shivering-isles/infrastructure-gitops/-/tree/main/docs" edit-url-template = "https://git.shivering-isles.com/-/ide/project/shivering-isles/infrastructure-gitops/edit/main/-/docs/{path}" +additional-js = ["external-links.js"] diff --git a/docs/external-links.js b/docs/external-links.js new file mode 100644 index 000000000..6c24d27d0 --- /dev/null +++ b/docs/external-links.js @@ -0,0 +1,15 @@ +(function () { + function createExternalLink(name, link) { + const nav = document.getElementsByClassName("chapter") + let li = document.createElement("li") + let a = document.createElement("a") + a.href = link + a.append(name) + li.classList = "chapter-item expanded" + li.append(a) + nav[0].append(li) + } + + createExternalLink("Blog", "https://shivering-isles.com") + createExternalLink("Repository", "https://git.shivering-isles.com/shivering-isles/infrastructure-gitops") +})(); diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index a2f4780a9..633281235 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -27,3 +27,7 @@ - [Matrix]() - [Nextcloud]() - [Registry]() + +--- + +# Links -- GitLab