mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-09-27 19:41:46 +00:00
fix: use api URL instead of frontend in sitemap-index.xml
i'm stoopid
This commit is contained in:
parent
253edc0d1a
commit
041689392b
2 changed files with 4 additions and 3 deletions
|
|
@ -2,8 +2,10 @@ import { prisma } from "@/lib/prisma";
|
||||||
import { CHUNK_SIZE } from "../sitemap";
|
import { CHUNK_SIZE } from "../sitemap";
|
||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
|
||||||
|
export const revalidate = 43200; // update every 12 hours
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
const baseUrl = process.env.NEXT_PUBLIC_FRONTEND_URL!;
|
const apiUrl = process.env.NEXT_PUBLIC_BASE_URL!;
|
||||||
|
|
||||||
const total = await prisma.mii.count({
|
const total = await prisma.mii.count({
|
||||||
where: { in_queue: false, quarantined: false },
|
where: { in_queue: false, quarantined: false },
|
||||||
|
|
@ -11,7 +13,7 @@ export async function GET() {
|
||||||
const miiChunks = Math.ceil(total / CHUNK_SIZE);
|
const miiChunks = Math.ceil(total / CHUNK_SIZE);
|
||||||
const totalSitemaps = miiChunks + 1; // +1 for the static-routes sitemap
|
const totalSitemaps = miiChunks + 1; // +1 for the static-routes sitemap
|
||||||
|
|
||||||
const sitemapEntries = Array.from({ length: totalSitemaps }, (_, i) => `<sitemap><loc>${baseUrl}/sitemap/${i}.xml</loc></sitemap>`).join("");
|
const sitemapEntries = Array.from({ length: totalSitemaps }, (_, i) => `<sitemap><loc>${apiUrl}/sitemap/${i}.xml</loc></sitemap>`).join("");
|
||||||
|
|
||||||
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
const xml = `<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
import { Prisma } from "@prisma/client";
|
|
||||||
import type { MetadataRoute } from "next";
|
import type { MetadataRoute } from "next";
|
||||||
|
|
||||||
type SitemapRoute = MetadataRoute.Sitemap[0];
|
type SitemapRoute = MetadataRoute.Sitemap[0];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue