Search code examples
kenticoxml-sitemap

New pages in Kentico not listing in googlesitemap.xml


Here's the setup:

  • Root site, set up to show in sitemap and is searchable.
  • Page under it doesn't get listed in sitemap (in fact, no pages do).
  • Create a new page with options to show in sitemap and is searchable but is not listed in sitemap xml file

In fact, nothing shows in our sitemap except the location of the robots file.

I understand that initially it only lists CMS.MenuItem objects (as per https://docs.kentico.com/k11/configuring-kentico/search-engine-optimization/google-sitemaps).

Is there a setting I'm missing to show pages in the sitemap?

In case it's important: kentico version is 10.


Solution

  • Make sure your custom page types are configured in the code file: Either in code before ~/CMSPages/googlesitemap.aspx or code behind ~/CMSPages/googlesitemap.aspx.cs

    Since it's similar to a repeater you can set the ClassNames property to identify the different page types you want it to use for rendering.

    e.g. when in code before: ClassNames="CMS.MenuItem;CMS.News;Custom.Type"

    Resulting in something like:

    <cms:GoogleSitemap runat="server" ID="googleSitemap" 
        TransformationName="CMS.Root.GoogleSiteMap" CacheMinutes="0"
        OrderBy="NodeLevel, NodeOrder, NodeName"
        ClassNames="CMS.MenuItem;CMS.News;Custom.Type" />