Skip to main content

Walkthrough: Publishing and validating content on an XM Cloud Content Management instance

Abstract

Use the Sitecore CLI to publish content from an XM Cloud instance.

When you edit or create content in Sitecore, it must be published to become available to applications. When publishing content from an XM Cloud Sitecore Content Management (CM) instance, you publish to Experience Edge for XM.

When you deploy your solution to an XM Cloud environment, the provisioning and deployment process creates the necessary publishing infrastructure, which includes:

  • An Edge tenant.

  • The Edge connector.

  • The Edge publishing target.

This walkthrough describes how to:

  • Publish content using the CLI.

  • Validate the published content

In this walkthrough, you use Sitecore Command Line Interface (CLI) to publish content from your XM Cloud CM instance, but you can also publish content using the publishing tools available in the Sitecore user interface.

Note

To use the CLI for operations on the XM Cloud CM instance, you must connect the CLI to the XM Cloud environment.

To publish content using the CLI:

  1. In the project working directory, in a command-line window, log in to XM Cloud using the CLI by running the command:

    dotnet sitecore cloud login

    Follow the steps in the user interface to log in and authorize your device.

  2. Run the following command:

    dotnet sitecore publish --pt Edge -n <environment-name>

After publishing content to Edge, you must verify the content is as you expect and that you can retrieve it from Edge.

To validate the published content:

  1. Generate an Edge API key.

  2. Document the Edge API key. You must use it when working with the client JSS application.

  3. In the GraphQL Playground, validate content retrieval from Edge by running a query for the published content for your site. You must provide the site name. For example:

    query {
      layout(language: "en", routePath: "/", site: "<your-site-name>") {
        item {
          rendered
        }
      }
      site {
        siteInfoCollection {
          name
          routes(first: 10, language: "en") {
            results {
              routePath
              route {
                id
              }
            }
          }
        }
      }
    }