CmsContentScaffolding.Optimizely
1.13.1
dotnet add package CmsContentScaffolding.Optimizely --version 1.13.1
NuGet\Install-Package CmsContentScaffolding.Optimizely -Version 1.13.1
<PackageReference Include="CmsContentScaffolding.Optimizely" Version="1.13.1" />
<PackageVersion Include="CmsContentScaffolding.Optimizely" Version="1.13.1" />
<PackageReference Include="CmsContentScaffolding.Optimizely" />
paket add CmsContentScaffolding.Optimizely --version 1.13.1
#r "nuget: CmsContentScaffolding.Optimizely, 1.13.1"
#:package CmsContentScaffolding.Optimizely@1.13.1
#addin nuget:?package=CmsContentScaffolding.Optimizely&version=1.13.1
#tool nuget:?package=CmsContentScaffolding.Optimizely&version=1.13.1
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 | Versions 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. |
-
net6.0
- EPiServer.CMS.UI.Core (>= 12.4.0 && < 13.0.0)
-
net8.0
- EPiServer.CMS.UI.Core (>= 12.4.0 && < 13.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.