Skip to content

Commit

Permalink
Merge pull request #89 from readthedocs/humitos/nosearch
Browse files Browse the repository at this point in the history
:nosearch: metadata on 404 page
  • Loading branch information
humitos committed Apr 13, 2020
2 parents f421525 + 35fc075 commit 3058a02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion notfound/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ def clear_doc(self, app, env, docname):
return None

def process_doc(self, app, doctree):
app.env.metadata[app.config.notfound_pagename].update({'orphan': True})
metadata = app.env.metadata[app.config.notfound_pagename]
metadata.update({'orphan': True})
if sphinx.version_info >= (3, 0, 0):
metadata.update({'nosearch': True})


def setup(app):
Expand Down
5 changes: 4 additions & 1 deletion tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,4 +579,7 @@ def test_toctree_links_language_setting_version_environment(environ, app, status
)
def test_automatic_orphan(app, status, warning):
app.build()
assert app.env.metadata['404'] == {'orphan': True}
if sphinx.version_info >= (3, 0, 0):
assert app.env.metadata['404'] == {'orphan': True, 'nosearch': True}
else:
assert app.env.metadata['404'] == {'orphan': True}

0 comments on commit 3058a02

Please sign in to comment.