Kbd
kbd — one shortcode, a list of key names, a semantic key sequence that stays readable in print and in Markdown output.Keys separate what the reader has to press from the prose. Use it for shortcuts and chords: one positional parameter per key, and the theme draws the caps, adds the separators, and gives screen readers a readable sequence. Command names, flags and text to type are inline code — they are not physical keys.
Shortest form
Press Ctrl with K to open the command palette.
Parameters must be quoted, one key per positional parameter. Missing, empty, or named parameters warn and render no invalid key in ordinary preview; strict publishing rejects the warning.
A single key
One parameter is one key, and symbol keys are written as they are.
Escape closes a dialog; / jumps to search; t toggles light and dark; l cycles through languages.
Chords
Several parameters render in order with + between them. That plus sign is
hidden from assistive technology, which hears a localized connector instead.
⌘ with Shift with P and Ctrl with Shift with P are the same action. For a literal plus, treat it as a key of its own: Ctrl with + zooms the page in.
Platform differences
Write the label printed on the reader’s keyboard: ⌘ on macOS, Ctrl on
Windows and Linux. Never merge two platforms into one sequence — a spelling like
Ctrl/⌘ cannot be read aloud correctly. Say which platform in the sentence, or
split into tabs.
On macOS press ⌘ with K; on Windows and Linux, Ctrl with K.
Shortcut tables
A cheatsheet is where keys most often live. Here are some of the global keys this site honours:
| Key | Action |
|---|---|
| Ctrl with K | Open the command palette (⌘ with K on macOS) |
| / | The palette’s full search state |
| t | Toggle light and dark |
| q / e | Previous / next page |
| w s a d | Move, collapse and expand in the sidebar tree |
| Escape | Leave the sidebar tree for the article |
The complete list of site-wide shortcuts is in keyboard navigation.
In steps
- Press Ctrl with K to open the command palette
- Type
>for the command-only state, or type a keyword to search - Select with ↑ ↓ and press Enter to go
- Escape closes it and focus returns where it was
Raw <kbd> tags
A raw <kbd> tag in Markdown gets the same styling, and GitHub renders it too.
The difference is that the separators and the accessible sequence are then yours
to maintain: either spelling works for a single key, but use the shortcode for
chords.
Press F5 to reload; in an editor, Ctrl+S saves.
Output
| Output | Shape |
|---|---|
| HTML | <span class="td-kbd-sequence"> around one <kbd> per key; the visible + is hidden from screen readers, which get a localized connector |
| Same as HTML, static | |
| Markdown | Plain text: Ctrl + K, ⌘ + Shift + P |
| RSS | Same as print |
Without CSS or JavaScript the instruction is still readable.
Parameter reference
Positional parameters only. There is no separator, label, platform,
class or size: Hugo does not allow positional and named parameters in one
shortcode call.
Limits
- One sequence is one set of keys pressed together: press-A-then-B is two
kbdcalls and a sentence — press Escape, then Enter. - No platform detection: the page never swaps
Ctrlfor⌘based on the visitor’s operating system. - No key mapping or recording: menu paths, gestures and gamepads are out of scope.
- Missing quotes fail the build:
Ctrlin{{< kbd Ctrl K >}}is not a string parameter. - Do not use it for commands:
hugo serveris inline code;Ctrlis a key.
Related
- Keyboard navigation — the full shortcut list and its switches
- Command palette — what Ctrl with K opens
- Badges — the other inline shortcode
- Steps — the container for instructions