feat: sitemap
- also compress missing.svg - add missing environment variable to .env.example
This commit is contained in:
parent
afbffd4606
commit
c020f1b95a
3 changed files with 79 additions and 23 deletions
|
|
@ -3,6 +3,7 @@ BASE_URL=https://tomodachi-share.trafficlunar.net
|
||||||
|
|
||||||
NEXTAUTH_URL=https://tomodachi-share.trafficlunar.net # This should be the same as BASE_URL
|
NEXTAUTH_URL=https://tomodachi-share.trafficlunar.net # This should be the same as BASE_URL
|
||||||
AUTH_SECRET=XXXXXXXXXXXXXXXX
|
AUTH_SECRET=XXXXXXXXXXXXXXXX
|
||||||
|
AUTH_TRUST_HOST=true
|
||||||
|
|
||||||
AUTH_DISCORD_ID=XXXXXXXXXXXXXXXX
|
AUTH_DISCORD_ID=XXXXXXXXXXXXXXXX
|
||||||
AUTH_DISCORD_SECRET=XXXXXXXXXXXXXXXX
|
AUTH_DISCORD_SECRET=XXXXXXXXXXXXXXXX
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 16.933 16.933"><path d="M5.106 6.024c-.137.357-.037.541.324.664l1.196.443c.374.123.499.049.673-.332.324-.714.623-1.046 1.284-1.046.586 0 .86.295.86.701 0 .812-.685.984-1.309 1.366-.536.32-1.047.812-1.047 1.981 0 .381.137.492.511.492H8.72c.374 0 .511-.111.511-.492 0-.295.187-.492.461-.677.748-.504 2.194-.898 2.194-2.694 0-1.501-1.209-2.559-3.29-2.559-1.932 0-2.966.873-3.49 2.153zm3.39 4.687h-.623c-.748 0-.985.234-.985.96v.431c0 .726.237.96.985.96h.623c.735 0 .972-.234.972-.96v-.431c0-.726-.237-.96-.972-.96z" fill="#ff8904" paint-order="stroke fill markers"/></svg>
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
|
|
||||||
<svg
|
|
||||||
width="64"
|
|
||||||
height="63.999996"
|
|
||||||
viewBox="0 0 16.933332 16.933332"
|
|
||||||
version="1.1"
|
|
||||||
id="svg1"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg">
|
|
||||||
<defs
|
|
||||||
id="defs1" />
|
|
||||||
<g
|
|
||||||
id="layer1">
|
|
||||||
<path
|
|
||||||
d="m 5.1060909,6.0241817 c -0.137,0.357 -0.037,0.541 0.324,0.664 l 1.196,0.44299 c 0.374,0.123 0.499,0.049 0.673,-0.33199 0.324,-0.714 0.62299,-1.046 1.28399,-1.046 0.586,0 0.86,0.295 0.86,0.701 0,0.81199 -0.685,0.98399 -1.309,1.36599 -0.536,0.32 -1.04699,0.812 -1.04699,1.98099 0,0.3810003 0.137,0.4920003 0.51099,0.4920003 h 1.122 c 0.374,0 0.511,-0.111 0.511,-0.4920003 0,-0.29499 0.187,-0.49199 0.461,-0.67699 0.7479901,-0.504 2.1939901,-0.898 2.1939901,-2.69399 0,-1.501 -1.209,-2.559 -3.2899901,-2.559 -1.93199,0 -2.96599,0.873 -3.48999,2.153 z m 3.38999,4.6869803 h -0.623 c -0.74799,0 -0.98499,0.234 -0.98499,0.96 v 0.431 c 0,0.72599 0.237,0.95999 0.98499,0.95999 h 0.623 c 0.735,0 0.972,-0.234 0.972,-0.95999 v -0.431 c 0,-0.726 -0.237,-0.96 -0.972,-0.96 z"
|
|
||||||
fill="#ff8904"
|
|
||||||
paint-order="stroke fill markers"
|
|
||||||
id="path6"
|
|
||||||
style="stroke-width:0.999996" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 645 B |
77
src/app/sitemap.ts
Normal file
77
src/app/sitemap.ts
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
import { prisma } from "@/lib/prisma";
|
||||||
|
import type { MetadataRoute } from "next";
|
||||||
|
|
||||||
|
type SitemapRoute = MetadataRoute.Sitemap[0];
|
||||||
|
|
||||||
|
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
||||||
|
const baseUrl = process.env.BASE_URL;
|
||||||
|
if (!baseUrl) {
|
||||||
|
console.error("BASE_URL environment variable missing");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const miis = await prisma.mii.findMany({
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
createdAt: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const users = await prisma.user.findMany({
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
updatedAt: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const dynamicRoutes: MetadataRoute.Sitemap = [
|
||||||
|
...miis.map(
|
||||||
|
(mii) =>
|
||||||
|
({
|
||||||
|
url: `${baseUrl}/mii/${mii.id}`,
|
||||||
|
lastModified: mii.createdAt,
|
||||||
|
changeFrequency: "weekly",
|
||||||
|
priority: 0.7,
|
||||||
|
} as SitemapRoute)
|
||||||
|
),
|
||||||
|
...users.map(
|
||||||
|
(user) =>
|
||||||
|
({
|
||||||
|
url: `${baseUrl}/profile/${user.id}`,
|
||||||
|
lastModified: user.updatedAt,
|
||||||
|
changeFrequency: "weekly",
|
||||||
|
priority: 0.7,
|
||||||
|
} as SitemapRoute)
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
const lastModified = new Date();
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
url: baseUrl,
|
||||||
|
lastModified,
|
||||||
|
changeFrequency: "always",
|
||||||
|
priority: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: `${baseUrl}/login`,
|
||||||
|
lastModified,
|
||||||
|
changeFrequency: "monthly",
|
||||||
|
priority: 0.6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: `${baseUrl}/privacy`,
|
||||||
|
lastModified,
|
||||||
|
changeFrequency: "yearly",
|
||||||
|
priority: 0.4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
url: `${baseUrl}/terms-of-service`,
|
||||||
|
lastModified,
|
||||||
|
changeFrequency: "yearly",
|
||||||
|
priority: 0.4,
|
||||||
|
},
|
||||||
|
...dynamicRoutes,
|
||||||
|
];
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue