From a1acf1e0dde9fd370a05f38dc086ea7a5668e798 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sun, 12 Oct 2025 15:37:28 -0700 Subject: [PATCH] Add documentation search. --- NEWS | 1 + README.md | 3 --- docs/Dockerfile | 1 + docs/_includes/header.njk | 1 + docs/_includes/index.css | 12 ++++++++++++ docs/_includes/layouts/base.njk | 3 +-- docs/_includes/layouts/main.njk | 10 ++++++++++ docs/search.md | 14 ++++++++++++++ 8 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 docs/search.md diff --git a/NEWS b/NEWS index bde39c25..355f7700 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ 2.0.10.dev0 * #1161: Fix a traceback (TypeError) in the "check" action with Python 3.14. + * Add documentation search. * Change the URL of the local documentation development server to be more like the production URL. 2.0.9 diff --git a/README.md b/README.md index f58b3ce9..54cb4e1f 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,6 @@ title: borgmatic permalink: index.html --- - -## It's your data. Keep it that way. - borgmatic logo borgmatic is simple, configuration-driven backup software for servers and diff --git a/docs/Dockerfile b/docs/Dockerfile index cfa1b828..d0f20028 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -29,6 +29,7 @@ COPY --from=borgmatic /contributors.html /source/docs/_includes/borgmatic/contri COPY . /source RUN NODE_ENV=${ENVIRONMENT} npx eleventy --input=/source/docs --output=/output/docs \ && mv /output/docs/index.html /output/index.html +RUN npx -y pagefind --site /output FROM docker.io/nginx:1.26.1-alpine diff --git a/docs/_includes/header.njk b/docs/_includes/header.njk index f511e012..16b5b691 100644 --- a/docs/_includes/header.njk +++ b/docs/_includes/header.njk @@ -1,4 +1,5 @@
{% if page.url != '/' %}

borgmatic

{% endif %}

{{ title | safe }}

+ {% if page.url == '/' %}

It's your data. Keep it that way.

{% endif %}
diff --git a/docs/_includes/index.css b/docs/_includes/index.css index c798f2e9..27289591 100644 --- a/docs/_includes/index.css +++ b/docs/_includes/index.css @@ -548,3 +548,15 @@ main .elv-toc + h1 .direct-link { .mdi.mdi-content-copy { --svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1Z'/%3E%3C/svg%3E"); } + +#search-entrance { + padding-bottom: 1em; +} + +#search-entrance form { + display: inline-block; +} + +#search { + padding-top: 1em; +} diff --git a/docs/_includes/layouts/base.njk b/docs/_includes/layouts/base.njk index 0807f5f0..9c32cf4e 100644 --- a/docs/_includes/layouts/base.njk +++ b/docs/_includes/layouts/base.njk @@ -4,8 +4,7 @@ - - {{ subtitle + ' - ' if subtitle}}{{ title }} + borgmatic{% if subtitle or title %} - {% endif %}{{ subtitle + ' - ' if subtitle}}{{ title }} {%- set css %} {% include 'index.css' %} {% include 'components/lists.css' %} diff --git a/docs/_includes/layouts/main.njk b/docs/_includes/layouts/main.njk index 82b4e32b..4f06cdf8 100644 --- a/docs/_includes/layouts/main.njk +++ b/docs/_includes/layouts/main.njk @@ -7,6 +7,16 @@ headerClass: elv-header-default
+ {% if page.url != '/search/' %} +
+ 🔍 +
+ +
+
+ {% endif %}
{% set navPages = collections.all | eleventyNavigation %} {% macro renderNavListItem(entry) -%} diff --git a/docs/search.md b/docs/search.md new file mode 100644 index 00000000..3d476a38 --- /dev/null +++ b/docs/search.md @@ -0,0 +1,14 @@ +--- +title: Search documentation +eleventyExcludeFromCollections: true +--- + + + +