diff --git a/.github/workflows/docs-preview-deploy.yml b/.github/workflows/docs-preview-deploy.yml index 39331502..d4b41c4e 100644 --- a/.github/workflows/docs-preview-deploy.yml +++ b/.github/workflows/docs-preview-deploy.yml @@ -98,6 +98,7 @@ jobs: 'requirements-docs.txt', 'scripts/build-docs.sh', 'scripts/render-dev-notes.py', + 'tests/test_docs_404.py', 'tests/test_render_dev_notes.py', 'zensical.toml', ]); diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index a6915ff9..2a14e41e 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -46,6 +46,7 @@ jobs: 'requirements-docs.txt', 'scripts/build-docs.sh', 'scripts/render-dev-notes.py', + 'tests/test_docs_404.py', 'tests/test_render_dev_notes.py', 'zensical.toml', ]); diff --git a/docs/development/index.md b/docs/development/index.md index db4c4f51..37985f8f 100644 --- a/docs/development/index.md +++ b/docs/development/index.md @@ -58,7 +58,9 @@ Verify branded surfaces in both the `default` and `slate` palette schemes. Prefe CSS variables in `docs/stylesheets/dev-notes.css` over one-off hard-coded colors. Keep asset paths relative to `docs_dir`. Theme templates live in `overrides/`; keep the custom `404.html` useful for ordinary missing pages as well as expired -pull request previews. +pull request previews. Keep that fallback self-contained: GitHub Pages serves it +for arbitrary paths where root-relative theme assets do not resolve beneath the +project site prefix. ## Validate and preview diff --git a/overrides/404.html b/overrides/404.html index a2a87005..0ce3477a 100644 --- a/overrides/404.html +++ b/overrides/404.html @@ -1,28 +1,130 @@ -{% extends "main.html" %} - -{% block htmltitle %} - Page not found - {{ config.site_name }} -{% endblock %} - -{% block content %} -

Page not found

-

The requested documentation page does not exist.

-

- - Return to OpenShell Research - -

- -{% endblock %} + + + + + + + + Page not found - {{ config.site_name }} + + + +
+ + + + + + + +

Page not found

+

The requested documentation page does not exist.

+ Return to OpenShell Research +
+ + + diff --git a/scripts/build-docs.sh b/scripts/build-docs.sh index e264cd3b..41c9292e 100755 --- a/scripts/build-docs.sh +++ b/scripts/build-docs.sh @@ -32,3 +32,4 @@ python -m pip install -r requirements-docs.txt python scripts/render-dev-notes.py zensical build --clean --strict +REQUIRE_RENDERED_404=1 python tests/test_docs_404.py diff --git a/tests/test_docs_404.py b/tests/test_docs_404.py new file mode 100644 index 00000000..0ad647b5 --- /dev/null +++ b/tests/test_docs_404.py @@ -0,0 +1,51 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import os +from pathlib import Path +import re +import unittest + + +ROOT = Path(__file__).resolve().parents[1] +TEMPLATE = ROOT / "overrides" / "404.html" +RENDERED = ROOT / "site" / "404.html" + + +class Docs404Tests(unittest.TestCase): + def test_template_is_standalone_and_self_contained(self) -> None: + html = TEMPLATE.read_text(encoding="utf-8") + + self.assertTrue(html.lstrip().lower().startswith("")) + self.assertNotIn("{% extends", html) + self.assertNotRegex(html, r"<(?:img|script)[^>]+src=") + self.assertNotRegex(html, r"]+rel=[\"']stylesheet") + self.assertNotRegex(html, r"https?://") + self.assertIn("