4

I am beginner to sitecore. My company wants to create the sitemap for their website. I have search on the google and got some options to create it with the help of some modules like sitemap XML.

Is there any way in sitecore to create the Sitemap without using any module? If yes, then how?

Thank you for any small help.

2
  • Would be ok to use Sitecore SXA module which could give you lots of other features not just Sitemap xml doc.sitecore.net/sitecore_experience_accelerator/…? It is official module from Sitecore. If you really don't want to use any module, you need to implement it by your own. There is no OOTB solution. If nobody comments differently, I will create answer from this comment – Peter Procházka Apr 23 '18 at 4:56
  • if your site is not too big, I've found that using the SXA component "Navigation" can do the trick, if you insert it on any page and configure its settings to show 5-6 children, it pretty much has the same effect .. that is, if you're only looking for an html page of a sitemap. – Mie ElMansy Jul 12 '18 at 13:09
4

During my journey with Sitecore starting from version 6.4, until now, I couldn't find a Sitecore feature that can build Sitemap XML for you automatically.

You have few options:

  • Use one of the Market place modules like Sitecore XML. It is an open source so you can extend it if required
  • Upload your Sitemap XML file on media library and build your own IIS rewrite rule. In this case, content authors will be responsible to update and publish it
  • Build your own custom module to generate your Sitemap xml file for you based on your website structure

Hope this will help you.

0
0

I recently went through this. While I didn't have to create an XML doc for the sitemap, I just needed to list the page urls. With some simple editing, you can modifiy the following script to generate XML instead of a straight list.

source: https://pageditor.wordpress.com/2015/03/20/list-of-urls/

<%@ Page Language="c#" AutoEventWireup="true" Debug="true" %>
<%@ Import Namespace="Sitecore.Data.Items" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head>
 <title>List of URLs</title>
 </head>
 <body>
 <script language="C#" runat="server">

 string domain = "http://mysite.com";
 int count = 0;

 void Page_Load(object sender, System.EventArgs e)
 {
 Sitecore.Data.Database web = Sitecore.Configuration.Factory.GetDatabase("web");

 var home = web.GetItem("/sitecore/content/MySite/home");

 var pages = GetChildren(home);

 Response.Write(pages);
 Response.Write("Total # of pages: " + count.ToString());

 }

 private string GetChildren(Item home)
 {
 string result = "";
 if (!home.HasChildren) return "";

 var childList = home.GetChildren();
 foreach(Item item in childList)
 {
 if (DoesSitecoreItemHavePresentation(item))
 {
 result += domain + Sitecore.Links.LinkManager.GetItemUrl(item) + "<br />"; 
 count++;
 }

 result += GetChildren(item);
 }

 return result;
 }

 public bool DoesSitecoreItemHavePresentation(Item item)
 {
 return item.Fields[Sitecore.FieldIDs.LayoutField] != null 
 && item.Fields[Sitecore.FieldIDs.LayoutField].Value != String.Empty;
 }

 </script>
 </body>
</html>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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