Skip to content

Serve 404/index.html file for htmldir Sphinx builder #5754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2019

Conversation

humitos
Copy link
Member

@humitos humitos commented Jun 2, 2019

Currently, we are serving a custom 404 page for those projects that have a 404.html on their docs root path. This produces projects using htmldir Sphinx Builder to not serve custom 404 pages because this file is called 404/index.html.

This PR adds support for htmldir Sphinx Builder by trying first one file and if it does not exist try the other one.

This could be implemented by checking for project.documentation_type but I think we said that we probably remove it in the future. The only drawback of the implementation on the PR is that there is an extra resolve and check in the worst case.

@humitos humitos requested a review from a team June 2, 2019 13:33
basepath, filename, fullpath = resolve_404_path(project, slug, language, tryfile)
if os.path.exists(fullpath):
log.debug(
'serving 404.html page current version: [project: %s] [version: %s]',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

('Serving %s ... ', tryfile, ...)

@humitos humitos merged commit 2673305 into master Jun 3, 2019
@delete-merged-branch delete-merged-branch bot deleted the humitos/404-htmldir-builder branch June 3, 2019 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants