JA
ベータ版の翻訳

@core / seo

1.0.0 ▾
認証済みMIT
GitHub

GenPM サイトの SEO:canonical と hreflang 付きメタデータ、分割サイトマップ、robots.txt、llms.txt、安全な JSON-LD

コード9 ファイルコンテキスト約 639 トークンスキャン合格

.genpmignore 適用後に組み込まれる正確なツリーです。固定先:

src/lib/seo/url.ts読み取り専用 · 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 を報告

パッケージを報告するには GitHub でログインしてください。

GitHub で続ける