Cms Types, .netCore Cms, Orchard Core
Published: 2020-04-02 18:56:51

Comparing traditional, decoupled and headless cms

traditional :
	in traditional content management systems both backend and frontend of the site is on the same system. Better to say that both editors and visitors of the site are viewing the same one.
Examples of this type are wix or wordpress.

Decoupled : in decoupled type backend and frontend are decoupled! Mean that they work independent;y of one another. It comes to mind what connect them together. Simply an api!

Headless: headless is a kind of decoupled without frontend. Its just api. It can serve any frontend

one of the problem of traditional is that it is good for simple sites. As the website becomes complex
lack of changing ability appear caused by the close connection of backend and frontend

but in the decoupled one in the first place overall product is quiet faster in a way that the api is going to connect the front end and backend and they are served independently.
And is most be considered that this way is more complex. But it is much easier to edit the project in this approach.

Headless approach is almost the same but However, without a designated front end, a headless cms provides the greatest flexibility to publish content on different platforms. Also, unlike decoupled, headless allows you to publish dynamic content to any device connected via IoT

for now I will choose decoupled approach and look at a framework called orchard core that is built on top of asp net core.
Some pros of this cms is :
it is modular means that every package is going to be a new nuget package.
It has a good documentation for getting started with it
docker support.
Reusable content fields. Role based user management also available.
Reusable website templates. We can manage multiple sites with a single Installation.
Offers both Headless CMS or Decoupled architecture

let ‘s get deeper in it

first of all orchard core is rewrite of the orchard in .net core way
Performance. This might the most obvious change when you start using Orchard Core CMS. It’s extremely fast for a CMS. So fast that we haven’t even cared about working on an output cache module. To give you an idea, without caching Orchard Core CMS is around 20 times faster than the previous version.
	I have copied some key features from the orchard documentation if you like to know more.
	After this I am going to make a sample website with orchard core.
    • Portable. You can now develop and deploy Orchard Core CMS on Windows, Linux and macOS. We also have Docker images ready for use.
    • Document database abstraction. Orchard Core CMS still requires a relational database, and is compatible with SQL Server, MySQL, PostgreSQL and SQLite, but it’s now using a document abstraction (YesSql) that provides a document database API to store and query documents. This is a much better approach for CMS systems and helps performance significantly.
    • NuGet Packages. Modules and themes are now shared as NuGet packages. Creating a new website with Orchard Core CMS is actually as simple as referencing a single meta package from the NuGet gallery. It also means that updating to a newer version only involves updating the version number of this package.
    • Live preview. When editing a content item, you can now see live how it will look like on your site, even before saving your content. And it also works for templates, where you can browse any page to inspect the impact of a change on templates as you type it.
    • Liquid templates support. Editors can safely change the HTML templates with the Liquid template language. It was chosen as it’s both very well documented (Jekyll, Shopify, …) and secure.
    • Custom queries. We wanted to provide a way for developers to access all their data as simply as possible. We created a module that lets you create custom ad-hoc SQL and Lucene queries that can be re-used to display custom content, or exposed as API endpoints. You can use it to create efficient queries, or expose your data to SPA applications.
    • Deployment plans. Deployment plans are scripts that can contain content and metadata to build a website. You can now include binary files, and even use them to deploy your sites remotely from a staging to a production environment for instance. They can also be part of NuGet Packages, allowing you to ship predefined websites.
    • Scalability. Because Orchard Core is a multi-tenant system, you can host as many websites as you want with a single deployment. A typical cloud machine can then host thousands of sites in parallel, with database, content, theme and user isolation.
    • Workflows. Create content approval workflows, react to webhooks, take actions when forms are submitted, and any other process you'd like to implement with a user friendly UI.
    • GraphQL. We provide a very flexible GraphQL API, such that any authorized external application can reuse your content, like SPA applications or static site generators.

Ok now let’s get out hand little dirty in code!

Well the only thing that you need is having the lastest dotnetcore version installed.
After that just put this dependency in your .csproj file :
<PackageReference Include="OrchardCore.Application.Cms.Targets" Version="1.0.0-rc1-10004" />

after that do a dotnet restore, and add 
services.AddOrchardCms (); // it calls autmatically services.addrazorpages

to your services
and also comment every thing below app.useStaticFiles and put this instead:
app.UseOrchardCore ();

well done!

We ‘re all done! Now just run the project and you will see the register page!
Any name and usename and password you like choose it but many of us like to see something in the first glance so choos the recipe as Agency to generate some template after that head to /admin
fill in the usename and password and you are in the admin page!

Some thing is needed to know here.
Content type, content part, content item

content type: think of it as the parent! An example maybe a product and every product has some parts like name description and something like this.
Until here I just mentioned the structure, but every new item of the type of the content type is actually the content item. So content item is the items that is made of the particular content type!

Well at this point you can a lot of thing like making a new page with new items and so on 
like any other cms such as wordpress.
But the good point in orchard is that you can do make content types and content parts and event their fields through code and maybe consume their data in an api controller!

Orchard also contain role base authentication pre built. And you have the ability to define users
and assign the the roles in the system.

There is also the ability for you to make modules! I mean that after installing orchard templating 
there is a command that make you a module and in a module you have all controllers and view
I mean that you ability of modular programming in orchard very easily. Just write a module and refrence in main project

as I’ve dive into the orchardcore documentation I always saw a way to customize thing through code. Like migrations.