Rewrite documentation navigation URLs when being run locally.

This commit is contained in:
Dan Helfman 2023-07-11 19:58:49 -07:00
parent 196a226a7e
commit 5b991b88dd
3 changed files with 7 additions and 2 deletions

5
docs/_data/borgmatic.js Normal file
View file

@ -0,0 +1,5 @@
module.exports = function() {
return {
environment: process.env.NODE_ENV || "development"
};
};

View file

@ -11,7 +11,7 @@ headerClass: elv-header-default
{% set navPages = collections.all | eleventyNavigation %}
{% macro renderNavListItem(entry) -%}
<li{% if entry.url == page.url %} class="elv-toc-active"{% endif %}>
<a {% if entry.url %}href="https://torsion.org/borgmatic/docs{{ entry.url | url }}"{% endif %}>{{ entry.title }}</a>
<a {% if entry.url %}href="{% if borgmatic.environment == "production" %}https://torsion.org/borgmatic/docs{% else %}http://localhost:8080/docs{% endif %}{{ entry.url | url }}"{% endif %}>{{ entry.title }}</a>
{%- if entry.children.length -%}
<ul>
{%- for child in entry.children %}{{ renderNavListItem(child) }}{% endfor -%}

View file

@ -9,7 +9,7 @@ services:
dockerfile: docs/Dockerfile
context: ..
args:
ENVIRONMENT: dev
ENVIRONMENT: development
message:
image: alpine
container_name: message