Update Filter Section (#4455)

Add brief explanation and example of filtering multiple pages.
This commit is contained in:
Adam 2022-08-24 13:14:50 -07:00 committed by GitHub
parent 8b00456765
commit 62d98e4af3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -141,6 +141,21 @@ __`astro.config.mjs`__
The function will be called for every page on your site. The `page` function parameter is the full URL of the page currently under considering, including your `site` domain. Return `true` to include the page in your sitemap, and `false` to leave it out.
To filter multiple pages, add arguments with target URLs.
__`astro.config.mjs`__
```js
...
sitemap({
filter: (page) =>
page !== "https://stargazers.club/secret-vip-lounge-1" &&
page !== "https://stargazers.club/secret-vip-lounge-2" &&
page !== "https://stargazers.club/secret-vip-lounge-3" &&
page !== "https://stargazers.club/secret-vip-lounge-4",
}),
```
### customPages
In some cases, a page might be part of your deployed site but not part of your Astro project. If you'd like to include a page in your sitemap that _isn't_ created by Astro, you can use this option.