From 904b29dfa998ca491590cee2241c9ef92e16355c Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Fri, 6 Nov 2026 18:40:14 +0100 Subject: Add permalinks to blog post headings This adds direct permalink links to Markdown headings, making it easier to share specific sections of a blog post. The links appear on hover or keyboard focus and remain visible on touch devices. They are excluded from Pagefind indexing to avoid unnecessary search content. --- assets/static/css/style.css | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'assets/static/css/style.css') diff --git a/assets/static/css/style.css b/assets/static/css/style.css index beb9cc3..c210a9b 100644 --- a/assets/static/css/style.css +++ b/assets/static/css/style.css @@ -653,6 +653,33 @@ article { color: var(--green); } + /* --- Heading permalinks --- */ + & :is(h2, h3, h4, h5, h6)[id] { + & > a[aria-label="Permalink"] { + color: var(--dim-foreground); + font-size: 0.75em; + opacity: 0; + text-decoration: none; + vertical-align: center; + + &:hover, + &:focus-visible { + color: var(--blue); + } + } + + &:hover > a[aria-label="Permalink"], + &:focus-within > a[aria-label="Permalink"] { + opacity: 1; + } + + @media (hover: none) { + & > a[aria-label="Permalink"] { + opacity: 1; + } + } + } + & blockquote { font-style: italic; border-left: 2px solid var(--blue); -- cgit v1.3.1