The Sitemap app generates a sitemap.xml file for your store website, helping search engines like Google discover and index your pages more efficiently.
Once the app is installed and configured, your sitemap is automatically generated and kept up to date based on your store's routes and settings.
Before you begin
Use Edition App 3.x or later
Sitemap is available for stores using vtex.edition-store@3.x or a later version of the Edition app.
To check which Edition App is installed on your account, run vtex edition get. If it's an older edition, please open a ticket with VTEX Support to request the installation of the vtex.edition-store@5.x Edition App.
Configure sitemap content
Adjust the products, navigation, and custom routes that will be included in the sitemap. Check the Advanced configuration section for more information.
Instructions
For all stores
-
Using your terminal and the VTEX IO CLI, log in to your account.
-
Run
vtex use {workspaceName} --productionto use a production workspace or create a production workspace from scratch.Remember to replace the values in curly brackets with the values that apply to your scenario.
-
Run
vtex install vtex.store-sitemap@2.xto install the Sitemap app.If you are using
vtex.edition-store@5.x, skip step 3, as thevtex.store-sitemap@2.xapp is installed by default with this version. Check our Edition App documentation to learn more about the different versions. -
Choose your path:
- Cross-border stores: Continue to Cross-border setup below
- Non-cross-border stores: Skip to Verify your sitemap
Cross-border setup
Skip this section if your store is not cross-border. For non-cross-border stores, these steps are performed automatically when you install
vtex.store-sitemap@2.x.
-
Run
vtex install vtex.admin-graphql-ide@3.xto install the GraphQL Admin IDE. -
In your browser, access the Admin and go to Store Settings > Storefront > GraphiQL IDE.
-
From the dropdown list, choose the
vtex.routes-bootstrap@0.xapp. -
If this isn't the first time you're generating the store sitemap or if no changes have been made to the store routes since the last time you generated the store sitemap, go to step 5. Otherwise, run the following query:
_10{_10bootstrap {_10brands_10categories_10}_10}The expected response body is:
_10{_10"data":{_10"bootstrap": {_10"brands": true,_10"categories": true_10}_10}_10} -
Now, from the GraphQL IDE dropdown list, select the
vtex.store-sitemap@2.xapp. -
Run the following query:
_10{_10generateSitemap_10}The expected response body is:
_10{_10"data": {_10"generateSitemap": true_10}_10}This means your sitemap will be available in a few minutes after it's processed and saved in our database.
The time taken to generate a sitemap is proportional to the number of products. For example, 60k products take about 30 minutes, while 5k products take about 5 minutes.
If you attempt to send a new request to the Sitemap API during store sitemap generation, the following message will be displayed:
_10Sitemap generation already in place_10Next generation available: <End-date>To force a restart, add the
forceargument to the query, as ingenerateSitemap(force: true). This will cancel the previous process.
Verify your sitemap
-
Check the sitemap generated for the current workspace you're working on by accessing
https://{workspace}--{account}.myvtex.com/sitemap.xmlin your browser.Different
.xmlfiles are generated based on their entity type (product, category, subcategory, user routes, brand, and department), and each.xmlfile supports a maximum of 5k routes. If you have a cross-border store, you'll first see an index with a sitemap for each locale. -
If you're happy with the results, run
vtex promoteto promote your workspace and include your sitemap in your master workspace.Once you've promoted your workspace, no further action is needed on your part: You're ready to check the store sitemap by accessing
https://{account}.myvtex.com/sitemap.xmlin your browser.
Advanced configuration
Managing routes
You can decide whether to include products, navigation, apps, and/or routes that contain a specific term in your sitemap. To do that, follow the instructions below:
-
In your browser, type
{workspace}--{account}.myvtex.com/admin, replacing the values in curly brackets with values that apply to your scenario, to access the VTEX Admin of the production workspace you're working on. -
Go to Account settings > Apps > My apps and search for the Sitemap app.
-
Enable or disable products, navigation, apps, or routes containing a specific term for your scenario.
Enabling custom routes
If you have custom pages configured in a routes.json file and want them included in the store sitemap, add isSitemapEntry=true as a prop of the routes you want to include in the sitemap. Example:
_10{_10 "store.custom#about-us": {_10 "path": "/about-us",_10 "isSitemapEntry": true_10 }_10}
Once everything is set up, return to the Instructions and follow the steps for your store type.
Extending the sitemap
To add custom routes created by an app (for example, the ones created by store-locator) to the store sitemap, the app must respond to an XML file containing a list of the routes created by that app. Finally, add the path of your app's XML file to the store sitemap index.
For implementation details, check the following instructions:
-
Create or modify your app to respond to the following route
/sitemap/{index-name}.xmland return an XML file containing the data you want the search engine (for example, Google) to index. Replace the values inside the curly brackets based on your scenario.We recommend using a pre-generated XML file. Otherwise, the XML file will be built from scratch for every request, which will take longer to complete.
-
Publish and install your app in a production workspace.
-
To make your index available in the sitemap root file (
/sitemap.xml), access the VTEX Admin of the workspace you're working on, and select the GraphQL IDE. -
From the dropdown list, choose the
vtex.store-sitemap@2.xapp and run the following mutation, adapting it to your scenario:_10mutation {_10saveIndex(index: "{index-name}")_10}If you have a cross-border store, the
saveIndexmutation also accepts thebindingID as an argument, which means that by specifying thebindingID, you can add your new index to the sitemap of the desired binding. If thebindingID is not specified, the mutation will consider the default binding of the store. -
Check the updated sitemap for the current workspace you're working on by accessing
https://{workspace}--{account}.myvtex.com/sitemap.xmlin your browser. -
If you're happy with the results, run
vtex promoteto promote your workspace and include the sitemap in your master workspace.
Removing a custom route
If you want to remove a custom route, execute the following mutation, which takes the same arguments as saveIndex:
_10mutation {_10 deleteIndex(index: "{index-name}")_10}
Fetching custom routes in JSON format
The vtex.store-sitemap app exposes an API endpoint that allows you to retrieve route data in JSON format. This endpoint is useful for external sitemap generation or custom indexing workflows.
The endpoint returns a combination of routes defined via CMS and internal pages, and those defined by installed apps in their build.json files.
Product, brand, and category routes are not included.
| Method | Endpoint |
|---|---|
GET | /_v/public/sitemap/custom-routes |
Example request:
_10GET https://{workspace}--{account}.myvtex.com/_v/public/sitemap/custom-routes
Example response:
Custom route generation is subject to internal limits. If you notice missing routes in the response, please contact VTEX Support.
_10 [_10 {_10 "name": "apps-routes",_10 "routes": ["/store-locator/ny", "/store-locator/ca"]_10 },_10 {_10 "name": "user-routes",_10 "routes": ["/about-us", "/contact", "/faq"]_10 }_10 ]