Skip to content

Guide: Add and link content

How to add commands, runbooks, incidents, gotchas, how-tos and notes, and link them together.

Index
  • #guide
  • #contributing
Updated

Also:add content · new page · npm run new · templates · cmd link · command card

Adding anything is one file plus one commit. No config changes: new files show up in the sidebar, search and Recently added automatically.

Every content group in the sidebar (Commands, Runbooks, Incidents, Gotchas, My docs, Guide) has a + button, and tool pages / index pages have an Add command / New … button. It opens a form with the template, title prefix and today’s date already filled in. Save to GitHub commits the file to the repo (the repo is the database), and the deploy publishes it within a couple of minutes. Unsaved drafts are kept in your browser if you close the form.

Preview before saving

Both dialogs have Write / Preview tabs (or press Ctrl/⌘+Shift+P). Preview renders the page (title, tags, Markdown, code blocks, tables, :::note boxes) or the command card, and lists anything that would stop the save.

Edit existing pages from the site

Every page has an Edit button under its title, and every command card has a pencil button. It loads the file from GitHub (frontmatter + Markdown, or the command’s YAML), you change it, and Save changes commits it. The same checks as the content lint run first. If the file changed on GitHub since you opened it, saving stops and your text is kept, so nothing is overwritten. Unsaved edits survive closing the dialog.

One-time setup: GitHub token in Cloudflare

The GitHub token lives in Cloudflare as a secret, never in a browser. The site’s Worker (worker/index.js) uses it to commit, but only after you unlock saving with an editor password (also a Cloudflare secret).

  1. Create a GitHub fine-grained token: GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate. Only select repositories → My_DevOps_Playbook; Repository permissions → Contents: Read and write.
  2. In the project folder run npm run setup:editor. It asks for two values and stores them in Cloudflare:
    • GITHUB_TOKEN: paste the token from step 1
    • EDITOR_PASSWORD: choose a long passphrase
  3. On the site, click any +, open Saving locked at the bottom, enter the editor password, click Unlock. Each browser asks once. Lock forgets it.

To rotate: run the same command again (new token or new password). The site can only create new files in the content folders and edit existing pages and commands. Nothing else in the repo (workflows, code, config) can be read or written through it.

Without the Cloudflare secrets (for example in npm run dev) the form falls back to asking for a GitHub token directly, stored only in that browser.

The form checks the same rules as npm run lint:content (title prefix, lowercase tags, required fields) before saving. For editing existing pages, use Edit page at the bottom of each page (opens GitHub’s editor) or the full editor at /admin/.

Terminal window
npm run new -- <type> "<title>"
Type Goes to Example
command src/data/commands/<tool>/<slug>.yaml npm run new -- command "Kubernetes: Show pod restarts"
runbook src/content/docs/runbooks/ npm run new -- runbook "Fix pod stuck in ImagePullBackOff"
incident src/content/docs/incidents/ npm run new -- incident "Expired TLS cert on api gateway"
gotcha src/content/docs/gotchas/ npm run new -- gotcha "Helm --wait ignores Jobs"
howto src/content/docs/my-docs/how-to/ npm run new -- howto "Rotate AWS IAM access keys"
note src/content/docs/my-docs/notes/ npm run new -- note "Staging VPN setup"

It adds the prefix if you leave it out (incidents get today’s date), generates the slug file name, pre-fills type, tags, aliases and created from the title, and copies the matching file from templates/. Options: --tags a,b, --aliases "x,y", --tool <tool> (commands), --force.

Then run npm run lint:content and commit.

A command is defined once in YAML and shows up on its tool page and on every task view it’s tagged for:

title: "Kubernetes: Follow logs of a pod"
type: command
tool: kubernetes
command: "kubectl logs -f <pod> -n <namespace> --tail=200" # <placeholders> get fill-in inputs
description: "Stream a pod's logs from the last 200 lines."
example: | # optional
$ kubectl logs -f api-7c9d8b6f4-x2k9p -n shop --tail=200
tags: [kubernetes, logs] # tool + task tags
aliases: ["k8s logs", "kubectl logs -f"]
danger: safe # safe | caution | destructive (red badge)
note: "Optional personal context."
created: 2026-11-22

The card id is <tool folder>-<file name>, e.g. kubernetes-follow-logs-of-a-pod.

Link to a command card from any .md page. An empty link text uses the command’s title:

Check the crashed container first: [](cmd:kubernetes-show-logs-of-the-previous-crashed-container)
Or with your own text: [previous logs](cmd:kubernetes-show-logs-of-the-previous-crashed-container)

Embed a full card in an .mdx page:

import Cmd from '../../../components/Cmd.astro';
<Cmd id="kubernetes-roll-back-a-deployment" />

Which renders as:

Kubernetes: Roll back a deployment

Caution

Return to the previous ReplicaSet. Use --to-revision=<n> for a specific one (see rollout history).

kubectl rollout undo deployment/<deployment> -n <namespace>
What each part does
  1. kubectl rollout undogo back to the previous ReplicaSet (add --to-revision=N for a specific one)
  2. deployment/<deployment>the deployment
  3. -n <namespace>its namespace

My note kubectl rollout history deployment/<deployment> shows revisions first.

Also known as: rollback · undo deploy · kubectl rollout undo

Tool page →

Link to another page with a root-relative path. The site base path is added automatically:

[Incident 2026-11-20: Disk full on Jenkins agent](/incidents/2026-11-20-disk-full-on-jenkins-agent/)

npm run lint:content fails on cmd: links and <Cmd id> values that don’t exist.

Every page shows Updated … under the title and in the footer, taken from the page’s last Git commit. A page shows a date once it has been committed.

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…