Home App Docs Blog Github

Generate Sitemap

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!

Hey @kara

Any updates on this?

Best,
Ismail

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"}) {
    ...
}