Theme and Customisation#
The site uses the PyData Sphinx Theme, selected with
html_theme = "pydata_sphinx_theme" in conf.py. Most of the look comes from html_theme_options, a few small
templates in source/_templates/ and one stylesheet. This page shows each piece, so you can keep what you like and
change the rest. The theme’s own user guide
lists every option.
Logo and site name#
The text in the top-left corner and its subtitle come from two places:
html_theme_options = {
"logo": {
"text": "Sam Khalilian",
"alt_text": "Math, Coding, Trade",
},
...
}
# Subtitle shown under the site name; read by _templates/navbar-logo.html
html_context = {"logo_subtitle": "Math · Code · Trade"}
navbar-logo.html is a copy of the theme’s own template with one extra line that prints logo_subtitle. To use an
image instead of text, set image_light and image_dark in the logo dictionary.
Custom CSS#
html_css_files = ["custom.css"] loads source/_static/custom.css after the theme’s styles. It is short:
removes the extra side padding that the card grids add on the home page,
italicises the footer disclaimer,
stacks the site name above its subtitle in the navigation bar.
Add your own rules there, and prefer the theme’s CSS variables (for example var(--pst-color-text-muted)) so that
colours follow the light and dark modes.
Home page cards#
The cards, grids and buttons on index.rst come from the sphinx_design extension. A card that links to another
page looks like this:
.. grid:: 1 2 3 3
:gutter: 3
.. grid-item-card:: :fas:`chart-line;pst-color-primary` Trade Engine
:link: projects/trade_engine
:link-type: doc
:shadow: md
Trade capture, P&L and risk with end-of-day processing.
+++
:bdg-primary-line:`Python` :bdg-primary-line:`PostgreSQL`
The numbers after grid are the number of columns at the extra-small, small, medium and large screen widths. A card
that links to a blog category uses :link-type: url and the address blog/category/<name>.html (see
Posts).