You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ability to link extra sitemaps(probably from other projects) to the sitemap-index.xml. You can filter out pages and add custom pages but not link other sitemaps.
Background & Motivation
I recently worked on a static site in astro, great experience. Then I moved to my next project, which again was another static site. As these are different projects, they'll have their individual sitemaps, but I just wanted to refer the sitemap of the second project and of those that I'll create in future in the first's one.
Goals
Have a lightweight and non-breaking change that'll help in generation of custom sitemaps via an optional field in the options object of the sitemap.
Worries
There can be unintentional collisions in the URLs by doing so, where we can simply ignore the duplicates.
Example
Example of how the config might look like.
/** @type {import("astro/config").AstroUserConfig} */import{defineConfig}from"astro/config";importsitemapfrom"@astrojs/sitemap"exportdefineConfig({integrations:[sitemap({extraSitemaps:[/* all the extra sitemaps that we want to refer here */]})]})
current workaround
For now, I am making use of a bash script during the CI to achieve this but it will be super handy to have an option to do this within the config itself.
# sitemap urls
SITEMAP_URLS=("https://a.com/p1/sitemap-index.xml""https://a.com/p2/sitemap-index.xml")
# sitemap index file
SITEMAP_FILE="./dist/sitemap-index.xml"
SITEMAP=$(cat $SITEMAP_FILE)# original sitemapforURLin"${SITEMAP_URLS[@]}";do# loop for adding the urls to the sitemapif!echo$SITEMAP| grep -qs "$URL";then
SITEMAP=$(echo "$SITEMAP"| sed "s#</sitemapindex>#<sitemap><loc>$URL</loc></sitemap></sitemapindex>#")fidone# final version of sitemapecho$SITEMAP>$SITEMAP_FILE
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Body
Sumary
Ability to link extra sitemaps(probably from other projects) to the
sitemap-index.xml
. You can filter out pages and add custom pages but not link other sitemaps.Background & Motivation
I recently worked on a static site in
astro
, great experience. Then I moved to my next project, which again was another static site. As these are different projects, they'll have their individual sitemaps, but I just wanted to refer the sitemap of the second project and of those that I'll create in future in the first's one.Goals
Have a lightweight and non-breaking change that'll help in generation of custom sitemaps via an optional field in the options object of the sitemap.
Worries
There can be unintentional collisions in the URLs by doing so, where we can simply ignore the duplicates.
Example
Example of how the config might look like.
current workaround
For now, I am making use of a bash script during the CI to achieve this but it will be super handy to have an option to do this within the config itself.
Beta Was this translation helpful? Give feedback.
All reactions