1

I am using Sitecore 10 and Angular JSS without SXA, I did not install it, so my question is how I can generate an XML sitemap to our site?

2

3 Answers 3

0

You can generate an XML sitemap by inheriting the sitemap SXA templates on the JSS settings template.

Please inherit the base template named _SitemapSettings from below mentioned path to the JSS setting template

/sitecore/templates/Feature/Experience Accelerator/SiteMetadata/Sitemap/_SitemapSettings

And another template named _Sitemap from below mentioned path to the corresponding route template you have created.

/sitecore/templates/Feature/Experience Accelerator/SiteMetadata/Sitemap/_Sitemap

You can also check out the detailed blog about this on the below link. (For transparency, this is my personal blog post).

https://www.linkedin.com/pulse/steps-enable-sxa-sitemapxml-robotstxt-feature-sitecore-nijas-hameed/

0

To generate the sitemap, you will still need to go through the Sitecore Pipelines. The pipeline responsible for the sitemap would be httpRequestBegin.

Even if you are not using SXA, you may try to see how the sitemap has been implemented. Moreover, there are many online resources on how to implement sitemap on Sitecore, examples:

If you want to see how the sitemap is implemented in SXA, you can check the following namespace

Sitecore.XA.Feature.SiteMetadata.Pipelines.HttpRequestBegin.SitemapHandler, Sitecore.XA.Feature.SiteMetadata
1
  • I'm not sure this really classifies as an answer for the OP question. The user is using a headless approach and therefore generating a sitemap via the CD server will likely not suffice here, since they'll need the sitemap generated on their rendering host(s). Feb 8, 2022 at 22:53
0

The answers provided are correct but will work only in connected mode of Sitecore jss, Incase you are using Sitecore headless topology which is widely used and promoted by Sitecore. For Headless topology we make SSR app for React.js and Angular, to render our js application using Sitecore CD content fetch though layoutService or GraphQL.

By following the other answers, you will be able to access sitemap.xml on sitecore CD url but on SSR url you will be getting 404.

In SSR, go to config.ts, in excluded routes add 'sitemap.xml', or in .env file add sitecore CD sitemap.xml url. Restart the SSR.

Now you will be able to access Sitemap.xml in SSR url.

Happy Sitecoring !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.