dynalyticssite

Self-hosted tutorials

Dynalytics hosts its tutorials directly (instead of linking out), served by GitHub Pages from the repo’s tutorials/ folder at https://dynasite.org/tutorials/<package>/<slug>.html.

The design goal is write & push: you should never hand-edit catalog JSON or run a custom toolchain to publish a tutorial.

author tutorial (Quarto/Rmd) ──render──▶ tutorials/<package>/<slug>.html ──npm run tutorials──▶ catalog ──git push──▶ live

The folder is the source of truth

tutorials/
  tna/        codyna/        cograph/        <package>/ …
    *.html      *.html         *.html           *.html

Every tutorials/<package>/<slug>.html is auto-discovered and registered as a tutorial. Nothing in build/sources.json references them — drop a file in the right package folder and it appears on the site.

For each file the build reads, from the file’s own <head>:

Field Source
title <title> (a trailing “ – sonsoleslp” / “ | Mohammed Saqr” site suffix is stripped)
description <meta name="description">, else <meta property="og:description">
package the folder name (tutorials/<package>/)
slug / url the file name → tutorials/<package>/<slug>.html
source always dynasite (renders the “Dynalytics” footer label)

You control title and description by writing them in your qmd front-matter (title: and description: / subtitle:) — they flow straight through.


Add a tutorial — write & push

  1. Render your tutorial to a single self-contained HTML (Quarto embed-resources: true, or rmarkdown self_contained: true).
  2. Put it in the package folder: tutorials/<package>/<slug>.html. Create a new folder the first time a package gets a tutorial.
  3. Build (offline — no network, no sibling repos) and push:
    npm run tutorials
    git add tutorials catalog.json assets/catalog.js
    git commit -m "tutorials: add <slug>"
    git push
    

It then appears automatically in the Readings → Tutorials menu and on that package’s dossier (the Tutorials tab), with the package badge.


Keep files small

Quarto exports plots at retina DPI, so a single tutorial can balloon to 50–75 MB (90%+ of it oversized base64 PNGs). Two ways to handle it:

This optimizer is optional — only reach for it when a file lands oversized.


How it works (for maintainers)

Build commands

Command What Network / siblings
npm run tutorials rebuild tutorials + curated slice (About/News/Papers/Tools/People) offline
npm run all full harvest (packages, CRAN, vignettes, chapters) + verify + stamp needs both

Notes & limits