Configuration
The default settings generate the most commonly-used URL pattern on Read the Docs:
if you have a resource at _static/js/logic.js and you generate a 404 page with the default settings,
the URL for that resource will be /en/latest/_static/js/logic.js.
For other use cases, you can customize these configuration options in your conf.py file:
- notfound_template
Template used to render the
404.htmlgenerated by this extension.Default:
'page.html'Type: string
- notfound_context
Context passed to the template defined by
notfound_template.Default:
{ 'title': 'Page not found', 'body': '<h1>Page not found</h1>\n\nThanks for trying.', }
Type: dict
Note
If you prefer, you can create a file called
404.rstand use reStructuredText to create the context of your404.htmlpage. Add the:orphan:metadata to the top of404.rst, to silence the spuriousdocument isn't included in any toctreewarning.
- notfound_pagename
Page name generated by the extension.
Default:
'404'Type: string
- notfound_urls_prefix
Prefix added to all the URLs generated in the 404 page.
Default:
'/en/latest/'Type: string
Warning
Make sure this config starts and ends with a
/. Otherwise, you may have unexpected behaviours.Tip
The prefix can be completely removed by setting it to
None.
- notfound_default_language
Language used as default to generate all links to the resources.
Default:
READTHEDOCS_LANGUAGEenvironment variable, if set, else'en'Type: string
Note
All links generated will have this prefix (e.g.
/en/). This setting works withnotfound_default_versionto create a prefix for all URLs.Deprecated since version 0.5:
notfound_default_languageis deprecated. Usenotfound_urls_prefixinstead
- notfound_default_version
Version used as default to generate all links to the resources.
Default:
READTHEDOCS_VERSIONenvironment variable, if set, else'latest'Type: string
Note
All links generated will have this prefix (e.g.
/latest/). This setting works withnotfound_default_languageto create a prefix for all URLs.Deprecated since version 0.5:
notfound_default_versionis deprecated. Usenotfound_urls_prefixinstead
- notfound_no_urls_prefix
URL prefixes skipped or included.
Default:
False.Type: bool
Note
If this option is set to
True, the extension omits any prefix values from the URLs, including explicit values fornotfound_default_languageandnotfound_default_version.Deprecated since version 0.5:
notfound_no_urls_prefixis deprecated. Usenotfound_urls_prefixinstead