Skip to content

Pages and sections

Every page exists in each configured language: /services, /de/services, /id/services.

Page Route File in src/pages/[...lang]/ Content from
Home / index.astro Projects, journal, dictionary
Work /work work.astro Projects
Case study /case-study/[slug] case-study/[slug].astro One project, in its chosen layout
Services /services services.astro Dictionary: disciplines, prices, FAQ
Studio /studio studio.astro Dictionary
Careers /careers careers.astro Roles
Contact /contact contact.astro Dictionary, site.ts
Journal /journal, /journal/2… journal/[...page].astro Articles
Article /journal/[slug] journal/[slug].astro One article
Tag /journal/tag/[tag] journal/tag/[tag].astro Articles with that tag
Privacy /privacy [legal].astro Legal Markdown
Imprint /imprint [legal].astro Legal Markdown

Three pages live outside [...lang] because they exist once: 404.astro (it translates itself from the URL), rss.xml.ts and styleguide.astro.

Delete its file, remove it from nav or footerNav in site.ts, and search the project for links to it (for example grep -r "/careers" src). Its dictionary section can stay; unused keys cost nothing.

As an example, an “Awards” page at /awards.

  1. Add its words to src/i18n/ui/en.ts:

    src/i18n/ui/en.ts
    awards: {
    title: 'Awards',
    description: 'Recognition for work we made with our clients.',
    heading: 'Recognition, shared with our clients.',
    },

    Then add the same keys to de.ts and id.ts. npm run check points at any dictionary that is missing them.

  2. Create src/pages/[...lang]/awards.astro:

    src/pages/[...lang]/awards.astro
    ---
    import type { Locale } from '@/i18n/config';
    import { localeStaticPaths, t } from '@/i18n/utils';
    import BaseLayout from '@/layouts/BaseLayout.astro';
    // One page per language: /awards, /de/awards, /id/awards.
    export const getStaticPaths = localeStaticPaths;
    interface Props {
    locale: Locale;
    }
    const { locale } = Astro.props;
    const a = t(locale).awards;
    ---
    <BaseLayout title={a.title} description={a.description}>
    <section class="container-page pb-section pt-12 md:pt-20">
    <h1 class="type-heading text-3xl md:text-4xl">{a.heading}</h1>
    </section>
    </BaseLayout>
  3. Link to it. Add { key: 'awards', href: '/awards' } to nav or footerNav in site.ts, and an awards label to the nav section of each dictionary.

  4. Optional: pass jsonLd to BaseLayout for structured data, as the other pages do.

BaseLayout gives the page the header, footer, theme and preset handling, meta tags, canonical URL and hreflang links for every language. The language switcher works on it straight away.

[legal].astro builds /privacy and /imprint from the legal collection. To add another legal page, say /terms, add terms.md to src/content/legal/ (and to de/, id/), add 'terms' to the list of slugs in [legal].astro, and link it from legalNav. See Careers and legal.

SwiftAgency is made byLessCodexLicence