Every Velocity layout used to render its own Header and Footer. Those components live in src/components/layout/, and that folder belongs to Velocity: the upgrade replaces it.
That left you two bad options for a custom header. Edit Velocity’s files and lose the change on the next upgrade, or copy the header into each layout and keep the copies in sync by hand. And because each layout rendered its own, the blog, search and 404 pages couldn’t share one header.
Velocity 2.2 moves the header and footer into files you own.
SiteHeader and SiteFooter
New projects have a src/components/site/ folder with two files: SiteHeader.astro and SiteFooter.astro. Every layout renders them, so a change in one place reaches every page.
Out of the box, SiteHeader is a thin wrapper around Velocity’s Header with your defaults on it:
---
/**
* Your site's header. Every layout renders this file, so a change here reaches
* every page, and upgrades never overwrite it.
*/
import type { ComponentProps } from 'astro/types';
import Header from '@/components/layout/Header.astro';
type Props = ComponentProps<typeof Header>;
---
<Header position="fixed" size="lg" showActiveState showCta {...Astro.props} />Change the props, or replace the whole thing with your own markup. SiteFooter works the same way. Layouts pass their defaults through Astro.props, and anything you set after the spread wins on every page.
If your header isn’t fixed, or isn’t 4rem tall, set --header-offset in your theme. Page content uses it to clear the header, and you can set it to 0 for a sticky one.
Why this matters for upgrades
create-velocity-astro upgrade follows the files lists in velocity-manifest.json. In 2.2 they look like this for the files involved:
| List | What the upgrade does | Includes |
|---|---|---|
safe | Overwrites them, after backing up any you edited | src/components/layout/, src/layouts/, src/components/ui/, src/styles/tokens/ |
protected | Leaves them alone | src/components/site/, src/views/, src/styles/theme.css, src/components/patterns/ |
seed | Adds them if missing, never replaces them | src/components/site/, Section, PageHeader and MediaSlot |
The Header component stays Velocity’s, so it keeps getting fixes. SiteHeader, the file that decides how your site uses it, is yours. Because src/components/site/ is in the seed list, upgrading an older project adds the two files without touching anything you’ve built.
The same goes for agents. Velocity’s agent instructions now say to change the header or footer in src/components/site/, never in the layouts.
One manual step
Views are yours too, so the upgrade doesn’t edit them. If your project has src/views/BlogIndexView.astro from before 2.2, it still imports Header and Footer directly. The 2.2 migration note flags it: replace those imports and tags with SiteHeader and SiteFooter, and remove any position, size, showActiveState, showCta and layout props.
Components that follow your theme
A custom header is only half of making a site look like yours. 2.2 also makes more of Velocity’s components read from the theme instead of fixed values:
- Themes load last.
global.cssnow importstheme.cssafter every token file, so a theme can override any token, including the type scale. --brand-huerecolors the whole brand scale. The OKLCH steps are computed from it, so one number changes every shade.- Button uses
--primaryfor its primary variant, with--theme-radius-buttonand--theme-button-weightfor its corners and font weight. It also gainsleadingIconandtrailingIconprops. - Logo renders inline, so it picks up the theme’s colors, with
--logo-accentfor its accent.
There are three new patterns for building pages: Section, PageHeader and MediaSlot. They’re seeded into upgraded projects too, because the velocity-add-page skill now uses them in its examples.
Extension points for templates
Shortly before the shell, Velocity 2.1 added a few places where a template or project can customize Velocity without editing files that upgrades replace:
| File or prop | What it’s for |
|---|---|
src/styles/theme.css | Picks the active theme. It moved out of tokens/colors.css, which upgrades replace. |
src/config/collections.ts | Your own content collections, merged into content.config.ts |
Header’s breakpoint prop | Where the desktop nav replaces the mobile menu (md, lg or xl), for long or translated labels |
fonts in astro.config.mjs | BaseLayout now renders every registered family and preloads the first |
If you had switched themes in src/styles/tokens/colors.css, that upgrade restored the default. Set your theme in src/styles/theme.css instead; your edited file is in .velocity-backup/.
Fixes since 2.0
A few smaller releases went out around these features.
- 2.0.2: the footer logo failed contrast at mobile text sizes, scrollable code samples couldn’t be reached by keyboard, and the logo wasn’t marked decorative next to the site name. The axe tests now run at mobile size too, which is how the code sample bug was found. The demo’s hero now hydrates when it’s visible and serves a small local avatar.
- 2.0.3: the demo hardcoded a performance score of 100 that we hadn’t measured. The demo measured 84 on PageSpeed, so the claim is gone. Accessibility, best practices and SEO were measured at 100.
- 2.2.1: share images were only generated for routes and blog posts, so collection pages pointed at images that didn’t exist. Now every page gets one, using your logo and theme color, and the build fails if a page names a custom image that doesn’t exist. Upgrades get this with no config change.
2.2 also adds a unit test that fails when a literal translation key has no string, and the end-to-end tests now load every route in every locale.
Get it
Start a new project:
npm create velocity-astro@latestOr upgrade an existing one:
npm create velocity-astro@latest upgradeThe upgrade adds src/components/site/ and the new patterns, and updates the layouts to render them. Then update BlogIndexView.astro if your project has an older one, and make the header yours. If you’re working with an agent, the 2.1 post covers the skills it can use, and the release notes are on GitHub.