Skip to content

Commit

Permalink
🔍 Fixes sitemaps
Browse files Browse the repository at this point in the history
i18n's getTranslations doesn't work
  • Loading branch information
aruke committed Feb 24, 2024
1 parent 207d043 commit 21504e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
9 changes: 4 additions & 5 deletions apps/kanji.sh/app/[locale]/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { getTranslations } from 'next-intl/server';
import { Config } from '../../src/config';
import { MetadataRoute } from 'next';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const config = await getTranslations('config');
return ['about', 'read', 'write'].map((page) => ({
url: `${config('baseUrl')}/${page}`,
// TODO: Read baseUrl from ${config('baseUrl')}
const baseUrl = 'https://kanji.sh';
return ['', 'about', 'read', 'write'].map((page) => ({
url: `${baseUrl}/${page}`,
lastModified: new Date(),
changeFrequency: 'weekly',
priority: 1
Expand Down
5 changes: 2 additions & 3 deletions apps/kanji.sh/app/[locale]/write/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { METADATA } from 'apps/kanji.sh/src/metadata';
import { getTranslations } from 'next-intl/server';
import { MetadataRoute } from 'next';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const config = await getTranslations('config');
const basePath = `${config('baseUrl')}/write`;
// TODO: Read baseUrl from ${config('baseUrl')}
const basePath = 'https://kanji.sh/write';

const collectionPaths: string[] = [];
const filePaths: string[] = [];
Expand Down
3 changes: 3 additions & 0 deletions apps/kanji.sh/public/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ Allow: /
Disallow: /api/
Disallow: /_next/
Disallow: /_error/

Sitemap: https://kanji.sh/en/sitemap.xml
Sitemap: https://kanji.sh/en/write/sitemap.xml

0 comments on commit 21504e9

Please sign in to comment.