Skip to content

Lynicon CMS for ASP.Net Core for .Net Standard 2.0/2.1 and .Net 4.6.1/4.6

License

Notifications You must be signed in to change notification settings

jamesej/lyniconanc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lynicon CMS/DMS

nuget

For ASP.Net Core 2.0/2.1 (.Net Standard 2.0, .Net 4.6.1 and .Net Standard 1.6, .Net 4.6)

Lynicon CMS

Now we believe the most powerful CMS on .Net Core.

It can be this easy to add content management to your site

routes.MapRoute("articles", "article/index", new { controller = "Pages", action = "Index" });

public IActionResult Index()
{
  var data = new ModelType();
  return View(data);
}
routes.MapDataRoute<ModelType>("articles", "article/{_0}", new { controller = "Pages", action = "Index" });

public IActionResult Index(ModelType data)
{
  return View(data);
}

Introduction

In tune with the .Net Core philosophy, Lynicon is a composable and unopinionated CMS which is lightweight and low impact yet full featured. It supports fully structured content (i.e. JSON structures) defined as C# classes which can have properties which are subtypes or lists. Generally it maps one content item to a page, but it is trivial to set up as headless. It has no assumed tree structure for content, content relationship is defined by foreign key fields as in a relational database, with built-in facilities for traversing these relationships in both directions. Content navigation is done via a powerful filtering/search system, or via the site itself.

Content storage is highly flexible, it can be run without a database, with a SQL or other database, or customised to use almost any data source.

Delivered as a Nuget package or library, it will not get in the way of you using any other technology, or force you to use its features, and can even be added into existing projects. It is highly extensible with a powerful module system allowing you to remove unneeded features to decrease complexity and increase efficiency.

The content editor is shown alongside the page being edited so the effects of content changes are immediately visible. The rest of the backend is very straightforward as it does not attempt to provide the generally unneeded facilities to change content structure or front-end layout, this is done in code.

This CMS project provides the essential CMS functionality for Lynicon in ASP.Net Core, perfectly adequate for a smaller site or application. There is an MVC 5 version here. The project site is here, and this project builds a NuGet package whose page on Nuget is here. Documentation on Confluence is here. We welcome feedback to info@lynicon.com.

We have now released a module package supplying the major features needed for a larger-scale CMS including caching, search, publishing, url management etc. This is available here (closed source/paid for)

Table of Contents

Setup

Because .net core 2.0 has breaking changes, the repository contains two branches, Core1.1 for .net core 1.1, and master is now .net 2.0. Make sure you check out the right branch.

Once you have cloned the repository, you will need to get the test site working on your machine. Set the connection string in appsettings.json Appsettings

You can now set up the database by running the test site from the command line (a handy feature of an ASP.Net Core site!). Open a command window as Administrator and go to the \src\LyniconANC.Release directory. Now run dotnet run -- --lynicon initialize-database.

Then you can set up the CMS admin user. Run dotnet run -- --lynicon initialize-admin --password p4ssw0rd. Initialize

You can now run the site and login with the password you set up (the email is admin@lynicon-user.com)

If you would like to populate your database with sample content, there is a script at \src\LyniconANC.Release\Areas\Lynicon\Admin\SQL\TilesSiteContentSetup.sql which will create example content for the test site.

How Tos

Log in as admin

Lynicon configures it's own customised ASP.Net Identity implementation. This means you can log in via the (slightly modified) template code login page, using the admin email (admin@lynicon-user) and the password you configured above. Alternatively you can use Lynicon's built in login page at /Lynicon/Login

Create a content-managed route, controller & view

In Lynicon, you define a route as supporting content management, which then passes an instance of a content class into the controller, which passes it on to the view to display. This is described further in the online manual.

For examples, look in the Startup.cs file, TileContent.cs file and TileController.cs.

Add and edit content items

Content items are listed and can be added at /lynicon/items. Content items can be edited by visiting a url with which the content item is associated while logged in with the appropriate rights. The content editor panel is shown. This is described in detail in the online manual

Use HTML snippets, images, links etc in your content class

Since Lynicon uses C# classes to define the content schema, it provides standard classes such as HtmlMin, Image, Link for storing data required in content management. This is described in the online manual. The built-in asset handling system allows upload of images or other assets through a Windows Explorer-style popup to a specified folder in the site.

Use lists and subtypes in your content class

Content classes in Lynicon can have properties of an arbitrary subtype, or List properties of arbitrary type T. The content editor manages this automatically. You can create custom editors for subtypes using the MVC templating system, by adding to the templates named after various content subtypes which already exist in Areas/Lynicon/Views/Shared/EditorTemplates. This is described in detail in the online manual

Link to other content items in your content class

Another standard property class in Lynicon is Reference. This stores the id of another content item in your content class. It appears in the editor as a drop-down list of content items of type T. In code you can retrieve the referenced content item (actually, it's summary, see below) as a property on Reference or you can get all content items with a reference to another item. Examples can be seen in Tile.cshtml and TileMaterialContent.cs. See the online manual for more depth.

Filter, search and report on content

Lynicon contains a page with various filters for creating, viewing, locating and reporting on content. This is at /lynicon/items/list or reached by clicking the Filter button on the bottom control bar on CMS pages. You can build custom filters which can be added to the list available on this page. See the online manual

Use the content API to create a list of items dynamically

Lynicon has a clean and powerful content API you can use in code to retrieve content directly. You can see an example in HomeContent.cs. Generally when working with content objects external to building the page that displays them, you use a Summary Type which contains the subset of the full content object's properties for efficiency. The content API uses linq for filtering, can run queries across multiple data sources and lets you retrieve all content whose content type implements an interface or inherits from a base type.

Use property source redirection to create site-wide fields with values constant across the site

Lynicon has a powerful means of combining content from different sources in order to build a content item. One use of this is to have a content item storing site-wide values, and have its fields be mapped into every content item on the site, e.g. for the url of the logo on the top banner. This is done in the example site by having a shared base type for all content on the site and using this property source redirection method to map fields on the base type to a single shared content item. You can see how the base type is set up at TilesPageBase.cs. The shared fields are held in CommonContent.cs.

Administer site users

Lynicon has an admin page at /lynicon/users which allows you to administer site users if you have admin privileges. See the online manual for more on this.

Run without a database

The (closed-source but free) Lynicon.Extra package on Nuget provides the Storeless module which converts Lynicon to run with CMS data in memory, with backup persistence to a JSON file. See the online manual for how to set this up - it's very simple and reduces hosting costs while making Lynicon run super fast for websites up to 500 or 1000 pages.

Use as a JSON API

If you want to get your content as JSON (or any other standard web format), the combination of ASP.Net Core and Lynicon makes this very easy and flexible.

For any content-routed page, you can simply request it with Accept header set to application/json and you will get the content as JSON.

You can also query across all content items of content type T:

In the example you can now call /api/tiles with any standard OData filtering, paging or sorting parameters to receive a json array of tile content serialized to JSON.

Running the tests

The tests should appear in the Test Explorer as normal in Visual Studio. If they are not there this is likely an issue with the XUnit test framework. Sometimes such issues can be resolved by cleaning and rebuilding the solution, and closing and reopening Visual Studio.

Tests can also be run as normal in .net core on the command line by going to the top-level installation directory in a command window and running dotnet test.

Contributing

We welcome all pull requests, comments, issues etc. You can also get in touch at info@lynicon.com

About

Lynicon CMS for ASP.Net Core for .Net Standard 2.0/2.1 and .Net 4.6.1/4.6

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published