Skip to content
New issue

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

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

Already on GitHub? # to your account

How to remove .html suffix from URL? #902

Closed
MatinF opened this issue Apr 21, 2020 · 2 comments
Closed

How to remove .html suffix from URL? #902

MatinF opened this issue Apr 21, 2020 · 2 comments
Labels
Support Support question

Comments

@MatinF
Copy link

MatinF commented Apr 21, 2020

Problem

I'm using the rtd_sphinx_theme and would like to structure my project as follows:

index.rst
about-manual.rst

Inside my root index.rst, the toctree is as below:

===========================
Contents
===========================

.. toctree::

   about-manual

This results in the below links:

https://example.com/docs/                                --> https://example.com/docs/ (content of index.rst)
https://example.com/docs/about-manual         --> ERROR
https://example.com/docs/about-manual.html --> https://example.com/docs/about-manual.html (content of about-manual.rst)

I was hoping to be able to instead achieve the following logic

https://example.com/docs/                                --> https://example.com/docs/ (content of index.rst)
https://example.com/docs/about-manual         --> https://example.com/docs/about-manual (content of about-manual.rst)
https://example.com/docs/about-manual.html --> https://example.com/docs/about-manual (content of about-manual.rst)

I've tried using the html_file_suffix and html_link_suffix, but without luck. My problem with the default behavior is that a user would intuitively use a link style like https://example.com/docs/about-manual, which returns an error in this case.

Sorry if this is not rtd_sphinx_theme specific, I'm a bit unsure if this is related to the general Sphinx setup or the theme. I'm using Sphinx 1.8.5.

@jessetan
Copy link
Contributor

This is indeed not theme-specific. You can build with sphinx-build -b dirhtml (instead of html), see
https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.dirhtml.DirectoryHTMLBuilder

@jessetan jessetan added the Support Support question label Apr 21, 2020
@MatinF
Copy link
Author

MatinF commented Apr 21, 2020

Thanks for answering this anyway, it was immensely helpful!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Support Support question
Projects
None yet
Development

No branches or pull requests

2 participants