How extensions can use Extension Manager (beta)

It is subject to change based on input I’ll get, but here is how you can use Extension Manager that is in the BlogEngine build 8474 when you write extension. To utilize manager functionality you first of all need an extension that requires some kind of customization, probably you want users be able to change values set by you as defaults. If so, you can use manager to create default property page for your extension, save default values and let user change them later on. Here is how you save list of default parameters to Extension Manager using BBCode as example:

public BBCode()
    Comment.Serving += new EventHandler<ServingEventArgs>(Post_CommentServing);
    // create settings object
    ExtensionSettings settings = new ExtensionSettings("BBCode");
    // describe specific rules applied to entering parameters. overrides default wording.
    string help = "Enter values for open and close tags devided ";
    help += "by \" | \" or single value if both tags are the same.";
    settings.SettingsHelp = help;
    // delimiter separating parameter. optional. comma by default.
    settings.ParametersDelimiter = "|".ToCharArray();
    // add default parameters. if more than one delimiter used to split values.
    settings.AddParameter("b", "strong");
    settings.AddParameter("i", "em");
    settings.AddParameter("u", "span style=\"text-decoration:underline\"|span");
    settings.AddParameter("quote", "cite title=\"Quote\"|cite");
    // initial import default settings. to reset blogger will have to
    // remove all parameters through admin tool/extensions/edit settings

Then you can retrieve and use these parameters, possibly customized by blogger, in your extension:

private void Post_CommentServing(object sender, ServingEventArgs e)
    string body = e.Body;
    // get settings object from extension manager
    ExtensionSettings settings = new ExtensionSettings("BBCode");
    // use parameters maintained by blogger through admin tool
    // in your extension. parameter values saved as array of strings
    // and can be accessed as values[number] as in example below
    foreach (ExtensionParameter p in settings.Parameters)
        string[] values = p.Value.Split(settings.ParametersDelimiter);
        if (values.Length == 2)
            Parse(ref body, p.Name, values[0], values[1]);
            Parse(ref body, p.Name, values[0]);
    e.Body = body;


If you see easier, more obvious and natural way of doing this, please do not hesitate to share your thoughts. We are at the point where it all can be changed for a better relatively painlessly.


This site is all about developing web applications with focus on designing and building open source blogging solutions. Technologies include ASP.NET Core, C#, Angular, JavaScript and more.