Posts

Showing posts from September, 2018

Sitecore-Sitemap splitting into multiple files based on languages code

First, generate the sitemap for the Multi-Language website using an any online tool available, it will generate a sitemap for all the pages into a single file with different language code URLs. Lets split the sitemap to individual language specific sitemap file for easy SEO access. XDocument document = XDocument .Load( "D:\\sitemap.xml" );             var books = from r in document.Descendants( "url" )                         select new                         {                             loc = r.Element( "loc" ).Value.ToLower(),                             lastmod = r.Element( "lastmod" ).Value,                             priority = r.Element( "priority" ).Value                         }; //EN language sitemap             XmlTextWriter enwriter = new XmlTextWriter ( "D:\\sitemap-en.xml" , System.Text. Encoding .UTF8);             enwriter.WriteStartDocument( true );             enwri

Sitecore Indexing Content from different location of content tree in same index configuration file

I have to index the for some search functionality, so I don’t want to use the default index like (sitecore_master_index or sitecore_web_index) as these indexes will crawl the entire content tree irrespective of the sites in a single Sitecore instance. so, I have decided to create a custom index and crawl only specific part of Sitecore content and media library items to this index, so the performance of search will be very fast and also it will only provide contents related to the particular site only. Below is the config for the new Sitecore index. < configuration xmlns:patch = " http://www.sitecore.net/xmlconfig/ " >   < sitecore >     < contentSearch >       < configuration type = " Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch " >         < indexes hint = " list:AddIndex " >           < index id = " sitecore_customweb_index " type = " Sitecore.ContentS

Sitecore Powershell - Creating a new sitecore multisite, Update Base Template, Renderings,Templates,Dictionary and Content

I had a requirement to create a brand-new site with same content structure (later content will be updated as per new site) based on the existing Sitecore site by duplicating all the templates and rendering and to host the site in the same Sitecore instance, Duplicating the site is very easy and hosting also done very easily but the problem is all the layout and Rendering is pointing to the old site from where we duplicated. Also, while duplicating the templates its inherited templates will still point to the old templates. So, this is the big problem as if any changes happen to the old site's templates will reflect in the new site, but we need separate templates/Rendering/Layouts for the new site. So, I thought of achieving with Sitecore Powershell scripts. Let's do it. Step 1:(Rendering Updates to new site's View and Controller) $allItems = Get-ChildItem -Path 'master:///sitecore/layout/Renderings/Projects/NewSite' -Recurse $filteredItems =$