Skip to content
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

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

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 Jun 2, 2019
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

@stsewd stsewd Jun 3, 2019

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

stsewd
stsewd approved these changes Jun 3, 2019
@humitos humitos merged commit 2673305 into master Jun 3, 2019
2 checks passed
@delete-merged-branch delete-merged-branch bot deleted the humitos/404-htmldir-builder branch Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants