Skip to content

Commit

Permalink
doc: Add workaround for Read The Docs (#47)
Browse files Browse the repository at this point in the history
RTD now wants an `index.html` file in the root. Otherwise RTD considers
the docs broken. Our docs use `contents.html` as entry point. Our RTD
configuration has page redirects in place:

- `/` -> `/contents.html`
- `/index.html` -> `/contents.html`

Add a dummy `index.rst` to make RTD happy. The page is hidden in the TOC
and just links to start of `contents.html` in the root. The trick ensures
that references in 3rd party documentations and search machine indexes
are kept happy.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
  • Loading branch information
tiran committed Nov 7, 2023
1 parent 16fde23 commit 942aa09
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py
8 changes: 8 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))

import os, sys
# add ../.. to module lookup path
sys.path.insert(
0,
os.path.abspath(
os.path.join(os.path.dirname(__file__), "..", "..")
)
)
import pyasn1

# -- General configuration ------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions docs/source/contents.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.. _Start Content:

ASN.1 library for Python
========================
Expand Down Expand Up @@ -159,3 +160,9 @@ On the other end of the readability spectrum, here is a quick and sweet write up
If you are working with ASN.1, we'd highly recommend reading a proper
book on the subject.


.. hidden toctree to include `index.rst` for RTD
.. toctree::
:hidden:

/index
7 changes: 7 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Index
=====

.. Make RTD happy. We have a redirect index.html to contents.html.
:ref:`Start Content`

0 comments on commit 942aa09

Please sign in to comment.