generated from code-forge-io/open-source-stack
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Hi @AlemTuzlak, first of thanks for the package!
I do not know if its only related to RR7 or Remix v2 aswell, but when I use the following code to generate the sitemap, the generateRemixSitemap helper function returns duplicate links. Any chance to fix this or do you know why that is happening?
import { generateRemixSitemap } from "@forge42/seo-tools/remix/sitemap";
import type { Route } from "./+types/sitemap.xml";
import { href } from "react-router";
export const loader = async ({ request }: Route.LoaderArgs) => {
const { routes } = await import("virtual:react-router/server-build");
const sitemap = await generateRemixSitemap({
domain: new URL(request.url).origin,
ignore: [href("/api/chat"), href("/legal-notice"), href("/privacy-policy")],
// @ts-expect-error Type mismatch, maybe related to a stricter type mentioned in release notes for v.7.0.0
// https://github.com/forge-42/seo-tools/issues/8
routes,
});
return new Response(sitemap, {
headers: {
"Content-Type": "application/xml",
},
});
};// routes.ts
import {
type RouteConfig,
index,
layout,
prefix,
route,
} from "@react-router/dev/routes";
export default [
layout("routes/layout.tsx", [
index("routes/index.tsx"),
...
route("sitemap.xml", "routes/sitemap.xml.ts"),
route("robots.txt", "routes/robots.txt.ts"),
]),
] satisfies RouteConfig;The generated sitemap:
<url>
<loc>http://localhost:5173/</loc>
</url>
<url>
<loc>http://localhost:5173/</loc>
</url>
<url>
<loc>http://localhost:5173/chat</loc>
</url>
<url>
<loc>http://localhost:5173/blog</loc>
</url>
<url>
<loc>http://localhost:5173/</loc>
</url>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels