@@ -104,6 +104,7 @@ make docs-list - List deployed documentation versions
104104make docs-deploy VERSION=x.y.z - Deploy docs as version x.y.z (local, no push)
105105make docs-deploy-stable - Deploy stable docs with 'latest' alias (CI only)
106106make docs-deploy-beta - Manually deploy pre-release docs with '-beta' suffix
107+ make docs-deploy-404 - Deploy 404.html for versionless URL redirects
107108
108109make check - Shorthand -> format lint mypy
109110make c - Shorthand -> check
@@ -128,7 +129,8 @@ export HELP
128129 merge-check-ruff-lint merge-check-ruff-format merge-check-mypy merge-check-pyright \
129130 li check-unused-imports fix-unused-imports check-uv check-TODOs \
130131 docs docs-check docs-serve-versioned docs-list docs-deploy docs-deploy-stable docs-deploy-beta \
131- test-count check-test-badge
132+ test-count check-test-badge \
133+ docs-deploy-404
132134
133135all help :
134136 @echo " $$ HELP"
@@ -557,15 +559,26 @@ docs-deploy: env
557559 $(call PRINT_TITLE,"Deploying documentation version $(if $(VERSION ) ,$(VERSION ) ,$(DOCS_VERSION ) ) ")
558560 $(VENV_MIKE ) deploy $(if $(VERSION ) ,$(VERSION ) ,$(DOCS_VERSION ) )
559561
560- docs-deploy-stable : env
562+ docs-deploy-stable : env docs-deploy-404
561563 $(call PRINT_TITLE,"Deploying stable documentation $(DOCS_VERSION ) with latest alias")
562564 $(VENV_MIKE ) deploy --push --update-aliases $(DOCS_VERSION ) latest
563565 $(VENV_MIKE ) set-default --push latest
564566
565- docs-deploy-beta : env
567+ docs-deploy-beta : env docs-deploy-404
566568 $(call PRINT_TITLE,"Deploying pre-release documentation $(DOCS_VERSION ) -beta")
567569 $(VENV_MIKE ) deploy --push $(DOCS_VERSION ) -beta
568570
571+ docs-deploy-404 :
572+ $(call PRINT_TITLE,"Deploying 404.html to gh-pages root for versionless URL redirects")
573+ @TMPDIR=$$(mktemp -d ) ; \
574+ trap " cd '$( CURDIR) '; git worktree remove '$$ TMPDIR' 2>/dev/null || true; rm -rf '$$ TMPDIR'" EXIT; \
575+ git worktree add " $$ TMPDIR" gh-pages && \
576+ cp docs/404.html " $$ TMPDIR/404.html" && \
577+ cd " $$ TMPDIR" && \
578+ git add 404.html && \
579+ (git diff --cached --quiet || git commit -m " Update 404.html for versionless URL redirects" ) && \
580+ git push origin gh-pages
581+
569582# #########################################################################################
570583# ## SHORTHANDS
571584# #########################################################################################
0 commit comments