Skip to content

Commit

Permalink
add a custom 404 page
Browse files Browse the repository at this point in the history
Fixes #51.

Signed-off-by: Ruth Fuchss <ruth.fuchss@canonical.com>
  • Loading branch information
ru-fu committed Jul 27, 2023
1 parent dcc5977 commit 6ee3655
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions .sphinx/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ lxd-sphinx-extensions
sphinx-copybutton
myst-parser
sphinxcontrib-jquery
sphinx-notfound-page
12 changes: 12 additions & 0 deletions 404.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
:orphan:
:nosearch:

Page not found
==============

Sorry, but the documentation page that you are looking for was not found.

Documentation changes over time, and pages are moved around.
We try to redirect you to the updated content where possible, but unfortunately, that didn't work this time (maybe because the content you were looking for does not exist in this version of the documentation).

You can try to use the navigation to locate the content you're looking for, or search for a similar page.
10 changes: 8 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
'sphinx_copybutton',
'sphinxext.opengraph',
'myst_parser',
'sphinxcontrib.jquery'
]
'sphinxcontrib.jquery',
'notfound.extension'
]
extensions.extend(custom_extensions)

### Configuration for extensions
Expand All @@ -42,6 +43,11 @@
if 'discourse' in html_context:
html_context['discourse_prefix'] = html_context['discourse'] + '/t/'

# The default for notfound_urls_prefix usually works, but not for
# documentation on documentation.ubuntu.com
if slug:
notfound_urls_prefix = '/' + slug + '/en/latest/'

# Default image for OGP (to prevent font errors, see
# https://github.com/canonical/sphinx-docs-starter-pack/pull/54 )
if not 'ogp_image' in locals():
Expand Down
4 changes: 4 additions & 0 deletions custom_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
'github_issues': 'enabled'
}

# If your project is on documentation.ubuntu.com, specify the project
# slug (for example, "lxd") here.
slug = ""

############################################################
### Redirects
############################################################
Expand Down

0 comments on commit 6ee3655

Please sign in to comment.