2024-5-18
Entries such as personal notes should naturally be excluded from the menu list and hidden from search engines. In such cases, it is sufficient to exclude those URLs from the sitemap. The settings are as follows.
astro.config.mjs::
export default defineConfig({
site: "https://www.blender-ikkinomi.com/",
integrations: [preact(), tailwind(), mdx(), sitemap({
filter: (page) =>
page !== 'https://www.blender-ikkinomi.com/secret/' &&
page !== 'https://www.blender-ikkinomi.com/etc/first/' &&
page !== 'https://www.blender-ikkinomi.com/etc/en/first/',
})],
output: 'static',
...
}
To achieve this, you can add sitemap() to integrations and write a condition in the filter function to return false for the URLs you want to exclude. In this case, the pages with URLs secret, etc/first, and etc/en/first will be excluded from the sitemap.