Personal Website#

This section explains how this site is built, so that you can build the docs yourself or create a similar site of your own. The site is a static website generated with Sphinx (a documentation generator), the PyData Sphinx Theme, and ABlog (blog posts, tags, categories and feeds). The pages are written in reStructuredText and the generated HTML is hosted for free on GitHub Pages.

What you get#

  • A home page with cards, buttons and a list of the latest posts.

  • A blog with categories, tags, archives and an Atom feed.

  • A projects section, including documentation that is built separately for another project.

  • Maths (MathJax), diagrams (Graphviz), embedded YouTube videos and syntax-highlighted code.

  • Light and dark themes, a contact form that needs no server, and support for a custom domain.

How it fits together#

There are two Git repositories. The source repository holds the .rst files and conf.py. The Pages repository, named <username>.github.io, holds only the generated HTML that GitHub Pages serves.

source repository (.rst files, conf.py)
        |  sphinx-build
        v
_build/html  (generated static site, never edited by hand)
        |  copy, commit and push
        v
Pages repository  <username>.github.io
        |  GitHub Pages
        v
https://<username>.github.io  (or your custom domain)

Quick start#

To build and preview the site locally you need Python 3.11 or newer, Git and Graphviz. The short version is:

git clone https://github.com/samkhalilian/docs.git docs
cd docs
python -m venv .venv                      # then activate it
pip install -r requirements.txt
sphinx-build -M html source _build        # writes the site to _build/html
python -m http.server 8000 -d _build/html # preview the site at http://localhost:8000

Build and Publish has the exact commands for Windows and Linux, how to preview the result, and a troubleshooting list.

Creating a similar site#

  1. Get the tools working by building this site first (Build and Publish).

  2. Change the identity settings in conf.py: name, blog URL, social links, footer (Project Structure and Configuration).

  3. Replace the content: index.rst, about.rst, contact.rst, the posts and the projects (reStructuredText, Posts, Projects, Contact Form).

  4. Adjust the look: navigation bar, sidebars, colours and footer (Theme and Customisation).

  5. Create the Pages repository and publish the build (GitHub Pages).

In this section#

Page

What it covers

Build and Publish

Install, build, preview, troubleshoot and publish. Start here.

Project Structure and Configuration

Repository layout, dependencies, extensions and the settings to change.

Theme and Customisation

Navigation bar, sidebars, footer, custom CSS and the home page cards.

reStructuredText

The reStructuredText syntax and directives used across the site.

Posts

Writing blog posts with ABlog: categories, tags, archives and the feed.

Projects

Publishing another project’s documentation under this site.

Contact Form

A contact form on a static site using Formspree.

GitHub Pages

Hosting, publishing without leaving stale pages, and a custom domain.