Add permalink anchors to every example#25
Conversation
Agent-Logs-Url: https://github.com/landro/platform-engineering/sessions/5dae896b-79ee-456d-aa02-b9a587b670c2 Co-authored-by: landro <45769+landro@users.noreply.github.com>
landro
left a comment
There was a problem hiding this comment.
Why are we using js? Jekyll must surely know how to iterate
landro
left a comment
There was a problem hiding this comment.
Why are we using js? Jekyll must surely know how to iterate
…amples Agent-Logs-Url: https://github.com/landro/platform-engineering/sessions/39045eb9-2555-4f23-bf75-a1ec5e497e64 Co-authored-by: landro <45769+landro@users.noreply.github.com>
Good call. Replaced the JavaScript with proper Jekyll/Liquid iteration (db0288b). The 20 examples in each of the 12 principle files are now stored as a structured |
Here's the rendered result: Normal state — examples render as numbered cards with the anchor hidden: Hover state — the link icon appears top-right of the card on hover, linking directly to e.g. All IDs ( |
Agent-Logs-Url: https://github.com/landro/platform-engineering/sessions/8a8b001e-15c3-41f9-8e71-cd0f1d72b664 Co-authored-by: landro <45769+landro@users.noreply.github.com>
Fixed in 14b5c91. The |
Here's the structural diff for one example item. The content is identical — the only additions are the Before — each <ol>
<li>
<p><strong>Scaffold with security baked in</strong> — Provide a <code>create-service</code> CLI command …</p>
</li>
…
</ol>After — each <ol>
<li id="example-1">
<span><strong>Scaffold with security baked in</strong> — Provide a <code>create-service</code> CLI command …</span>
<a href="#example-1" class="example-anchor" aria-label="Permalink to example 1">
<svg …/>
</a>
</li>
…
</ol>The CSS adds |




Each numbered example on principle pages lacked a stable URL fragment, making it impossible to link directly to a specific example.
Changes
examples/NN-*.md(all 12 files) — the numbered list of examples has been moved from the Markdown body into a structuredexamples:YAML front matter array. Each entry has atitleandbodykey. The Markdown body retains only the# Principle Nheading, blockquote, and## 20 Practical Examplessubheading._layouts/principle.html— iterates overpage.examplesusing a Liquid{% for %}loop, generatingid="example-N"on each<li>and appending a link-icon anchor at Jekyll build time. Enables deep links such as:assets/css/style.css— adds.example-anchorstyles: hidden by default, revealed onli:hover/:focus, aligned to the far right of the flex row viamargin-left: auto, using existing colour tokens.