From c40678ab38bcfa69b75acd8e405f504b3a4520eb Mon Sep 17 00:00:00 2001 From: Marc Beepath Date: Fri, 12 Jun 2026 21:17:58 +0100 Subject: [PATCH] feat: add back navigation links above page titles Section pages link home; detail pages link back to their index. Co-authored-by: Cursor --- _includes/back-link.html | 26 ++++++++++++++++++++++++++ _layouts/default.html | 1 + _sass/_biscuit.scss | 27 +++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 _includes/back-link.html diff --git a/_includes/back-link.html b/_includes/back-link.html new file mode 100644 index 0000000..5f04f0d --- /dev/null +++ b/_includes/back-link.html @@ -0,0 +1,26 @@ +{% assign back_href = nil %} +{% assign back_label = nil %} + +{% assign path = page.url | remove: 'index.html' %} +{% unless path == '/' %} + {% if path == '/projects/' or path == '/projects' or path == '/writings/' or path == '/writings' or path == '/films/' or path == '/films' or path == '/contact/' or path == '/contact' %} + {% assign back_href = '/' %} + {% assign back_label = 'Home' %} + {% elsif page.collection == 'projects' %} + {% assign back_href = '/projects' %} + {% assign back_label = 'Projects' %} + {% elsif page.collection == 'films' %} + {% assign back_href = '/films' %} + {% assign back_label = 'Films' %} + {% elsif page.categories contains 'writings' %} + {% assign back_href = '/writings' %} + {% assign back_label = 'Writings' %} + {% endif %} +{% endunless %} + +{% if back_href %} + + + {{ back_label }} + +{% endif %} diff --git a/_layouts/default.html b/_layouts/default.html index 17e1f5c..1b0165c 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -86,6 +86,7 @@
+ {% include back-link.html %} {{ content }}
diff --git a/_sass/_biscuit.scss b/_sass/_biscuit.scss index 8ab5ba5..1f66496 100644 --- a/_sass/_biscuit.scss +++ b/_sass/_biscuit.scss @@ -661,6 +661,33 @@ figcaption { } } +/* Back link above page titles */ +.back-link { + display: inline-flex; + align-items: center; + gap: 0.375rem; + margin-bottom: 1.25rem; + font-size: 0.875rem; + text-decoration: none; + color: rgb(var(--fg) / 0.5); + transition: color 0.25s ease, transform 0.25s cubic-bezier(0.25, 0.1, 0.25, 1); + + &:hover { + color: rgb(var(--fg)); + transform: translateX(-2px); + } + + &-icon { + flex-shrink: 0; + } +} + +@media (prefers-reduced-motion: reduce) { + .back-link:hover { + transform: none; + } +} + /* Shared prev/next nav cards (writings, films, projects) */ .post-nav { margin-top: 5rem;