Anto Subash.

Orchard Core - Getting Started -Part : 1

Orchard core. Getting started - Part 1

Table of contents

Intro

In this post we will see how to get started with the orchard core.

Installing the Orchard CMS templates

Once the .NET Core SDK has been installed, type the following command to install the templates for creating Orchard Core web applications

1dotnet new -i OrchardCore.ProjectTemplates::1.1.0

Creating the CMS

To create the cms run the following command.

1dotnet new occms -n MyCms

Change directory into the MyCms folder and run the project.

Running the application

1dotnet watch run

Your application should now be running and listening on the following ports:

1Now listening on: https://localhost:5001
2Now listening on: http://localhost:5000
3Application started. Press Ctrl+C to shut down.

Open a browser and navigate to https://localhost:5001 to display the setup screen.

we will create the website using the Headless recipe. The Headless recipe is intended to get you started when using Orchard Core as an API, and Content Management System, with Administrator access to the host.

Complete the setup form and select the Headless recipe and SQLite for the database.

Submit the form. A few seconds later you should be looking at a Headless Site.

In order to configure it and start writing content you can go to https://localhost:5001/admin

Create content

In the admin page open the Content => Content Definition => Content Types => Create new type

In the New Content Type page provide the Display name and the Technical Name.

In the Add Parts page Click Save.

In the Edit Content Type page Add Parts => Title => Save then Fields => IsDone => Boolean Field => Save

Then save the Content type.

Now visit content items to create a new content.

Display content

create a Pages folder and create todo.cshtml file inside the Pages folder

1@page "/todos"
2@inject OrchardCore.IOrchardHelper Orchard
3@{
4    var todos = await Orchard.GetRecentContentItemsByContentTypeAsync("Todos");
5}
6@Orchard.ConsoleLog(todos)
7<h1>List all Todos</h1>
8@foreach (var todo in todos) {
9    <p>
10        @todo.DisplayText
11    </p>
12    <p>
13        @todo.Content.Todos.IsDone.Value
14    </p>
15}

Now navigate to https://localhost:5001/todos to see the created todos.

Sample repo : https://github.com/antosubash/Anto.OrchardCore.CMS

Buy Me a Coffee at ko-fi.com