Thursday, June 13, 2024

Option to Rollback Deployments in Sitecore XM Cloud

During a recent discussion with the Sitecore Support Team, we confirmed that XM Cloud does not offer a built-in rollback mechanism for deployments. However, since XM Cloud projects are typically hosted on version control platforms like GitHub, reverting changes can be managed effectively through version control processes.

uring a recent discussion with the Sitecore Support Team, we confirmed that XM Cloud does not offer a built-in rollback mechanism for deployments. However, since XM Cloud projects are typically hosted on version control platforms like GitHub, reverting changes can be managed effectively through version control processes.

Here’s a professional approach to handling rollbacks in XM Cloud using a Windows environment:

Step-by-Step Rollback Process

1. Revert Changes in Version Control

  1. Navigate to Your GitHub Repository (or any equivalent version control platform).
  2. Identify the Commit to Revert To:
    • Go to the Commit History of your repository.
    • Locate the last known stable commit before the problematic deployment.
  3. Revert the Commit:
    • On GitHub, click on the commit you want to revert.
    • Select the “Revert” option. This will create a new commit that undoes the changes introduced by the problematic deployment.
  4. Commit the Reverted Changes:
    • Confirm and commit the changes to your repository.

2. Link to a Stable Branch

  1. Create a New Branch for the Reverted Changes:
    • In GitHub, navigate to the repository’s Branches tab.
    • Create a new branch based on the reverted changes, e.g., stable-rollback.
  2. Update the Environment Configuration:
    • In your XM Cloud deployment settings, update the environment to use the new stable branch.

3. Rebuild and Redeploy

  1. Trigger the "Build & Deploy" Action in XM Cloud:
    • Go to the XM Cloud interface or your CI/CD pipeline.
    • Select the new stable branch and initiate the “Build & Deploy” action.
  2. Verify the Deployment:
    • Ensure the deployment completes successfully.
    • Validate that the site functions as expected, and all services are operational.

Benefits of This Approach

  • Efficiency: Quickly revert to a stable state without extensive troubleshooting.
  • Control: Maintain full transparency over code changes and deployments.
  • Flexibility: Easily manage multiple stable branches for different environments.
  • Version History: Maintain a clear audit trail of changes and rollbacks for future reference.

By leveraging version control processes, you can effectively manage rollbacks in Sitecore XM Cloud and ensure a smooth deployment experience.

Tuesday, June 11, 2024

Resolving Multiple HTTPS Entries in Sitemap



Issue Observed:

During a recent project, I observed that multiple HTTPS entries were being generated in the sitemap. This issue not only caused redundancy but also had potential implications for SEO and website performance.

After a detailed investigation, I determined that the problem was related to incorrect configuration settings within Sitecore.


Root Cause Analysis

In Sitecore, the configuration for each site defines how URLs are generated, including protocol and host information. The issue was traced to the following path:


/sitecore/content/Site/Settings/Site Grouping/Site1

Within this configuration, the Target Hostname field included the HTTPS protocol, which resulted in duplicate entries being created in the sitemap.

For example:


https://www.example.com

When the sitemap was generated, this setting caused the URLs to be prefixed incorrectly, leading to multiple instances of HTTPS URLs appearing.

Solution

The fix for this issue was straightforward and involved modifying the Target Hostname setting. Here’s how it was resolved:

  1. Navigate to the Site Settings:

    • Go to: /sitecore/content/Site/Settings/Site Grouping/Site1
  2. Correct the Target Hostname:

    • Remove the HTTPS prefix from the Target Hostname field.
    • Instead of: https://www.example.com
    • Use: www.example.com
  3. Save and Publish the changes to ensure they take effect.

Why This Fix Works

Sitecore generates URLs dynamically based on the Target Hostname configuration. By including the protocol (https://) directly in the Target Hostname field, Sitecore was misinterpreting the setting and creating redundant HTTPS entries.

By specifying only the hostname (www.example.com), Sitecore uses the appropriate protocol based on other configurations, ensuring consistent and accurate URL generation in the sitemap.

Results

After implementing this change:

  • The sitemap no longer displayed duplicate HTTPS entries.
  • URL generation was consistent and aligned with best practices for SEO.
  • The overall sitemap was clean, accurate, and free of redundancy.

Key Takeaways

  • Check Hostname Settings: Always ensure the Target Hostname field contains only the hostname, without protocol prefixes.
  • Follow Best Practices: Let Sitecore handle protocol resolution based on your site's configurations for HTTP and HTTPS.
  • Regular Sitemap Audits: Periodically review your sitemap to identify and address any anomalies that may impact SEO.

By maintaining proper settings in Sitecore, you can avoid sitemap issues and ensure a seamless experience for both search engines and users.

For any additional queries or troubleshooting assistance, feel free to leave a comment or reach out. Happy Sitecore-ing!