Skip navigation

Use sitemaps to improve SEO and accessibility

Sitemaps inform your visitors about what pages you have on your website. A sitemap for your visitors is a page they can use to learn about the structure and content of your website. This helps them find the page they're looking for more easily which improves your website's accessibility.

Sitemaps for search engines are files with an unstructured list of pages. This kind of sitemaps helps to ensure search engines find all the important content on your website. That's essential for SEO – if a search engine finds and indexes what your potential visitors search for, they can find it using the search engine and become real visitors.

You can model a sitemap of your website in Kontent either using linked content items or by tagging your content with taxonomy. To build the sitemap in your app, you'll use the Delivery API to get the model of the sitemap from Kontent.

Table of contents

    Improving SEO with sitemaps

    When coming to your website, search engines first check whether you provide a sitemap. If you do, they index all the pages you list in the sitemap file. Sitemaps are particularly important for large websites with hundreds of pages. When a search engine is crawling your site, it may overlook some recently created or updated pages.

    Another case when it's useful to provide a sitemap is when your website contains a large number of pages that are not linked much from elsewhere. Here's what Google says about sitemapsOpens in a new window: providing a sitemap doesn't guarantee anything but your website will most likely benefit from having a sitemap and Google never penalizes a site for having one.

    A sitemap for search engines is an XML file that contains an unstructured list of URLs and doesn't reflect the hierarchy of your content.

    • XML
    <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.example.org/schemas/sitemap/0.9"> <url> <loc>https://www.mywebsite.org/home</loc> <lastmod>2020-01-08</lastmod> <changefreq>monthly</changefreq> </url> <url> <loc>https://www.mywebsite.org/shops</loc> <lastmod>2020-02-14</lastmod> <changefreq>weekly</changefreq> </url> <url> <loc>https://www.mywebsite.org/shops/brisbane</loc> <lastmod>2020-03-07</lastmod> <changefreq>weekly</changefreq> </url> </urlset>
    <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.example.org/schemas/sitemap/0.9"> <url> <loc>https://www.mywebsite.org/home</loc> <lastmod>2020-01-08</lastmod> <changefreq>monthly</changefreq> </url> <url> <loc>https://www.mywebsite.org/shops</loc> <lastmod>2020-02-14</lastmod> <changefreq>weekly</changefreq> </url> <url> <loc>https://www.mywebsite.org/shops/brisbane</loc> <lastmod>2020-03-07</lastmod> <changefreq>weekly</changefreq> </url> </urlset>

    An optimal sitemap contains only pages you deem worthy for your visitors. This means your sitemap shouldn't contain all pages, but just those valuable to your users in terms of content. For example, a Recover password page doesn't need to be in the sitemap because users are most likely not going to use a search engine to find this kind of page.

    A sitemap can also hold further information about your pages, such as how frequently you update them, when was the last update, or possibly even about alternate language versions of a particular pageOpens in a new window.

    Helping people understand your website structure

    A sitemap for people is a webpage that shows the structure and hierarchy of your website. It improves accessibility as it helps visitors better orient in the content you provide. It's useful in the case of complex websites with nested categories and pages. For instance, a company website with pages for shops across multiple cities, catering services, and a list of the company suppliers might have a website with the following structure:

    A schema of a sitemap for a website of a company with shops in several cities and catering.

    An example of a website structure for a company with shops in multiple cities, catering services, and a list of suppliers.

    Just like sitemaps for search engines, sitemaps for people don't need to include pages like Recover password. Such pages are usually linked from a place where a user can find them without a need for a sitemap.

    Ways to build sitemaps in Kentico Kontent

    You can model a sitemap for your Kontent project using linked content items or taxonomies. Here's how these approaches differ:

    • Linked content items approach allows you to create a flat list of URLs for search engines or a hierarchical sitemap for your human visitors. 
    • The taxonomy approach is useful when you only want to create a sitemap for search engines. However, it also gives your users a simple way to filter content items in Kontent based on the items' location on your website.

    You can combine the approaches in such a way that you create a sitemap using the linked items and, at the same time, tag your content items using a taxonomy to allow your users to filter the content based on your website structure.

    Limit sitemap changes to specific roles

    For both approaches, you can put the content elements for modeling the sitemap to a separate content group. This allows you to limit access to the group so only selected users can edit the sitemap model.

    The following guides illustrate the concept of building a sitemap for a company website with shops in multiple locations, similar to what's shown in the schema above.

    Creating sitemaps using linked content items

    To model your website hierarchy through linked content items, add a linked items element to content types of your existing webpages. The homepage of the company in this tutorial has the pages Shops, Catering and Our suppliers set as linked items. The Shops page holds Brisbane, London, and New York as its linked items. These pages then link to a Shop page or pages in that particular location.

    If you use linked items for navigation, you can use these linked items also to build your sitemap.

    Let's see how you can model this structure.

    1. Adjusting the content model for linking items

    To add a linked items element for the content types Homepage, Category, and Shop:

    1. Go to .
    2. Open the content type you want to update.
    3. Insert the Linked items element.
    4. Name it Sitemap items.
    5. Add a guideline for your users, such as Add content items that are one level below this page in the website hierarchy.
    6. Click Save changes.

    2. Linking the content items together

    The content types are now ready. To link the items together, add items lower in the hierarchy to the content item that's directly above them.

    1. Go to .
    2. Open the Home page.
    3. In Sitemap items, click Add existing items.
    4. Select the Shops, Catering, and Our suppliers pages.
    5. Click Add.

    Repeat these steps for all the pages that link to other pages lower in the hierarchy. For example, to the Shops page, add Brisbane, London, and New York. Then proceed with these three pages the same way.

    When you're done, you'll see a hierarchy similar to this:

    Sitemap prepared using linked items.

    Linked content items in Kentico Kontent.

    3. Building sitemaps using linked content

    After you publish the content items, your app needs to retrieve the content using the Delivery API to build the sitemap.

    You need to get the Home content item, which is highest in the website hierarchy. To do that, use the retrieve an item endpoint and request the item with the codename home:

    • HTTP
    https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items/home?elements=sitemap_items&depth=1
    https://deliver.kontent.ai/<YOUR_PROJECT_ID>/items/home?elements=sitemap_items&depth=1

    This gets you the Home content item with the items linked to it via the sitemap_items element. Those are, in this case, pages Shops, Catering, and Our suppliers. The elements=sitemap_items parameter in the request ensures you get only the items linked via the sitemap_items element. By using the depth=1 parameter, you specify you want to include linked items only one level below the item you're retrieving.

    To get all the pages for the sitemap building:

    1. Go through the content items linked to the Home page.
    2. Get each item together with its linked sitemap items as you did with the Home page.
      • This way you get each level of the hierarchy.
    3. Save each page's name and URL.
    4. (If you're building a sitemap for people) Save the page's position in the hierarchy.

    After you get all the pages you want in your sitemap, you can start building it in your app using the data you retrieved.

    Tagging items with taxonomies to create a sitemap

    When you use taxonomies for modeling a sitemap, you create a taxonomy term for each category and nest them the same way the categories are organized on your website. Then you tag each page with the taxonomy term representing the category the page is in.  You need to choose how many levels of the hierarchy you want to represent in the taxonomy.

    For example, you can tag each shop (like Black Kofriar) with a general term (like Shops) instead of using specific terms for each city the shops are located in. This depends on how fine filtering options you want to provide your users with. Although the taxonomy structure isn't important for the search engine sitemaps, it's good to give your users an efficient way to the website content.

    1. Creating a taxonomy hierarchy for the sitemap

    Let's create a hierarchy for the company with shops in multiple cities. Each level of the hierarchy has one taxonomy term. To make things simple, you'll group the shops under one general term. The structure you're creating here looks like this:

    Website structure schema modeled with taxonomy

    To create this structure using taxonomy:

    1. Go to .
    2. Click the Taxonomies tab.
    3. Click Create new.
    4. Name the new taxonomy group Sitemap.
    5. Create terms for the categories, for example, Shops, Locations, and so on:
      1. Click Create new taxonomy term.
      2. Name the new term.
      3. Click Confirm.
    6. Use to reorder and nest the terms to match the website hierarchy.
    7. Click Save changes.

    2. Adjusting content types for tagging

    Once you have the new taxonomy ready, prepare your content types for tagging items. You need to add the taxonomy element to the content types of pages you want to tag for the sitemap. In this case, the types are Category and Shop.

    1. Go to .
    2. Open the content type you want to update.
    3. Insert the Taxonomy element.
    4. In Taxonomy, select Sitemap.
    5. Click Save changes.

    3. Tagging items with the taxonomy

    When you're done, it's time to tag the pages with the Category, Locations, and Shops terms.

    1. Go to .
    2. Open the content item you want to update.
    3. In Sitemap, select a term for the particular page.

    You don't need to tag the homepage because you always know its name and can get it separately when building the sitemap.

    4. Getting the tagged items to build a sitemap

    After you finish tagging the pages and publish the content items you want in your sitemap, get the data for building the sitemap using the Delivery API. You need to retrieve all the content items tagged with a term from the Sitemap taxonomy group.

    1. Retrieve the item for the homepage by its codename (home), because it isn't tagged with a sitemap term.
    2. Retrieve the taxonomy for the sitemap by its codename (sitemap).
    3. Get codenames of the terms you received.
    4. Retrieve the items tagged with terms from the taxonomy you received. Use the [contains] filter with a codename of each term.
      For example, /items?elements.sitemap[contains]=shops.
    5. For each page you get, save its name and URL. 
    6. Use the saved information to create the sitemap XML file.

    What's next?

    Sitemaps are important for both your visitors and for search engines. When you provide both of the kinds, you ensure not only that people are able to find your content, but also that they feel comfortable on your website. As you have learned in this article, creating a sitemap is not complicated. It can be beneficial for your content creators too as by modeling a sitemap you also provide them the means to better orient in your website structure.