Set up new website structure with MkDocs
MkDocs
- https://www.mkdocs.org/
- https://github.com/mkdocs/mkdocs
- https://github.com/mkdocs/catalog
- https://repology.org/badge/vertical-allrepos/python:mkdocs.svg
- https://repology.org/badge/vertical-allrepos/mkdocs.svg
- Used by substrate-interface, Textual, Pipx, and Ruff
- Allows to build markdown docs from the repository
- Very simple static framework website written in Python
Tasks
MkDocs initial set-up
-
Read the User Guide -
pyproject.toml
: Introducemkdocs
dependencies indoc
group -
Set-up initial project mkdocs.yml
-
Move md
files to defaultdocs
directory -
Set symlinks for changelog, contributing(, readme) -
Choose theme: material -
Set favicon -
Night/day switch
-
-
Set-up navigation with current content
Deployment
poetry install --only docs
poetry run mkdocs build -d public
-
Support website/documentation per releases and development one with Mike: - Drop-down support to switch between ie
v0.12
andmain
-
Mike git commits changes to pages
branch. Add.gitlab-ci.yml
on this branch to publish the website and its’s multiple versions (no need schedule) -
On pages
branch: basic.gitlab-ci.yml
to copy the content into apublic
directory and publish to GitLab Pages via apages
job - GitLab Pages implementation, will come later in the Community edition
- https://pypi.org/project/lightweight-versioned-gitlab-pages/
- https://stackoverflow.com/questions/55596789/deploying-gitlab-pages-for-different-branches/58915486#58915486
-
Version path /0.12
issue with GitLab/Nginx deployment for hard-coded links- We should always use a relative link as stated in: GH issue, MkDocs doc
- not
[](/path.md)
(absolute breaks version).[](path.md)
if in the same directory otherwise[](./path.md)
- Drop-down support to switch between ie
- only on
main
branch andtag
? SetRELEASE
variable to0.12
or to0.20-dev
. - how to handle the coverage and website deployments?
mkdocs-coverage
-
website
jobneeds:
tests:3.12:cov
job artifact - https://stackoverflow.com/a/64008569
- handle coverage display on
main
branch, don’t displayCoverage
tab when on release branch? Always display.
-
Protect pages
branch -
Update coverage badge link to website coverage path -
Adapt GitLab Pages deployment: Ansible role, now from Silkaj repository - NixOS configuration works with three paths
clients/python/silkaj
- NixOS configuration works with three paths
Document contribution
-
How to install mkdocs
, serve the docs, build locally - Link mkdocs, material, mike, coverage, gitlab … docs
Set up structure and use existing content
-
Fix mkdocs serve
warnings-
Update links in release notes, contributing(, readme) -
README.md
CONTRIBUTING.md
: update links to the URL of this website
-
-
Create index/main page inspired from Textual one -
Clean and proofread current documentation - move container usage (and poetry installation) to install section? Advanced installation, somehow contributing stuff. Nope?
-
enable syntax highlight, fix code block where we don’t want it -
enable code block copy where needed -
Id anchors in changelog -
Move CHANGELOG.md
todocs/changelog.md
, with the{ id=0.11.0 }
it might get ugly looking at it on GitLab. Same forCONTRIBUTING.md
, Drop them from GitLab "syntax", not sure for the logos -
create CHANGELOG.md
andCONTRIBUTING.md
referring to those pages on the website
-
-
structure docs
folder:usage
,contributing
-
Introduce mdformat-mkdocs
to format with four spaces bullet points -
Keep mike
prefix_path
topublic
, serving to http://localhost:8000/pages (needs doc precision) or selectversion.json
,latest
, and0.12
items in the artifact -
Integrate generated coverage with mkdocs-coverage
-
Changelog with mkdocs-gitlab-plugin
: -
Blog tab containing releases notes: -
Move releases_notes
directory indocs/blog
directory -
Set up built-in mkdocs-material
blog (notmkdocs-blogging-plugin
)- Yaml frontmatter kept:
mdformat-frontmatter
- Yaml frontmatter kept:
-
Add excerpts -
Add authors -
Local author profile picture not available from archive, category slug, set up url formats -
Issue to display local avatar: relative not working between mkdocs-material
andmike
- Found a "dirty" hack which works with
mike
, but not when serving withmkdocs
, to be investigated further later
- Found a "dirty" hack which works with
-
-
Set up categories/tags for the releases and RC testing to separated them
-
-
Add badge to readme and GitLab repo badges -
disable fonts coming from Google gstatic -
Retrieve valuable content from current and Vue websites (no real value left: intro text maybe?)
Archive current websites
-
Archive two other websites repositories - https://git.duniter.org/websites/silkaj_website
- https://git.duniter.org/websites/doc_silkaj
Set them as archives. Visible in the archived tab. Redirect, saying that the website is now in Silkaj repository
Thank Manutopik for the Vue website solution which wasn’t retained. I prefer MkDocs: it’s written in Python, it’s simple, (no JS), I have full control over it
Finalization
-
Clean local history -
push changes -
protect pages
branch -
Check the CI manages to publish on pages
branch- a commit is added to
pages
branch once a.py
ordocs/**.md
file changes. When there is no changes, the changelog has its date updated. - schedule pipeline won’t have the requirements to trigger
website
job, since no.py
nor.md
file was changed. Let’s see how it goes. There is nowebsite
job, andpages
branch does not get a new "empty" commit. Let’s not create lot’s of useless commits onpages
branch.
- a commit is added to
-
Remove commented line in CI, so it only pushed from main
branch -
Review changes -
Push clean pages
branch -
Switch Infra config of https://silkaj.duniter.org to this website: admins/duniter-infra!101
Edited by Moul