SeoLdPost

An SEO component to add JSON-LD structured data for a post.

This component works with SvelteKit only.

Props

PropRequiredDescription
valueyesType Post (post from a content collection).
originyesWebsite origin, e.g., https://maier.tech. Used for @id and mainEntityOfPage.

About

SeoLdPost emits a BlogPosting JSON-LD block in <svelte:head>. It is built from the Post’s frontmatter and from $app/state’s page.url (no extra props required for URL-aware fields).

Fields included:

  • headline, description, image (array), datePublished, dateModified (defaults to datePublished when lastmodDate is missing).
  • inLanguage is hardcoded to en.
  • mainEntityOfPage and @id are built from ${origin}${page.url.pathname} (no hash or query string), so they match the canonical URL emitted by SeoCanonicalUrl.
  • author is included when the post has an author.