Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.8k
improvement(seo): optimize sitemaps, robots.txt, and core web vitals across sim and docs#4170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
2c6662cddb412e28137515798e80c2c9ad4File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import type { MetadataRoute } from 'next' | ||
| import { i18n } from '@/lib/i18n' | ||
| import { source } from '@/lib/source' | ||
| import { DOCS_BASE_URL } from '@/lib/urls' | ||
| export const revalidate = 3600 | ||
| export default function sitemap(): MetadataRoute.Sitemap { | ||
| const baseUrl = DOCS_BASE_URL | ||
| const languages = source.getLanguages() | ||
| const pagesBySlug = new Map<string, Map<string, string>>() | ||
| for (const { language, pages } of languages) { | ||
| for (const page of pages) { | ||
| const key = page.slugs.join('/') | ||
| if (!pagesBySlug.has(key)) { | ||
| pagesBySlug.set(key, new Map()) | ||
| } | ||
| pagesBySlug.get(key)!.set(language, `${baseUrl}${page.url}`) | ||
| } | ||
| } | ||
| const entries: MetadataRoute.Sitemap = [] | ||
| for (const [, localeMap] of pagesBySlug) { | ||
| const defaultUrl = localeMap.get(i18n.defaultLanguage) | ||
| if (!defaultUrl) continue | ||
| const langAlternates: Record<string, string> = {} | ||
| for (const [lang, url] of localeMap) { | ||
| langAlternates[lang] = url | ||
| } | ||
| langAlternates['x-default'] = defaultUrl | ||
| entries.push({ | ||
| url: defaultUrl, | ||
| alternates: { languages: langAlternates }, | ||
| }) | ||
| } | ||
| return entries | ||
| } |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const DOCS_BASE_URL = process.env.NEXT_PUBLIC_DOCS_URL ?? 'https://docs.sim.ai' |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.