Frequently Asked Questions
==========================

Does this extension work with Read the Docs?
--------------------------------------------

Yes.

Read the Docs should detect the ``404.html`` page generated by the extension automatically,
and serve it when a user hits a not found page.

If you are using a Single Version project,
you may want to set :confval:`notfound_urls_prefix` to ``None``.


Does this extension work with GitHub pages?
-------------------------------------------

Yes.

You may want to set :confval:`notfound_urls_prefix` to ``None``,
and then add ``permalink: /404.html`` in the `YAML front matter`_.

If you are using the github provided domain, make sure to set the :confval:`notfound_urls_prefix` to your repository's name in between two forward slashes. For example if your repository is named ``MyRepo``, then ``notfound_urls_prefix = "/MyRepo/"``.

.. _YAML front matter: http://jekyllrb.com/docs/frontmatter/


Does this extension work with `Jupyter Book`_?
----------------------------------------------

.. _Jupyter Book: https://jupyterbook.org/

Yes.

You need to enable ``sphinx-notfound-page`` in your Jupyter Book ``_config.yml`` as a `custom extension`_.
It would look like similar to the following:

.. code-block:: yaml

   sphinx:
       extra_extensions:
           - notfound.extension

.. _custom extension: https://jupyterbook.org/en/stable/advanced/sphinx.html#custom-sphinx-extensions


Why is my local web server not showing a 404.html?
--------------------------------------------------

Simple web servers, such as ``http.server``, don't have a default handler for 404
codes, so it doesn't know to point to the generated ``404.html``.

To see an example of adding a custom request handler for 404 codes, see:
https://stackoverflow.com/questions/22467908/python-simplehttpserver-404-page


The answer I'm looking for is not here
--------------------------------------

|:cry:|

Please, `open an issue in our issue tracker`_,
and let us know what's the problem you are having.

.. _open an issue in our issue tracker: https://github.com/readthedocs/sphinx-notfound-page/issues/new
