Skip to content

Commit

Permalink
Merge pull request #111 from microbiomedata/86-implement-custom-error…
Browse files Browse the repository at this point in the history
…-404-page-for-github-pages

Implement Sphinx-themed Error 404 page using Sphinx extension
  • Loading branch information
eecavanna authored Dec 16, 2024
2 parents 9d49df3 + c37a429 commit 1e18e5e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 5 additions & 1 deletion content/home/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ myst-parser
sphinx_markdown_tables
sphinx_rtd_theme

# Sphinx plugin that handles redirects.
# Sphinx extension that handles redirects.
# Reference: https://pypi.org/project/sphinx-reredirects/
sphinx-reredirects

# Sphinx extension that creates a `404.html` page in which static assets are properly referenced.
# Reference: https://sphinx-notfound-page.readthedocs.io
sphinx-notfound-page==1.0.4
17 changes: 14 additions & 3 deletions content/home/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'myst_parser',
'sphinx_markdown_tables',
'sphinx_reredirects',
'myst_parser',
'sphinx_markdown_tables',
'sphinx_reredirects',
'notfound.extension',
]

# source_suffix = '.rst'
Expand Down Expand Up @@ -97,6 +98,16 @@
"reference/metadata/*": "https://w3id.org/nmdc/nmdc",
}

# -- Sphinx Not Found Page extension --------------------
#
# Reference: https://sphinx-notfound-page.readthedocs.io/en/latest/configuration.html
#
notfound_urls_prefix = None
notfound_context = {
"title": "Page Not Found",
"body": "<h1>Page Not Found</h1>\n\nWe failed to find a page at that address.",
}

# -- Sphinx Read The Docs Theme -------------------------
#
# Configure "Edit on GitHub" links.
Expand Down
2 changes: 1 addition & 1 deletion content/legacy_home/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ myst-parser
sphinx_markdown_tables
sphinx_rtd_theme

# Sphinx plugin that handles redirects.
# Sphinx extension that handles redirects.
# Reference: https://pypi.org/project/sphinx-reredirects/
sphinx-reredirects

0 comments on commit 1e18e5e

Please sign in to comment.