CmsContentScaffolding.Optimizely 1.13.1

dotnet add package CmsContentScaffolding.Optimizely --version 1.13.1
                    
NuGet\Install-Package CmsContentScaffolding.Optimizely -Version 1.13.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CmsContentScaffolding.Optimizely" Version="1.13.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CmsContentScaffolding.Optimizely" Version="1.13.1" />
                    
Directory.Packages.props
<PackageReference Include="CmsContentScaffolding.Optimizely" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CmsContentScaffolding.Optimizely --version 1.13.1
                    
#r "nuget: CmsContentScaffolding.Optimizely, 1.13.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CmsContentScaffolding.Optimizely@1.13.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CmsContentScaffolding.Optimizely&version=1.13.1
                    
Install as a Cake Addin
#tool nuget:?package=CmsContentScaffolding.Optimizely&version=1.13.1
                    
Install as a Cake Tool

Optimizely CMS Content Scaffolding

Scaffold thousands of pages with any structure with just a few lines of code using fluent coding style.

Example

app.UseCmsContentScaffolding( builderOptions: o ⇒ { o.Language = CultureInfo.GetCultureInfo("sr"); o.StartPageType = typeof(StartPage); o.BuildMode = BuildMode.Append; }, builder: b ⇒ { var teaser2Ref = ContentReference.EmptyReference; var teaser3Ref = ContentReference.EmptyReference; var articlePageRef = ContentReference.EmptyReference;

    b.UseAssets(ContentReference.SiteBlockFolder)
    .WithFolder("Folder 1", l1 =>
    {
        l1
        .WithFolder("Folder 1_1", l2 =>
        {
            l2.WithBlock<TeaserBlock>("Teaser 1", out teaser2Ref, x =>
            {
                x.Heading = "Teaser 1 Heading";
                x.Text = ResourceHelpers.Faker.Lorem.Paragraph();
                x.Image = PropertyHelpers.GetOrAddMedia<ImageFile>("Image 2", ".png", ResourceHelpers.GetImageStream());
            });
        })
        .WithMedia<VideoFile>(x => x.Name = "Test video", ResourceHelpers.GetVideoStream(), ".mp4")
        .WithBlock<TeaserBlock>("Teaser 3", out teaser3Ref, x =>
        {
            x.Heading = "Test";
            x.Text = ResourceHelpers.Faker.Lorem.Paragraph();
            x.Image = PropertyHelpers.GetOrAddMedia<ImageFile>("Image 2", ".png", ResourceHelpers.GetImageStream());
        });
    })
    .WithContent<ContentFolder>(x => x.Name = "Folder1")
    .WithContent<ImageFile>(x => x.Name = "Image 1")
    .WithBlock<TeaserBlock>("Teaser 2", x =>
    {
        x.Heading = "Test";
        x.Text = ResourceHelpers.Faker.Lorem.Paragraph();
        x.Image = PropertyHelpers.GetOrAddMedia<ImageFile>("Image 2", ".png", ResourceHelpers.GetImageStream());
    });


    b.UsePages(ContentReference.RootPage)
    .WithStartPage<StartPage>(p =>
    {
        p.Name = "Home Page";
        p.MainContentArea
        .AddExistingItems(teaser2Ref, teaser3Ref)
        .AddItem<TeaserBlock>("Start Page Teaser", b =>
        {
            b.Heading = ResourceHelpers.Faker.Lorem.Slug();
            b.Text = ResourceHelpers.Faker.Lorem.Paragraph();
            b.Image = PropertyHelpers.GetOrAddMedia<ImageFile>("Image 2", ".png", ResourceHelpers.GetImageStream());
        });
    }, CultureInfo.GetCultureInfo("sv"), t =>
    {
        t.Name = "Start Page [SV]";
    }, l1 =>
    {
        l1
        .WithPage<ArticlePage>(out articlePageRef, p =>
        {
            p.Name = "article1";
            p.MetaTitle = ResourceHelpers.Faker.Lorem.Slug();
            p.TeaserText = ResourceHelpers.Faker.Lorem.Paragraph();
            p.MainBody
            .AddStringFragment(ResourceHelpers.Faker.Lorem.Paragraphs())
            .AddContentFragment(PropertyHelpers.GetOrAddMedia<ImageFile>("Image 1", ".png", ResourceHelpers.GetImageStream()))
            .AddStringFragment(ResourceHelpers.Faker.Lorem.Paragraphs());
            p.PageImage = PropertyHelpers.GetOrAddMedia<ImageFile>("Image 1", ".png", ResourceHelpers.GetImageStream());
            p.MainContentArea
            .AddItem<JumbotronBlock>("Jumbotron Block", b =>
            {
                b.ButtonText = ResourceHelpers.Faker.Lorem.Slug();
                b.ButtonLink = new Url(ResourceHelpers.Faker.Internet.Url());
                b.Heading = ResourceHelpers.Faker.Lorem.Slug();
            })
            .AddItem<ImageFile>(options: i =>
            {
                i.Name = "Test Image";
                i.ContentLink = PropertyHelpers.GetOrAddMedia<ImageFile>("Image 1", ".png", ResourceHelpers.GetImageStream());
            })
            .AddExistingItem(teaser3Ref);
        })
        .WithPages<ArticlePage>(p =>
        {
            p.Name = "Article 33";
            p.MetaTitle = ResourceHelpers.Faker.Lorem.Slug();
            p.TeaserText = ResourceHelpers.Faker.Lorem.Paragraph();
            p.MainBody.AddStringFragment(ResourceHelpers.Faker.Lorem.Paragraphs(10));
            p.MainContentArea.AddExistingItem(teaser2Ref);
        }, 100);
    })
    .WithPage<StandardPage>(out var notFoundPageRef, p =>
    {
        p.Name = "Not Found Page";
    })
    .WithPages<ArticlePage>(p =>
    {
        p.Name = ResourceHelpers.Faker.Lorem.Slug(2);
        p.MainContentArea
        .AddItems<TeaserBlock>(b =>
        {
            b.Heading = ResourceHelpers.Faker.Lorem.Slug();
            b.Text = ResourceHelpers.Faker.Lorem.Paragraph();
            b.Image = PropertyHelpers.GetOrAddMedia<ImageFile>("Image 1", ".png", ResourceHelpers.GetImageStream());
        }, 10);
    }, 10)
    .WithPages<ArticlePage>(p =>
    {
        p.Name = ResourceHelpers.Faker.Lorem.Slug(3);
        p.MainContentArea
        .AddItems<TeaserBlock>(b =>
        {
            b.Heading = ResourceHelpers.Faker.Lorem.Slug();
            b.Text = ResourceHelpers.Faker.Lorem.Paragraph();
            b.Image = PropertyHelpers.GetOrAddMedia<ImageFile>("Image 1", ".png", ResourceHelpers.GetImageStream());
        }, 2);
    }, 2);
});

Replacing the primary site host

When a database is copied from another environment, its primary site definition still points at that environment's host. ReplacePrimarySiteHost repoints the existing primary site at the configured SiteHost, SiteName and Language, without creating or modifying any content.

//Values are taken from the "CmsContentScaffolding" section in appsettings.json app.ReplacePrimarySiteHost();

//or set them inline app.ReplacePrimarySiteHost(o ⇒ { o.SiteName = "Demo"; o.SiteHost = "https://localhost:5000"; o.Language = CultureInfo.GetCultureInfo("en"); });

Call it before UseCmsContentScaffolding, which resolves the site by its host name. It does nothing when no primary site exists or when its primary host already matches the configured SiteHost.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.13.1 115 8/31/2026
1.13.0 377 8/3/2026
1.12.1 967 6/9/2026
1.12.0 418 4/29/2026
1.11.0 142 4/20/2026
1.10.15 118 4/16/2026
1.10.14 231 4/1/2026
1.9.2 283 2/27/2026
1.9.1 115 2/27/2026
1.9.0 128 2/27/2026
1.8.5 153 2/20/2026