#How can configure a Dynamic Sitemap under the Sitemap Index?

8 messages · Page 1 of 1 (latest)

zenith perch
#

Hello, I recently completed migrating from vue3 to nuxt3, and now I'm trying to apply a dynamic sitemap.

The URL category is divided into 10 types of URL structures as shown below.
https://bangab.co.kr
https://bangab.co.kr/apt/{dynamicVar}
https://bangab.co.kr/apt_gab/{dynamicVar}
https://bangab.co.kr/office/{dynamicVar}
https://bangab.co.kr/office_gab/{dynamicVar}
https://bangab.co.kr/lotto/{dynamicVar}
https://bangab.co.kr/static/{dynamicVar}
https://bangab.co.kr/news

I have installed it with the command (npm install -D nuxt-simple-sitemap), and I want to configure a sitemap index to create a sitemap for the above 8 types of URLs by category.

I would like to fill in the sitemap contents by calling the backend api (https://api.bangab.co.kr/api) for each sitemap item in the sitemap index, but I am not sure how to do this.
Also, since the capacity for each sitemap is too large, would it be a good idea to enable gzip? If it's a good idea to enable gzip, please tell me how.
I want to collect a new site map every day, and change it to the collection date like lastmod: new Date().

Therefore, when you access https://bangab.co.kr/sitemap.xml, the sitemap index appears, and when I enter the sub-sitemap.xml, I want to see a list of URLs.

tell me how Please.

The source code below is the part where sitemap should be applied inside nuxt.config.js.

import { defineNuxtConfig } from "nuxt/config";
export default defineNuxtConfig({
...
modules: [
"@element-plus/nuxt",
"nuxt-simple-sitemap",
"nuxt-simple-robots",
"nuxt-seo-experiments",
],
...
sitemap: {
// provide dynamic URLs to be included
urls: async () => {
const data = [
{ id: "1", name: "AptGab1" },
{ id: "2", name: "AptGab2" },
{ id: "3", name: "AptGab3" },
];
return data.map((item) => ({
loc: /test/${item.id},
lastmod: new Date(),
changefreq: "daily",
priority: 0.8,
}));
},
},
});

proper vapor
#

Did you read the docs?

zenith perch
#

Thank you for good information.
I tried searching on Google and it didn't work,
Let’s apply it again following the guide above.

proper vapor
#

Sure, let me know if you get stuck

zenith perch
zenith perch
#

Hello, I tried applying it by referring to the page you mentioned, but it seems that the sitemap index is not applied. Is there any sample source code for creating a sitemap index using nuxt3?
Currently, if you go to bangab.co.kr/sitemap.xml, the sitemap index appears, and it would be nice to have it as shown below.
Dynamic URL works well, but I'm not sure how to apply sitemap index.
plz help me...

ex)
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> ... <sitemap> <loc>https://bangab.co.kr/sitemaps/villaSales_3.xml</loc> <lastmod>2023-09-17</lastmod> </sitemap> ... </sitemapindex>