From 868ef98ee898bfb214e8b244a0f4382f2d2f0e01 Mon Sep 17 00:00:00 2001 From: Magnus Madsen Date: Sat, 8 Aug 2026 20:12:25 +0200 Subject: [PATCH] feat: add a site-wide footer Nothing on the site linked to the playground, the book, the API, or Zulip from more than one page, and the licence was stated once, in a sentence on /contribute/. The footer collects those and travels with every page, which matters most on a phone, where the nav is behind the hamburger. Four columns - the brand, Learn, Project, and Community - over a bar with the licence, a per-page "Edit this page" link into this repo, and the JProfiler and IntelliJ thanks, which move here from the bottom of the home page. The columns wrap 2x2 rather than 2+1: the brand is last in the source and ordered first from md up, so nothing is left ragged on a narrow screen. The footer's internal entries derive from navLinks so a renamed route is changed once, and the build fails if a label goes missing rather than shipping undefined hrefs. The mark, previously inline in the navbar and needed again in the footer, becomes a shared component. .page becomes a flex column so the footer sits on the bottom edge of the card on short pages such as /404/. Co-Authored-By: Claude Opus 5 (1M context) --- src/components/FlixMark.astro | 19 +++++ src/layouts/Layout.astro | 131 +++++++++++++++++++++++++++++++--- src/pages/index.astro | 16 ----- src/styles/global.css | 10 +++ 4 files changed, 150 insertions(+), 26 deletions(-) create mode 100644 src/components/FlixMark.astro diff --git a/src/components/FlixMark.astro b/src/components/FlixMark.astro new file mode 100644 index 0000000..8e396c3 --- /dev/null +++ b/src/components/FlixMark.astro @@ -0,0 +1,19 @@ +--- +/** The mark from design/og.svg, the same one used by the favicon and the social + card. Inlined rather than fetched: it is two shapes, and a request for them + would cost more than they weigh. Shared by the navbar and the footer, which + draw it at different sizes. */ +interface Props { + size: number; +} + +const { size } = Astro.props; +--- + + diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 18dd140..7d1533f 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -25,6 +25,11 @@ const canonicalURL = new URL(currentPath, Astro.site); // Social cards need an absolute URL; relative paths are ignored by every scraper. const ogImageURL = new URL('/og.png', Astro.site); +// Every route is a flat file in src/pages, so the path is the filename: "/" is +// index, "/faq/" is faq, and the 404 handler prerenders at "/404". +const pageSlug = currentPath === '/' ? 'index' : currentPath.replace(/^\/|\/$/g, ''); +const editURL = `https://github.com/flix/flix.dev/edit/master/src/pages/${pageSlug}.astro`; + const navLinks = [ { href: "/", label: "Home" }, { href: "/get-started/", label: "Get Started" }, @@ -37,6 +42,59 @@ const navLinks = [ { href: "/internships/", label: "Internships" }, ]; +// The footer's internal entries come from navLinks so that a renamed route is +// changed in one place. Looking them up by label rather than href keeps the two +// lists from drifting silently: rename a label and the build stops here instead +// of shipping a footer full of undefined hrefs. +const page = (label: string) => { + const link = navLinks.find((navLink) => navLink.label === label); + if (!link) throw new Error(`Footer links to a missing nav page: ${label}`); + return link; +}; + +// What the columns add over the nav is the off-site half - the book, the API, +// the playground, releases, and the community - each of which otherwise appears +// on one page of the site. +const footerGroups = [ + { + title: "Learn", + links: [ + page("Get Started"), + page("Documentation"), + { href: "https://doc.flix.dev/", label: "Programming Flix" }, + { href: "https://api.flix.dev/", label: "Standard Library" }, + { href: "https://play.flix.dev/", label: "Playground" }, + page("VSCode"), + ], + }, + { + title: "Project", + links: [ + page("Principles"), + page("FAQ"), + { + href: "https://doc.flix.dev/research-literature.html", + label: "Research", + }, + { href: "https://github.com/flix/flix/releases", label: "Releases" }, + page("Contribute"), + page("Internships"), + ], + }, + { + title: "Community", + links: [ + { href: "https://github.com/flix/flix", label: "GitHub" }, + { href: "https://flix.zulipchat.com/", label: "Zulip" }, + { href: "https://blog.flix.dev/", label: "Blog" }, + { href: "https://x.com/flixlang", label: "Twitter" }, + { href: "https://perf.flix.dev/", label: "Perf Dashboard" }, + { href: "https://github.com/flix/flix.dev", label: "Website source" }, + ], + }, +]; + +import FlixMark from '../components/FlixMark.astro'; import '../styles/global.css'; --- @@ -90,17 +148,8 @@ import '../styles/global.css'; light-on-dark link and toggler colours off .navbar[data-bs-theme="dark"]. */}