Skip to Content

Introducing Optimizely Content Seeder

Realistic content for local setup, tests and demos

I've just released TechnicalDogsbody.Optimizely.ContentSeeder, a fluent C# API for seeding pages, shared blocks and media into Optimizely CMS 12 and 13. You can get it from NuGet or the Optimizely NuGet feed, or explore the source on GitHub.

The Problem

Every environment starts empty, and someone fills it by hand. Each developer has a local database, so each one creates their own test content. QA build content on their environment before they can test. Then someone builds UAT-ready content on the UAT environment before handover. Integration tests need a known content tree, and demo sites need something that looks real. The alternative is usually a database backup that drifts out of date.

It all takes time, and none of it is the work anyone was hired to do.

What It Does

You describe the content tree in code: which pages, how many of each, which blocks go in which content areas, and which properties get images. The seeder builds it, filling text with realistic fake data from Bogus and images from Picsum Photos. Local, QA and UAT can all be filled from the same definition.

It's idempotent. Each seed definition has a stable ID and the seeder records what it created, so re-running the app fills gaps rather than duplicating content. An admin gadget lets you dry run, seed, reseed or delete each definition on demand. A dry run reports how many items a seed would create or skip without writing anything, which is handy for estimating the cost of a paid AI run.

Who It Helps

  • Developers: a fresh clone gets realistic content on the first run, and the definition is C# code, versioned with the project.
  • QA: the QA environment is filled from the definition instead of being built by hand, and believable content shows layout and content problems earlier.
  • UAT: the handover environment comes from the same definition, and a reseed puts it back to a known state between rounds.

It helps with bugs too. When QA find one, the seed definition can be updated to create the content behind it, and the seed definition skill can do that for you. The developer who picks up the branch reseeds and sees the bug already reproduced, and QA have the content ready to test the fix.

Getting Started

Install the connector for your CMS version. It brings in the core package:

dotnet add package TechnicalDogsbody.Optimizely.ContentSeeder.Connector.Optimizely13

Use Connector.Optimizely12 for CMS 12. Then register the seeder and your definition:

services.AddContentSeeder()
        .AddDefinition<MySeedDefinition>();

services.Configure<ContentSeederOptions>(
    configuration.GetSection("ContentSeeder"));
{
  "ContentSeeder": {
    "SeedOnStartup": true,
    "MasterLanguage": "en",
    "Languages": ["sv"]
  }
}

Then write the definition itself:

public sealed class MySeedDefinition : ISeedDefinition
{
    public string Id => "my-site-seed-v1";

    public SeedTree Build()
    {
        var promoBlock = new BlockDefinition(id: "promo", type: typeof(PromoBlock));

        var homePage = SeedFactory.Page(
            type: typeof(StartPage),
            count: 1,
            contentAreaAssignments:
            [
                new ContentAreaAssignment(nameof(StartPage.PromoArea), ["promo"])
            ],
            children:
            [
                SeedFactory.Page(typeof(ArticlePage), count: 5)
            ]);

        return SeedFactory.Tree(blocks: [promoBlock], nodes: [homePage]);
    }
}

That gives you a home page with a promo block in its content area and five article pages underneath, plus a Swedish version of each.

AI-Written Content

Lorem ipsum is fine for checking layouts, but it doesn't help when you're demoing to a client. The optional ContentSeeder.AI package writes text properties through any Microsoft.Extensions.AI IChatClient, so you can use Claude, OpenAI, Azure OpenAI, Gemini, or Ollama running locally for free.

You give it a writing brief in the seed definition (prompt, tone of voice, audience and phrases to avoid) plus per-property guidance with hard word or character limits. Each item is written in one request, so a heading, summary and body read as one piece. Other languages are translated from the master, so every language version says the same thing.

A few honest notes:

  • A local model is slower than you might expect. On Ollama with gemma4:e2b, a short item took about 7 to 17 seconds with reasoning on, and about 3.5 seconds with it off (Effort = None).
  • Translation quality depends on the model. A small model gave me recognisable but clumsy Swedish, so use a larger one for languages other than English.
  • If a request fails, that item keeps its Bogus values, so a run still finishes.
  • Someone should read the AI copy before stakeholders see it.

Visual Builder on CMS 13

On CMS 13 it also seeds Visual Builder sections and Experience pages, with rows, columns and elements. Repeating rows put the same element in one to six columns, which is handy for checking a front end's grid.

Other Bits

  • Videos from YouTube or Vimeo feeds, with no API keys.
  • Language branches, with placeholder text in the right script.
  • Typed generator rules, generated rich text and a "kitchen sink" field that uses every editor tag.
  • A completion email, and a CMS notification on CMS 13.
  • A ready-made skill that teaches Claude Code, Copilot, Cursor and others to write seed definitions for your content model.

It's built on MicroMediator too, so you can start a seed run from your own code through the mediator.

Supported Versions

CMS 13 on .NET 10, and CMS 12 on .NET 8, 9 or 10. It's MIT licensed, and issues and pull requests are welcome on GitHub.

Andy Blyth

Andy Blyth, an Optimizely MVP (OMVP) and Technical Architect at MSQ DX with a keen interest in martial arts, occasionally ventures into blogging when memory serves.

optimizely-mvp-technology

SaaS CMS Cert

contentful-certified-professional

Andy Blyth