Sitemap xml multiple languages support with Sitecore SXA

When working with multilingual websites you might want to tell google about localized versions of your pages so that it helps google to point users to the most appropriate version of your page by language or region, you can find more details about this here.

If you are already into Sitecore SXA 1.6-  the feature is inbuilt and doesn’t needs any customization- see the Sitecore SXA 1.6 release notes here for ref., but if you haven’t upgraded yet you have to write some custom code to support this configuration/feature.

In this case what we have to do here is:

  1. Create a new class that inherits from SitemapGenerator (part of Sitecore.XA.Feature.SiteMetadata )
  2. Override BuildSitemap() method.

You can write your own code under BuildSitemap() method and generate the customized sitemap.xml to support multiple languages.

Once you make this change- you will see sitemap.xml in the below format (below example shows three language versions of home page)

sitemap-multilang

Hope this helps and you can use this solution until you move to SXA 1.6.

Happy learning 🙂

Why Sitecore-from my view

Different content management systems (CMSs) are available for creating and managing websites, but choosing the right CMS is always a big challenge and depends on several factors, Web content management system (WCMs) are not just a tool for creating pages now, it has gone beyond it and business now count on it to perform and manage many other functions.

Recently i was asked to list down why Sitecore is an ideal choice as content management system, you can find articles advocating for Sitecore and explaining the features which makes it an optimal choice as a content management system, here i want to share my view on why Sitecore is the best choice.

Before we start, just to mention that Sitecore has been awarded as a leader in Gartner’s assessment of the strengths and cautions of 18 web content management vendors for 9th year in the row. sourcehttps://www.sitecore.com/resources/index/analyst-reports/gartner-magic-quadrant-for-web-content-management

Sitecore-AEM

Here are some of the features/advantages of Sitecore from my perspective which makes it a product of “one stop shop” for all.

  1. Friendly Interface- Sitecore user interface was made keeping usability in mind.With its intuitive interface, even non-technical users can make changes and updates on the fly.
  2. Multisite development- Sitecore’s feature of Multisite development enables development team to work on multiple websites at the same time, this includes microsites/intranets applications and etc.
  3. Integration- Sitecore architecture is based on extensibility which supports integration with third party systems,you can integrate some of the third party systems like Salesforce/Active Directory/Brightcove connectors and etc. in your Sitecore solution smoothly.
  4. Multilingual Sites and translations– Sitecore helps your business to reach out to global or local market by translating the contents into regional languages by means of different connectors which can use to translate the content into different languages.you can translate the content manually or make use of connectors- choice is yours.
  5. Analytics– Experience Analytics is built in which gives business editors/users an insight of customer behavior and journey so that we can recognize patterns and update the content and personalize to present more relevant contents to end users.
  6. Devices-  System can target the content based on devices which has been used to request particular page.
  7. Scalability–  You can scale your application to any level you want right from content management servers to your experience database(xDB) and content delivery servers. Sitecore provides a system to make sure your data is safe and protected. We can setup multiple CD servers to load balance the traffic and making sure the nearest server is being used to serve the user request to improve the performance.
  8. Extensive Support from Sitecore– You are always in safe hand while working in Sitecore, for any issues and problems Sitecore has different channels available where you can raise your concerns and queries. Some of the tools which you can use are as follows:
    1. support.sitecore.net
    2. Sitecore slack
    3. Sitecore stackoverflow
    4. dev.sitecore.net
  9. Deploy on  Azure- We can deploy Sitecore on Azure using modals like PAAS and IAAS, and can leverage other cloud features to best serve the application and users.
  10. SXA (Sitecore Experience Accelerator)– SXA Speeds up the delivery while running different work steams in parallel.
    1. Web development teams use Sitecore Experience Accelerator (SXA) to speed up the production of websites and to reuse components, layouts, and templates across a variety of sites.
    2. SXA separates structure from design, so front-end designers, creative designers, content authors, and developers can work in parallel and you can deploy and maintain multiple sites quickly and cost effectively
    3. Once a basic user experience plan is in place, everyone can get started on the platform
    4. For example: the content author can start entering the content in the wireframe environment, while the front-end developer works on the theme, and the developer sets up the data templates.
  11. Personalization-
    1. Personalization is all about presenting relevant content to end users based on several factors like browsing history, campaigns, goals, visits and etc.
    2. Sitecore comes handy with several out of the personalization rules which you can use out of the box.
    3. We can also built custom rules to create and show specific component variant which can be displayed when custom personalization rule/condition is met.
  12. Marketing Automation- Business editors can make use of marketing automation feature to automate several steps and process which saves time like sending email when specific goal is triggered and etc.
  13. Experience profile- A profile is created for each site visitor (anonymous/known) and stores all related information into Experience Profile section while fetching the values from experience database(xDB).
  14. Helix/Habitat (Design principles)-
    1. Helix is a set of overall design principles and conventions for Sitecore development.
    2. As more and more people and organisations adopt the Helix conventions and principles, it will become a Sitecore standard.
    3. This means that people who are familiar with the conventions or the Habitat example will be able to work more easily on other convention-based projects with minimal training
    4. It will be easier for Sitecore Product Support to understand projects built using the conventions, enabling them to resolve issues more quickly.

Thanks for reading and see you in my next post!

Happy learning 🙂

SXA redirect URL with country code

It is important to redirect user to new page from old page when we create new version of an existing web page, it helps both users and search engines to get redirected to a new URL from the one they originally requested.

sxa-redirects

There are several ways to setup redirects in Sitecore solution, with Sitecore SXA we have redirect tool in place that facilitates setting up old and new URLs in Sitecore. We can use the mapping tool to set up a 301/302 or server transfer redirect.

Recently we worked on setting up redirects using SXA redirect tool, for most of the redirects we had country code in the old URL.

Here are some example URLs:

Old URLen-au/sample-old-page-name   New URL– /new-page-name

Old URLen-au/mypage/pagelisting   New URL– /newpagelisting

What we observed that after setting up old URLs which has country code on it- all such URLs were redirecting to 404 page.

We can fix this by appending “sc_lang” querystring parameter to the new URL with the target country code, see below examples for ref:

Old URL– /sample-old-page-name   New URL– /new-page-name/?sc_lang=en-AU

Old URL– /mypage/pagelisting   New URL– /newpagelisting/?sc_lang=en-AU

After this redirects works as expected.

I hope this helps.

Happy Learning 🙂