FR
Traduction bêta

@core / seo

1.0.0 ▾
vérifiéMIT
GitHub

SEO pour sites GenPM : métadonnées avec canonique et hreflang, sitemaps découpés, robots.txt, llms.txt et JSON-LD sûr

Code9 fichiersContexte~639 tokensanalyse réussie

L’arborescence exacte qui sera injectée, après .genpmignore. Épinglée à

src/lib/seo/url.tslecture seule · cf4e3c3
// URLs absolutas a partir de SITE_URL.

export function siteUrl(env: Record<string, string | undefined> = process.env): URL {
  const raw = env.SITE_URL;
  if (!raw) throw new Error('SITE_URL is not set (see .env.example)');
  const u = new URL(raw);
  if (u.protocol !== 'https:' && u.hostname !== 'localhost') throw new Error('SITE_URL must use https');
  return u;
}

/** `/blog/x` → `https://example.com/blog/x`; las URLs absolutas se devuelven tal cual. */
export function absoluteUrl(pathOrUrl: string, base: URL = siteUrl()): string {
  return /^https?:\/\//.test(pathOrUrl) ? pathOrUrl : new URL(pathOrUrl, base).toString();
}

Signaler @core/seo

Connectez-vous avec GitHub pour signaler un paquet.