Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

site

The site's public URL, of which only the origin is used, for absolute URLs in sitemap.xml, robots.txt and document.seo.

configuration Since 1.3.0

site is the site's public origin ("https://example.com", without a path). It is the origin for absolute URLs Meeko writes during the build: those in sitemap.xml, the Sitemap: line in robots.txt and, with document.seo, <link rel="canonical"> and og:url. Without site, the build uses MEEKO_PUBLIC_ORIGIN from its environment.

site is set at build time and does not change HTTP and Socket Origin checks: those still read MEEKO_PUBLIC_ORIGIN or publicOrigin from server/runtime.ts at runtime.

Usage#

ts
// meeko.config.ts
import { defineMeekoConfig } from "@meekojs/meeko/framework";

export default defineMeekoConfig({
  site: "https://example.com",
  sitemap: true,
  robots: true,
  document: { seo: true },
});

Type#

MeekoConfig.site

ts
readonly site?: string

Options#

Value Type Default Description
site string Build's MEEKO_PUBLIC_ORIGIN An absolute http: or https: URL without a path, query, fragment or credentials.

Result#

With site: "https://example.com":

xml
<!-- sitemap.xml -->
<url><loc>https://example.com/docs/api</loc></url>
texto
# robots.txt
User-agent: *
Allow: /
Sitemap: https://example.com/sitemap.xml
html
<!-- /docs/api with document.seo -->
<link rel="canonical" href="https://example.com/docs/api">

Examples#

One origin per environment#

ts
import { defineMeekoConfig } from "@meekojs/meeko/framework";

export default defineMeekoConfig({
  site: process.env.SITE_URL ?? "https://example.com",
  sitemap: true,
});
sh
SITE_URL=https://staging.example.com npm run build

Without site, using the build variable#

sh
MEEKO_PUBLIC_ORIGIN=https://example.com npx meeko build

The same variable later sets the origin for Origin checks in production.

Common mistakes#

A URL with a path#

Incorrectts
export default defineMeekoConfig({ site: "https://example.com/blog" });

meeko dev, meeko build, meeko check and meeko routes stop with …/meeko.config.ts: site must be an origin without path, query, fragment or credentials, such as "https://example.com". Hosting a site under a subpath is not supported.

Correctts
import { defineMeekoConfig } from "@meekojs/meeko/framework";
export default defineMeekoConfig({ site: "https://example.com" });

A domain without a scheme#

Incorrectts
export default defineMeekoConfig({ site: "example.com" });

…/meeko.config.ts: site must be an absolute URL such as "https://example.com".

Correctts
import { defineMeekoConfig } from "@meekojs/meeko/framework";
export default defineMeekoConfig({ site: "https://example.com" });

Expect site to fix Origin checks#

Incorrecttexto
site: "https://example.com" and the application behind a TLS proxy, without MEEKO_PUBLIC_ORIGIN at runtime

Mutations (with a session and, since 1.8, also without one) respond with 403 INVALID_ORIGIN: site is only used during the build. The origin for security checks is set at runtime.

Correcttexto
MEEKO_PUBLIC_ORIGIN=https://example.com when starting the server

Notes#

  • Build only. Changing site requires rebuilding; it is not read in production.
  • No origin. With sitemap, or with document.seo and canonical or ogUrl, and without site or MEEKO_PUBLIC_ORIGIN, meeko build stops before compiling; robots without sitemap does not need it.

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: docs/en/reference/config/config-site.md