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"]. */}