I'm a big fan of docs-as-code for more or less any type of content publishing, but I'm less of a fan of Jekyll, the default tool used in GitHub pages. I also prefer ReStructuredText over Markdown as a markup format, so Sphinx is definitely on my shortlist of SSGs (Static Site Generators) for my projects. I recently switched the rst2pdf docs to using Sphinx hosted on GitHub pages, so here are my setup notes.
Basic setup
This project uses Sphinx with a few additions:
Furo theme - a more modern-looking theme than the default that you'll recognise from older websites!
External TOC plugin, to make the navigation sane (The toctree is confusing for me, never mind all the fly-by docs contributors this project wants to be ready for)
Copy button plugin, for easy use of code samples
I also published a list of Sphinx extensions for developer portals which might be interesting if you're setting up your own Sphinx docs project.
Build process
GitHub workflow
Next, I added the GitHub action to build the site (here's the link to the full workflow, I'm not pasting the whole thing).
Overview of how my project workflow works:
- actions/checkout@v4
- actions/setup-python@v5 Sets up the Python environment.
- astral-sh/setup-uv@v3 Sets up the uv package manager that we use in this project.
- a step that installs the dependencies and actually builds the site.
- actions/configure-pages@v5 Gets GitHub Pages ready.
- actions/upload-pages-artifact@v3 Uploads the content that was built in an earlier step as an artifact.
- actions/deploy-pages@v4 Actually deploys!
Repository settings
Static sites are here to stay
Well-structured and linked content with metadata serves both human and machine audiences, and static sites help us do that with maximum clarity and efficiency, and minimum hassle. GitHub has a whole set of pages starter sets for you to check out if you prefer Hugo, Astro, or another SSG... what are you waiting for? I'd love to see the links to what you build :)