PineBlog has been updated to version 2. This new release adds the following new features and improvements:

  • MongoDb can now be used a data source
  • Extended Markdown support
  • Now targeting net5.0 and netcoreapp3.1
  • Removed the _ValidationScriptsPartial from Opw.PineBlog.RazorPages
  • Removed dependencies on Opw.Core and Opw.EntityFramework

Build Status NuGet Badge License: MIT

Using MongoDb

When you want to use MongoDb as your database, then you don't use the Opw.PineBlog metapackage but you need to install the required packages individually.

  • Opw.PineBlog.MongoDb package The PineBlog data provider that uses MongoDb. NuGet Badge

  • Opw.PineBlog.RazorPages package The PineBlog UI using ASP.NET Core MVC Razor Pages. NuGet Badge

  • Opw.PineBlog.Core package The PineBlog core package. This package is a dependency for Opw.PineBlog.RazorPages and Opw.PineBlog.MongoDb. NuGet Badge

Startup

You add the PineBlog services and the Razor Pages UI in the Startup.cs of your application.

public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddPineBlogCore(Configuration);
    services.AddPineBlogMongoDb(Configuration);

    services.AddRazorPages().AddPineBlogRazorPages();
    // or services.AddMvcCore().AddPineBlogRazorPages();
    // or services.AddMvc().AddPineBlogRazorPages();
    ...
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{

    // Make sure you enable static file serving
    app.UseStaticFiles();

    ...
    app.UseEndpoints(endpoints =>
    {
        // make sure to add the endpoint mapping for both RazorPages and Controllers
        endpoints.MapRazorPages();
        endpoints.MapControllers();
    });
    ...
}

NOTE: Make sure you enable static file serving app.UseStaticFiles();, to enable the serving of the css and javascript from the Opw.PineBlog.RazorPages packages.

Configuration

And a few properties need to be configured before you can run your web application with PineBlog.

{
    "ConnectionStrings": {
        "MongoDbConnection": "inMemory" // MongoDb connection string
    },
    "PineBlogOptions": {
        "Title": "PineBlog",
        "Description": "A blogging engine based on ASP.NET Core MVC Razor Pages and MongoDb",
        "ItemsPerPage": 5,
        "CreateAndSeedDatabases": true,
        "ConnectionStringName": "MongoDbConnection",
        "MongoDbDatabaseName": "pineblog-db",
        "AzureStorageConnectionString": "UseDevelopmentStorage=true",
        "AzureStorageBlobContainerName": "pineblog",
        "FileBaseUrl": "http://127.0.0.1:10000/devstoreaccount1"
    }
}

Blog Settings ConfigurationProvider

To be able to update the blog settings from the admin pages, you need to add the PineBlog IConfigurationProviders to the IConfigurationBuilder in the Program.cs. Add config.AddPineBlogMongoDbConfiguration(reloadOnChange: true); to ConfigureAppConfiguration(..) on the IWebHostBuilder.

WebHost.CreateDefaultBuilder(args)
    .UseStartup<Startup>()
    .ConfigureAppConfiguration((hostingContext, config) => {
        config.AddPineBlogMongoDbConfiguration(reloadOnChange: true);
    });

Markdown support

Markdig is used as the Markdown processor and the following markdown features are enabled by default:

If you want or require more advanced Markdown features, you can enable those by overriding the ~/Areas/Blog/Pages/Shared/_Post.cshtml partial (see source).

Tables

How to create the following table with styling, using pipe tables and generic attributes.

Company Contact Country
Alfreds Futterkiste Maria Anders Germany
Centro comercial Moctezuma Francisco Chang Mexico
Ernst Handel Roland Mendel Austria
Island Trading Helen Bennett UK
{.table .table-striped}
|Company|Contact|Country|
|-|-|-|
|Alfreds Futterkiste|Maria Anders|Germany|
|Centro comercial Moctezuma|Francisco Chang|Mexico|
|Ernst Handel|Roland Mendel|Austria|
|Island Trading|Helen Bennett|UK|

Using CSS

How to create the following blockquote with an bootstrap info-alert style, using generic attributes.

Normally the dangers inherent in the diverse hardware environment enhances the efficiency of the inductive associative dichotomy on a strictly limited basis.

{.alert .alert-info}
> Normally the dangers inherent in the diverse hardware environment enhances the efficiency of the inductive associative dichotomy on a strictly limited basis.

.Net 5.0

The PineBlog packages are now targeting targeting net5.0 and netcoreapp3.1.

Where can I get it?

You can install the Opw.PineBlog metapackage from the console.

> dotnet add package Opw.PineBlog

The Opw.PineBlog metapackage includes the following packages.

  • Opw.PineBlog.EntityFrameworkCore package The PineBlog data provider that uses Entity Framework Core. NuGet Badge

  • Opw.PineBlog.RazorPages package The PineBlog UI using ASP.NET Core MVC Razor Pages. NuGet Badge

  • Opw.PineBlog.Core package The PineBlog core package. This package is a dependency for Opw.PineBlog.RazorPages and Opw.PineBlog.EntityFrameworkCore. NuGet Badge

  • Opw.PineBlog.MongoDb package The PineBlog data provider that uses MongoDb. NuGet Badge

Demo website

Check out the PineBlog demo website. You can write and publish posts, upload files and test application before install. And no worries, it is just a sandbox and will clean itself.

Url: pineblog.azurewebsites.net
Username: pineblog@example.com
Password: demo