Skip to content

StructuredData

The StructuredData component injects Schema.org JSON-LD scripts into the page <head>. It relies on centralized configuration helpers so SEO metadata stays consistent across the site.

  • Type: Utility component
  • Category: SEO
  • Complexity: Moderate
  • File: src/components/StructuredData.astro
  • Data config: src/data/structuredData.config.ts
  • Config-driven schemas - Generates JSON-LD from typed helpers
  • Selective output - Choose organization, website, and event schemas
  • Reusable in layouts - Default usage lives in the main layout
PropTypeRequiredDefaultDescription
schemas`(‘organization''website''event’)[]`No
  1. Import the component in a layout or page:

    ---
    import StructuredData from '@/components/StructuredData.astro';
    ---
  2. Render the default schemas (organization + website) in the layout:

    <StructuredData schemas={['organization', 'website']} />
  3. Render event schema in a page head slot when needed:

    <StructuredData schemas={['event']} slot="head" />

The schema helpers live in src/data/structuredData.config.ts and expose these generators:

  • generateOrganizationSchema()
  • generateWebSiteSchema()
  • generateTriennialGathering2026EventSchema()
  • generateStructuredData() (wrapper that returns an array)
  • Outputs one <script type="application/ld+json"> per schema
  • Uses set:html to inject JSON safely
  • Designed to be placed in the <head> via layout or slot
  • src/layouts/Layout.astro - Default organization and website schemas
  • src/pages/triennial-gathering-2026.astro - Event schema override

View the complete implementation:

https://github.com/poncardasm/finan-website/blob/main/src/components/StructuredData.astro
https://github.com/poncardasm/finan-website/blob/main/src/data/structuredData.config.ts