Synchronize page content

2025/09/05 12:09 PM

I'm working with the local version of XbyK. Advanced license type, using example:

using Microsoft.Extensions.Hosting;

// ...

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

// Configures the development environment as the content sync source
if (builder.Environment.IsDevelopment())
{
    builder.Services.Configure<ContentSynchronizationOptions>(options =>
    {
        options.Source.Enabled = true;
        options.Source.Secret = "147283795efb915cf7bcbe207678764e";
        options.Source.TargetUrl = "https://productiondomain.com";
    });
}

// Configures the production environment as the content sync target
if (builder.Environment.IsProduction())
{
    builder.Services.Configure<ContentSynchronizationOptions>(options =>
    {
        options.Target.Enabled = true;
        options.Target.Secret = "147283795efb915cf7bcbe207678764e";
    });
}

configured staging. But the Sync this page or Sync with all subpages action is missing on the pages in website channel application

Tags:
Content sync

Answers

2025/09/05 2:24 PM

Do you have the environment variables set correctly locally and where production is being hosted so that the code is ran correctly? The ASPNET_ENVIRONMENT variable should have Development, Staging or Production as a value for the builder.Environment.IsDevelopment() to work.

2025/09/08 11:04 PM
Accepted answer

^ Alex is asking the right questions - the environment checks (like if (builder.Environment.IsProduction()) ) are only going to work if ASP.NET Core understands which environment it is in.

Additionally, the docs cover the requirements for content sync to be accessible to a user.

  • To synchronize content items, users need to have a role with the Synchronize permission assigned for the Content hub application and the appropriate workspaces.
  • To synchronize website channel pages, users need to have a role with the Synchronize permission for individual pages or the Manage permissions permission for the website channel.
  • To synchronize forms, users need to have a role with the Synchronize permission assigned for the Forms application.

And, both servers have to be accessible under https with a valid trusted certificate (that includes your local or development environment). The Kentico Community Portal uses ASP.NET Core dev certs to solve this locally.

To response this discussion, you have to login first.