DE
Beta-Übersetzung

@core / seo

1.0.0 ▾
verifiziertMIT
GitHub

SEO für GenPM-Seiten: Metadaten mit Canonical und hreflang, geteilte Sitemaps, robots.txt, llms.txt, sicheres JSON-LD

Code9 DateienKontext~639 TokensPrüfung bestanden

Der genaue Baum, der nach .genpmignore eingebunden wird. Gepinnt an

src/lib/seo/url.tsschreibgeschützt · 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();
}

@core/seo melden

Melde dich mit GitHub an, um ein Paket zu melden.