Miniweb asp.net core

An easy to use Simple CMS website that just needs page templates and content item templates in form of cshtml files. Runs on asp.net core

View project on GitHub

MiniWeb small CMS for asp.net core

What is miniweb

Firstly an easy to use Simple CMS website that just needs page templates and content item templates in form of cshtml files

Secondly it is an experiment with what .net coreclr can and can't do. I'm currently using

it currently runs on 1.0.0-rc2 Tested on windows, mac osx, linux (ubuntu)

Inspired by the MiniBlog package by Mats Kristensen.

It needs bootstrap v3.2 for now for the admin menu to work and contains a modified version of bootstrap-wysiwyg

Example

Reference the MiniWeb.Core and one of the storage packages. Create an empty website. See the TestWeb project for an example implementation. Make sure the basic bootstrap files ar in the wwwroot folder.

Page templates are stored in the /Views/Pages folder

A page template example:

@model MiniWeb.Core.SitePage
@{
    Layout = Model.Layout;
}
<div role="main" class="col-sm-9" miniweb-section="content">
</div>

<aside role="complementary" class="col-sm-3" miniweb-section="aside">
</aside>

Content items can be added to miniweb-section tags and should live in the /Views/Items folder

A content item example

@model MiniWeb.Core.ContentItem
<article miniweb-template="@Model.Template" >
    <h3 miniweb-prop="title"></h3>
    <div miniweb-prop="content" miniweb-edittype="html"></div>
    <div miniweb-prop="other" miniweb-edittype="html"></div>
</article>

every tag can have a miniweb-prop attribute that will be stored in the content item, edittype is eiter single line or specified as html. For this to work the miniweb taghelpers need to be registered for instance in the /Views/_ViewImports.cshtml

@addTagHelper "MiniWeb.Core.*, MiniWeb.Core"

the minimal startup will be something like this:

public IConfiguration Configuration { get; set; }

public Startup(IConfiguration configuration)
{  
    Configuration = configuration;
}

public void ConfigureServices(IServiceCollection services)
{
    // Default services used by MiniWeb
    services.AddAntiforgery();
    services.AddMvc();

    //registers miniweb and json storage provider
    services.AddMiniWebJsonStorage(Configuration)
	    .AddMiniWebAssetFileSystemStorage(Configuration);
}

public void Configure(IApplicationBuilder app)
{
    // Default middleware used by MiniWeb
    app.UseDeveloperExceptionPage();
    app.UseStaticFiles();

    //Registers the miniweb middleware and MVC Routes
    app.UseMiniWebSite();
}

Storage

Currently there are two storage packages

  • MiniWeb.Storage.JsonStorage
  • MiniWeb.Storage.XmlStorage
  • MiniWeb.Storage.EFStorage

all are filesystem stores and store their files in the /App_Data/Sitepages folder

Files are stored with the AssetStorage package, currently only the FileSystem assetstorage is available

  • MiniWeb.AssetStorage.FileSystem

TODO

  • Checkout razorpages setup option
  • Work with precompiled views