Skip to content

Commit 49cde1d

Browse files
Merge pull request #13585 from nextcloud/jtr/feat-notfound-page
feat(docs): friendly 404 page
2 parents 030dc88 + 0ff8729 commit 49cde1d

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

conf.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010

1111
os.environ["READTHEDOCS"] = "True"
1212

13-
extensions = ['sphinx_rtd_theme', 'sphinx_rtd_dark_mode', 'sphinx_copybutton', 'sphinxcontrib.mermaid']
13+
extensions = [
14+
'sphinx_rtd_theme',
15+
'sphinx_rtd_dark_mode',
16+
'sphinx_copybutton',
17+
'sphinxcontrib.mermaid',
18+
'notfound.extension',
19+
]
1420

1521
# General information about the project.
1622
copyright = '2016-' + str(now.year) + ' Nextcloud GmbH and Nextcloud contibutors'
@@ -85,3 +91,25 @@ def generateVersionsDocs(current_docs):
8591
default_dark_mode = False
8692

8793
latex_engine = "xelatex"
94+
95+
# -- Options for sphinx-notfound-page extension -----------------------------------
96+
# https://github.com/readthedocs/sphinx-notfound-page
97+
98+
# content context passed to the 404 template
99+
notfound_context = {
100+
"title": "404 Page Not Found",
101+
"body": """
102+
<h1>Page Not Found</h1>
103+
<h2>Sorry, we can't seem to find the page you're looking for.</h2>
104+
<h6>Error code: 404</h6>
105+
106+
<h3>Here are some alternatives:</h3>
107+
<ol>
108+
<li>Try using the search box.</li>
109+
<li>Check the content menu on the side of this page.</li>
110+
<li>Regroup at our <a href="/">documentation homepage.</a></p></li>
111+
</ol>
112+
""",
113+
}
114+
115+
notfound_urls_prefix = None

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ sphinxcontrib-htmlhelp==2.1.0
2727
sphinxcontrib-jquery==4.1
2828
sphinxcontrib-jsmath==1.0.1
2929
sphinxcontrib-mermaid==1.0.0
30+
sphinx-notfound-page
3031
sphinxcontrib-phpdomain==0.13.1
3132
sphinxcontrib-qthelp==2.0.0
3233
sphinxcontrib-serializinghtml==2.0.0

0 commit comments

Comments
 (0)