Hi there,
Is there a way to programatically generate a sitemap for pages made in Builder?
Is the recommended way is to query all pages via the API?
Best regards,
Ismail
Hi there,
Is there a way to programatically generate a sitemap for pages made in Builder?
Is the recommended way is to query all pages via the API?
Best regards,
Ismail
Hi Ismail,
You’re correct, you can use our content API to query all the pages and, filtering out any duplicates, generate the sitemap.
Here’s an example of that query:
https://cdn.builder.io/api/v2/content/page?apiKey=YJIGb4i01jvw0SRdL5Bt&fields=data.url
You can paginate through results using the limit
and offset
params documented here https://cdn.builder.io/api/v2/content/page?apiKey=YJIGb4i01jvw0SRdL5Bt&field
Hi @kara,
I’m trying to filter out pages based on userAttributes but it doesn’t seem to work, e.g:
{
ampPage(options:{userAttributes:{storeView:"ftk_at_de"}}) {
data {
url
}
}
}
I get an empty array back. Seems like the filtering doesn’t work as expected. Could you have a look?
Thanks!
Hi @ismailp, I’ve passed this onto our engineering team and will provide you with an update soon!
@kara thanks for the update!
Hi ismail, try using target here:
ampPage(target:{storeView:"ftk_at_de"}) {
@aziz Same problem. Just get an empty array back when doing
ampPage(target:{storeView:"ftk_at_de"}) {
...
}
@ismailp just stumbled upon this post and wanted to close the loop, I know it has been awhile ! Were you ever able to figure this out? I tested in our API Explorer and was able to get the query you posted in your last comment to work:
Let me know if you were ever able to figure it out or have any other issues!
Hi! @aziz @TimG @kara @ismailp
I will update this old post, because the sitemap functionality should be highlighted in my opinion, maybe a step by step tutorial using with eg. next.js would be very appreciated, so everyone could boost the SEO of the apps built by builder easily.
Please let us know!
(Useful plugin: next-sitemap - npm)
Hey there,
Yep, this worked out for us but took quite a bit of time to achieve. What would be amazing was if Builder had the possibility to generate sitemaps for a specific domain automatically.
What’s your thoughts on this?
Thank you @ismailp and @radikris for this feedback! I think this would be a great idea to add to our ideas.builder.io feature request platform.
I will take this feedback to our team as well and let you know if we are able to prioritize and add to our roadmap. Will keep you posted !