---
name: astro-marketing-websites
description: Build maintainable Astro marketing/company websites with content collections, design tokens, performant motion, and Git-based content workflows.
version: 1.0.0
author: Hermes Agent
license: MIT
metadata:
  hermes:
    tags: [astro, marketing-sites, content-collections, static-sites, web-design, three-js, seo]
    related_skills: [writing-plans, design-md, popular-web-designs]
---

# Astro Marketing Websites

Use this skill when creating or extending a modern company/marketing website in Astro, especially when the site must be easy to maintain through Git/Markdown and may include subtle motion or Three.js enhancement.

## Core approach

1. **Start with strategy before scaffold**
   - Capture target audiences, priority services, conversion goal, region/SEO focus, trust signals, tone, and maintenance model.
   - Save decisions in `docs/brand-and-content-brief.md` or equivalent before coding.

2. **Use Astro for content-first company sites**
   - Astro is a strong default for static/hybrid business websites with pages like services, references/case studies, news, team, and contact.
   - Keep the first version simple: static pages + content collections + optimized assets.
   - Add heavy interaction only after the page hierarchy and conversion paths work.

3. **Prefer Content Collections for maintainability**
   - Use collections for repeatable content: references/case studies, news/updates, team members, jobs, FAQs.
   - Store each entry as Markdown/MDX with frontmatter.
   - Include fields that support filtering and SEO: category, location, year/date, summary, hero image, gallery, featured flag.

4. **Use real images as soon as possible**
   - For construction/architecture/company sites, real project/team photos are major trust assets.
   - Placeholders are acceptable early, but make the structure ready for per-reference images.

5. **Design tokens first**
   - Put brand decisions in `DESIGN.md` or another token source.
   - Translate tokens into CSS variables early: colors, fonts, spacing, radii, focus styles.
   - Validate contrast and keep brand accents restrained.

## Astro v5/v6 Content Collections pattern

Astro’s newer content API uses `src/content.config.ts` plus loaders. Avoid legacy `src/content/config.ts` if the installed Astro version reports `LegacyContentConfigError`.

Recommended shape:

```ts
// src/content.config.ts
import { defineCollection, z } from 'astro:content';
import { glob } from 'astro/loaders';

const references = defineCollection({
  loader: glob({ pattern: '**/*.md', base: './src/content/references' }),
  schema: z.object({
    title: z.string(),
    category: z.string(),
    location: z.string(),
    year: z.string(),
    summary: z.string(),
    heroImage: z.string(),
    gallery: z.array(z.string()).default([]),
    featured: z.boolean().default(false),
  }),
});

export const collections = { references };
```

When using `glob` loaders, route slugs are typically exposed as `entry.id`, not `entry.slug`.

```astro
---
import { getCollection } from 'astro:content';
const references = await getCollection('references');
---
{references.map((reference) => (
  <a href={`/referenzen/${reference.id}/`}>{reference.data.title}</a>
))}
```

Dynamic routes:

```astro
---
import { getCollection, render } from 'astro:content';

export async function getStaticPaths() {
  const references = await getCollection('references');
  return references.map((reference) => ({
    params: { slug: reference.id },
    props: { reference },
  }));
}

const { reference } = Astro.props;
const { Content } = await render(reference);
---
<Content />
```

## Development server for client review

When the user wants to review progress from another device, run Astro on all interfaces:

```bash
npm run dev -- --host 0.0.0.0
```

Then discover the local IP and share:

```bash
hostname -I | awk '{print $1}'
```

If an older dev server is bound to `127.0.0.1`, stop/restart it. Verify with:

```bash
ss -ltnp | grep ':4321'
curl -I http://127.0.0.1:4321/
```

If mobile cannot reach the URL, suspect network/VPN/firewall routing and offer a tunnel rather than changing the site.

## Subtle Three.js / animated logo pattern

Use Three.js as progressive enhancement, not as a dependency for core content.

Recommended pattern:

- Keep a normal `<img>` logo fallback visible by default only when it is not visually competing with the WebGL version.
- Add a `<canvas>` for the enhanced Three.js version.
- Respect `prefers-reduced-motion` and skip WebGL when reduced motion is enabled.
- Dynamically import Three.js inside the initializer: `await import('three')`.
- For hero-background brand marks, prefer **one visual source of truth**: either the canvas renders the logo, or the DOM image renders it — not both. If the canvas is the hero visual, remove/hide the separate hero `<img>` once the WebGL design is stable.
- For premium parallax, track pointer target values separately from current values, ease toward them in `requestAnimationFrame`, and apply small opposing transforms to logo and plan/grid layers. Keep values subtle: translation under ~0.5rem/0.5 Three units, rotation under ~10–15 degrees equivalent.
- Mark the wrapper as ready only after the texture loads.
- Dispose geometries/materials/renderers during page transitions or teardown.
- Keep hover/timing effects subtle; for serious company sites, animation should feel premium, not playful.

Pitfalls:

- Do not layer a static logo `<img>` directly over a Three.js logo unless it is intentionally a fallback gated by a ready state. Users will read it as “two logos stacked”, not depth.
- If the client says a hero image “lies separately/sideways”, remove the competing DOM visual first and let the background/concept own the stage before adding more decoration.
- Dynamic import reduces initial coupling, but Vite may still warn about large chunks. Treat that as an optimization task, not a build failure; later code-split or conditionally mount only where the effect appears.

## Premium motion design for local-service marketing sites

When the user asks for more immersive UX/UI motion, first make the motion system coherent rather than adding isolated effects.

- Define central motion tokens in global CSS (`--ease-gasser`, `--ease-wipe`, `--duration-fast`, `--duration-page`, `--duration-hero-intro`) before editing individual components.
- For construction/architecture heroes, build a narrative scene: blueprint grid → drawing measurement lines → material/build segments → brand-color scan/accent → subtle particles/dust. Keep it premium and slow enough to feel precise.
- Orchestrate hero layers together: WebGL/canvas background, DOM media panel, text intro, CTA, and tags should feel like one stage. A static or tilted photo beside a moving background often reads as disconnected.
- Use CSS-first hero-panel motion where possible: gentle Ken Burns, drawn frame, tag stagger, and tiny pointer parallax. Avoid playful bounce/loop effects on serious company sites.
- Add scroll/pointer response with restraint: different depths for layers, small camera zoom/tilt on scroll, and eased pointer targets. Avoid large rotations or motion that competes with copy.
- First post-hero section pitfall: do **not** hide the first section heading/cards with reveal animations if it creates a large blank area under the hero. Keep the first service section visible or reveal only later sections.
- Respect `prefers-reduced-motion`; preserve the composition even when motion is reduced.

## Astro page transitions

Prefer Astro `ClientRouter` / View Transitions for real page transitions instead of a click-only wipe.

- Use Astro lifecycle events (`astro:before-preparation`, `astro:after-swap`, `astro:page-load`) to coordinate exit, wipe, and enter phases.
- A good construction-site transition: old `main` exits subtly, a short diagonal concrete/Bordeaux/blueprint wipe covers the swap, new `main` enters with a restrained stagger.
- Use click handling only as a guard/classifier for internal navigable links. Exclude external links, hash-only links, downloads, `mailto:`, `tel:`, modified clicks, and non-left-clicks.
- Guard against duplicate overlay/style initialization across client-router swaps.
- Test back/forward and reduced motion, not only normal clicks.

## Animated navigation for marketing sites

Use microinteractions to support orientation without making the site feel like a toy:

- Sticky header may become more compact or darker after a small scroll threshold.
- Hide-on-scroll-down / reveal-on-scroll-up is acceptable on content-heavy pages, but keep transitions fast (~250–350ms) and ensure hover/focus restores clarity.
- Nav links can use a restrained underline, small brand-color marker, and 1–2px lift on hover/focus.
- A subtle header sheen/glass effect is fine for premium craft/architecture/construction sites; avoid continuous looping animations in the header.
- Next-level improvement: add active-section highlighting via `IntersectionObserver` after the main page anchors are stable.

See also:

- `references/gasser-hero-parallax-navigation.md` for a concrete session note on removing duplicate hero logos and converting the brand mark into a single pointer-reactive 3D background.
- `references/gasser-motion-design-transitions.md` for a concrete session note on immersive Blueprint-to-Build hero motion, Astro View Transitions, reveal pitfalls, and visual QA.

## Page structure defaults for local service businesses

Common navigation:

- Home
- Services / Leistungen
- References / Referenzen
- About / Über uns
- News / Aktuelles
- Contact / Kontakt

Home sections:

1. Hero with value proposition, region, and primary CTA.
2. Priority services.
3. Trust/value proof points.
4. Featured references.
5. Team/trust teaser.
6. News/updates teaser.
7. Contact CTA.

## Verification checklist

Before reporting progress:

- `npm run build` passes.
- Dynamic routes are generated for content entries.
- Dev server is reachable if the user asked to review externally.
- Browser QA confirms visible cards/sections, not just HTML output.
- Mobile/reduced-motion implications are considered for animation.
- Git is clean or changes are committed/pushed when working in a repo.

## Linked references

- `references/truetraceshorts-companion-page-rendering-pitfalls.md` — TrueTraceShorts Astro companion-page rendering QA: 9:16 related-card thumbnails, checklist-title fallbacks, root verification HTML files, and build/live checks.

- `references/gasser-website-session.md` — concrete session notes from building an Astro company website with animated Three.js logo and content collections.
- `references/truetraceshorts-scam-safety-hub-mvp.md` — static Astro MVP pattern for short-form scam-safety brands where videos are hooks and the website provides companion guides, checklists, SEO, and trust-first monetization structure.
- `references/truetraceshorts-brand-polish.md` — brand-asset integration and channel-hub polish pattern: Drive logo/banner assets, tokenized palette updates, homepage video-to-guide flow, companion-page action anchors, visitor-first help routing, and library future states.
- `references/truetraceshorts-visitor-first-help-landing.md` — TrueTraceShorts visitor-first homepage correction: immediate situation CTAs, multi-channel arrival routing, and avoiding owner/system-facing copy.
- `references/truetraceshorts-brand-asset-integration.md` — TrueTraceShorts-specific brand asset integration: Drive logo/banner, dark navy + cyan/yellow palette, hero/background usage, and Astro public asset pattern.
- `references/truetraceshorts-start-frame-thumbnails.md` — Extract real 9:16 WebP start frames from approved AutoShorts MP4s, wire `thumbnail` fields, and verify images load in Astro companion pages.
- `references/truetraceshorts-homepage-carousel-typography.md` — TrueTraceShorts homepage polish pattern: replace overlapping start-frame collages with a 3-visible-card scroll-snap carousel, tune heading clamps/alignment, and verify carousel/detail-page legibility.
- `references/truetraceshorts-printable-pdf-checklists.md` — TrueTraceShorts companion checklist correction: no TXT downloads, use detailed topic-specific checklist items and a clean Save-as-PDF/print flow with print CSS and wrapping QA.
- `references/truetraceshorts-production-pipeline-seo-trust.md` — TrueTraceShorts production-sprint pattern: YouTube audit-to-site sync, sitemap/robots/JSON-LD baseline, trust-first tools page, and route/browser QA.
- `references/google-search-console-cloudflare-pages-verification.md` — Astro/Cloudflare Pages Google Search Console HTML verification workflow: place exact file in `public/`, build, deploy, and verify live byte-for-byte.
- `references/truetraceshorts-cloudflare-pages-launch-qa.md` — TrueTraceShorts Cloudflare Pages static deploy setup, Worker-vs-Pages pitfall, auto-deploy verification, live leak scan, recovery panel centering, and final custom-domain launch sequence.
- `references/truetraceshorts-public-legal-pages-and-verification-assets.md` — TrueTraceShorts public Terms/Privacy boundary, footer trust links, and Astro `public/` root verification TXT workflow for platform domain checks.
- `references/truetraceshorts-centered-recovery-panels.md` — TrueTraceShorts recovery-page panel alignment: center `Do this first / Next 5 minutes` cards on `/already-clicked/` and `/safety/`, avoid lopsided grid ratios, and keep recovery no-shame copy consistent.
- `references/truetraceshorts-public-legal-and-app-review-boundary.md` — TrueTraceShorts public Terms/Privacy pattern: keep legal pages trust-first and implementation-minimal, keep TikTok/app-review technical details in private docs, and run public OpSec/leak scans before shipping.