sitemap.xml or llms.txt, using either the Routes API or Index schemas.
Enterspeed doesn’t build these files (just like it doesn’t build any of your frontend code); it just exposes the data. The examples here show you two ways of accessing the data you need to build the files.
These examples are based on the following dataset:
Page source entities
Page source entities
The examples below only show how to get data from Enterspeed. You will need to implement the logic for building the
sitemap.xml or llms.txt file in your own application as this is not Enterspeed-specific but depends on your own application and framework.Using the Routes API
In this example we will be using the Routes API to get a list of all the active URL routes in your Enterspeed environment. The Routes API returns the URL and the last updated date for each route. So if that’s all you need for yoursitemap.xml, this is a simple solution that doesn’t require any extra schema or configuration in Enterspeed.
Below is a very simple page schema example, a schema you most likely already have in order to serve content to your frontend application.
The important part here is the URL route created in the routes method. This is the active route for the page and the route we will be fetching from the Routes API.
Be aware that the
updatedAt value returned from the Routes API is the last time the route was updated, not the last time the source entity was updated. If you need the last updated date for the source entity, you will need to use an index schema instead.url and updatedAt values to build your sitemap.xml.
The first request is made without a continuation token. Remember to keep fetching the next pages by passing the continuationToken from the response back in the X-Continuation-Token header, until continuationToken is null and you have retrieved all content.
The Routes API returns all active URL routes in your Enterspeed environment, so if you have other schemas creating URL routes, they will also be returned.Redirects are returned as routes too. These have the
redirect property set instead of null, so filter them out if you only want the canonical page URLs.Using index schemas
If you need more than just the URL and last updated date that are returned by the Routes API, you can use an index schema to index the exact properties you need.Note: Index schemas are a paid add-on.
pageIndex that contains the URL, the page title and the page description for each page source entity.
Be aware that the
_updatedAt value returned from the Query API is the last time the item in the index was updated, not the last time the source entity was updated. If you need the last updated date for the source entity, you will need to index the updatedAt field from the source entity or a custom date property from your source entity.url, title and description values to build your llms.txt file.
If you have more than 1000 pages, remember to keep fetching the next pages of the index until you have retrieved all content.