← writing
28 July 2026

Astro: from a CV to a static site

The full path, for an independent worker or an association: turning a profile and an idea for a logo into a site one person can maintain. The code matters more than the hosting.

At the start, two things: a LinkedIn profile or a CV, and a graphic idea. At the end, a bilingual static site with no database, no server and no client-side framework. What follows describes the steps, with the relevant code.

01extracting the CV into data

The temptation is to write your experience directly in HTML. That is the mistake that costs most later: every date correction has to be made in two places, and a second language doubles the work. It is better to extract the CV once into typed data, which the pages then use.

typescript
// src/data/missions.ts
export interface Mission {
  id: string;
  client: string;        // identical in both languages
  stack: string;
  period: Bilingual<string>;   // 'mai — septembre 2025' / 'May — September 2025'
  title: Bilingual<string>;
}

export const MISSIONS: Mission[] = [
  {
    id: 'ocde',
    client: 'OCDE',
    stack: 'Microsoft Fabric · Power BI · Python',
    period: { fr: 'mai : septembre 2025', en: 'May: September 2025' },
    title: {
      fr: 'Cas d’usage RH sur Microsoft Fabric',
      en: 'HR use case on Microsoft Fabric',
    },
  },
];

A client name and a technical stack are not translated; a period and a title are. Separating them from the start avoids translating “Python” forty times. A detail page per engagement is then generated automatically.

astro
--- // src/pages/missions/[id].astro
import { MISSIONS } from '../../data/missions';

export function getStaticPaths() {
  return MISSIONS.map((m) => ({ params: { id: m.id }, props: { mission: m } }));
}
const { mission } = Astro.props;
---
<h1>{mission.title.fr}</h1>
02from the logo to design tokens

An idea for a logo does not make an identity. You need to produce the decisions that follow from it: how many inks, which weights, which sizes, which spacing. Once written as design tokens, those decisions become the single reference, and the rest of the site can no longer introduce new values.

css
/* tokens/colors.css — three inks and one paper, nothing else */
:root {
  --ink: #17171B;
  --paper: #F6F4EF;
  --accent: #C33A28;
}

/* The dark theme is a switch, not a filter:
   the accent lightens, it does not invert. */
:root[data-surface='ink'] {
  --ink: #F6F4EF;
  --paper: #17171B;
  --accent: #E8674C;
}

Watch for one trap. If a component hard-codes “black background, white text”, it disappears in dark mode, where black is the page colour. Inversion must be defined relative to the surface, not in absolute values.

css
:root                      { --surface-inverse: var(--ink);   --on-inverse: var(--paper); }
:root[data-surface='ink']  { --surface-inverse: var(--paper); --on-inverse: var(--ink);   }

.btn--primary {
  background: var(--surface-inverse);
  color: var(--on-inverse);
}
03the project structure

Astro fits because it outputs HTML and sends no JavaScript unless asked to. For a brochure site that is the right default: pages stay readable without scripts, and their weight does not grow with the number of components.

terminal
npm create astro@latest -- --template minimal
npm install

The build output is readable HTML: component styles are scoped by an attribute, and no <script> tag appears unless you write one.

html
<!-- dist/services/index.html — aucun script, aucun runtime -->
<article class="card" data-astro-cid-7f3k2p>
  <h2 class="card__title" data-astro-cid-7f3k2p>Construire</h2>
  <p class="card__note" data-astro-cid-7f3k2p>Applications web, plateformes analytiques.</p>
</article>

Global styles load once in the layout, and each component keeps its own styles in its own file. Astro scopes them automatically, with no naming convention to follow.

astro
--- // src/layouts/Base.astro
import '../styles/tokens.css';
const { title, lang } = Astro.props;
---
<html lang={lang}>
  <head><title>{title}</title></head>
  <body><slot /></body>
</html>
04two languages, no duplication

The expensive method is to duplicate the pages. The sustainable one is to write each page once and serve it through two routes: the content lives in a view, and the route files only pass the language.

astro
--- // src/pages/services.astro          (French, at the root)
import Services from '../views/Services.astro';
---
<Services lang="fr" />

--- // src/pages/en/services.astro       (English, prefixed)
import Services from '../../views/Services.astro';
---
<Services lang="en" />

The language switch must lead to the same page in the other language, not to the home page. Its two labels must also stay in the same order. If the current language is shown first, the labels swap places with every click and the control moves under the cursor.

typescript
export function alternatePath(path: string, lang: 'fr' | 'en') {
  const stripped = path.replace(/^\/en(?=\/|$)/, '') || '/';
  return lang === 'fr' ? `/en${stripped === '/' ? '' : stripped}` : stripped;
}
05making the rule executable

A brand guide that no check enforces remains an intention. Thirty lines of Node are enough to reject what the identity forbids: a hard-coded colour, an undeclared font, a shadow. The check runs before every publication, and it has already blocked code written ten minutes earlier.

javascript
// scripts/check-adherence.mjs
const RULES = [
  { id: 'hex',    re: /#[0-9a-fA-F]{3,8}\b/g, msg: 'hard-coded colour — use a token' },
  { id: 'shadow', re: /box-shadow:\s*(?!none)/g, msg: 'no shadow in the system' },
];

for (const file of walk('src')) {
  // Comments quote the values on purpose: neutralise them first.
  const text = stripComments(readFileSync(file, 'utf8'));
  text.split('\n').forEach((line, i) => {
    for (const rule of RULES) {
      if (rule.re.test(line)) findings.push(`${file}:${i + 1} ${rule.msg}`);
    }
  });
}
process.exit(findings.length ? 1 : 0);
json
"scripts": {
  "verify": "astro check && node scripts/check-adherence.mjs && astro build"
}
06inlining the symbols

A symbol loaded with an <img> tag cannot inherit the text colour: currentColor there refers to the file’s own default colour, not the page’s. In dark mode, every icon stayed black on black. The fix is to insert them directly into the document instead of linking them.

astro
--- // src/components/Schema.astro
const FILES = import.meta.glob('../assets/*.svg', {
  query: '?raw', import: 'default', eager: true,
});

const { name, height } = Astro.props;
const raw = FILES[`../assets/${name}.svg`];

// Strip width/height on the opening <svg> tag only:
// a global replace empties the <rect> elements inside as well.
const [, w, h] = raw.match(/viewBox="0 0 ([\d.]+) ([\d.]+)"/);
const width = Math.round((height * +w) / +h);
---
<span style="color: var(--ink)" set:html={resize(raw, width, height)} />
07publishing

This is the least interesting part, which is a good thing. A static site can be hosted anywhere. A private repository, a build job that refuses to publish if the check fails, a static host: three components, with no system administration.

yaml
- run: npm ci
- run: npm run verify        # types + adherence + build; a failure publishes nothing
- uses: cloudflare/wrangler-action@v3
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    command: pages deploy dist --project-name=mon-site
08what was ruled out
  • A CMS. The content fits in versioned files, and an editing interface would add a database to back up for three pages.
  • A client-side framework. Nothing on this site needs state management, and the only script is a few lines that change an attribute.
  • Email addresses in the pages, which bots collect first.
  • Audience measurement. Without cookies, there is no consent banner to provide.

For an association or an independent worker, what matters is being able to take the site up again in two years, more than putting it online. Typed data, design tokens and a check that blocks deviations make that possible.