Reputation: 11
I created website with NextJS 15 using app router and Strapi as my CMS and internationalization tool. Website works properly but my robots.txt and sitemaps generate wrong. They aren't accessible with typical website.com/robots.txt or website.com/sitemap.xml. I want at least robots to work because I want to index only one language. Any help is much appreciated.
I tried to change next-sitemap.config.js and to just create static robots.txt and sitemap.xml in a /public but nothing works.
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: "https://website.com.pl",
outDir: "public",
generateRobotsTxt: true,
sitemapSize: 100,
generateIndexSitemap: true,
exclude: ["/pl*", "/en*"],
robotsTxtOptions: {
policies: [
{
userAgent: "*",
allow: ["/", "/*"],
disallow: ["/pl", "/pl/*", "/en", "/en/*", "/admin"],
},
],
additionalSitemaps: [
"https://www.website.com.pl/sitemap.xml",
"https://www.website.com.pl/sitemap-0.xml",
],
},
};
Upvotes: 1
Views: 19