Skip to main content
HydroGo
FrontendsSEO

SEO

Canonical URLs, Open Graph, JSON-LD and sitemaps for a headless site.

HydroGo stores SEO fields and generates helpers, but your frontend emits the HTML. Because a server-rendered frontend renders on the server, crawlers see everything on first response.

Canonical, title and description

Pages and news carry title; news also has seo_title and seo_description. Prefer the SEO fields when present and always emit a canonical link based on your public origin, not the CMS origin.

SVELTE
<svelte:head>
  <title>{data.item.seo_title ?? data.item.title}</title>
  <meta name="description" content={data.item.seo_description ?? data.item.excerpt} />
  <link rel="canonical" href={data.canonical} />
</svelte:head>

Open Graph and social images

SVELTE
<svelte:head>
  <meta property="og:type" content="article" />
  <meta property="og:title" content={data.item.title} />
  <meta property="og:url" content={data.canonical} />
  <meta property="og:image" content="{cms}/og/{data.item.locale}/{data.item.slug}" />
  <meta name="twitter:card" content="summary_large_image" />
</svelte:head>

GET /og/{locale}/{slug} generates an Open Graph image for pages and articles. Configure fonts with seo.fonts_dir and the cache with seo.og_cache_dir.

JSON-LD structured data

TS
const jsonLd = {
  '@context': 'https://schema.org',
  '@type': 'NewsArticle',
  headline: item.title,
  datePublished: item.created_at,
  dateModified: item.updated_at,
  mainEntityOfPage: canonical,
  author: item.author_name ? { '@type': 'Person', name: item.author_name } : undefined,
};
// <script type="application/ld+json">{@html JSON.stringify(jsonLd)}</script>

Sitemaps

  • HydroGo serves /sitemap.xml, /sitemap-index.xml, /sitemap-pages.xml and /sitemap-articles.xml, built from published content.
  • If your public site lives on another origin, generate the sitemap in your frontend from listPages and listNews, so the URLs match your routes.
  • Use updated_at for <lastmod> and send cache-control: public, max-age=0, s-maxage=300.

Redirects and 404s

Fetch GET /api/v1/site/redirects at start-up or on a short cache and apply them in your frontend or edge. In the admin, the Not found tab lists URLs visitors requested that do not exist and converts them into redirects.

Do not index preview routes or staging copies. Send X-Robots-Tag: noindex for them and keep security headers strict on the CMS origin.