This week in Orchard - 9/11/2018

This week in Orchard

If you like demos, you will enjoy our current post!

On Orchard 1.x

Last time we mentioned that the next release of Orchard 1.x will arrive soon after the Dynamic Compilation will work with C# 7. Good news, now we have the PR that contains the changes that needed for the Dynamic Compilaton, thanks to Benedek Farkas from Lombiq!

On Orchard Core

Standard CMS, Headless CMS and Decoupled CMS

At August 31, Sébastien gave a live demo about what's the difference between the Standard CMS, Headless CMS and Decoupled CMS.

  • Standard CMS: With a traditional CMS (like Wordpress or Joomla) users create and edit their content through tools like a WYSIWYG editor or an HTML editor and save it to the back-end database. The CMS then displays the content according to the front-end delivery layer built into the CMS. A traditional CMS is sometimes referred to as a "coupled" CMS. This is what Orchard Core can do by default. You set a theme and then you get a website to edit the content.
  • Headless CMS: If a traditional CMS was a body, the "head" would be the front-end components like the front-end framework and templating system. If you chop that head off, and you’re left with a headless CMS. A headless platform has no default front-end system to determine how the content is presented to the end user. Instead, it’s front-end agnostic, meaning that your content is raw and can be published anywhere, through any framework. So, you only edit the content and you access the data using REST APIs. With that you can create a static website, that calling the REST APIs.
  • Decoupled CMS: With a decoupled CMS, your content is managed separately and is front-end agnostic, just like a headless CMS. Yet, it has front-end delivery tools in the box, like templates, if you want to use them. Remember when we chopped the "head" off a traditional CMS to make it headless? Well, imagine the same scenario here, except this time, we kept the head. It’s not attached to the main body as with a traditional CMS — but you aren’t totally left to your own devices when it comes to front-end delivery, like with a headless CMS, either. So, decoupled CMS is a mix of Standard CMS and Headless CMS. You can still edit the content using the CMS-part and you can render the website from the same web app, but the website you are rendering has been built by your own. You make all the pages that you will render, the CMS itself doesn't render anything, the front-end and back-end communicate to each other through calls to an API.

With Orchard Core you can do all of this, you can render your site as a Standard CMS, as a Headless CMS or as a Decoupled CMS. The idea of that demo was to show some advanced content management even in the Decoupled CMS. So you can just simply create an ASP.NET MVC web app with some Razor pages and grabbing the content from content APIs and nothing more.

@{
var query = await QueryManager.GetQueryAsync("Portfolio");
var results = (System.Collections.IEnumerable) await QueryManager.ExecuteQueryAsync(query);
} @foreach(ContentItem Project project in results)
{
<a href="#">@project.Content.TitlePart.Title</a>
}

In this case, we made a SQL query, called Portfolio, that returns all the Portfolio content items. And for that each Portfolio content item we can render the properties in the markup.

But there were issues, for example if you want to create new pages or edit the existing ones you always need to rebuild the solution. One of the biggest issue that it was not easy to reuse the services that are defined in OrchardCore helper.

For example you can easily access the current culture like:

<html lang="@OrchardCore.CultureName()">
</html>

It would be great to be able to use these helpers in the Decoupled CMS as well.

The other big issue is about the login. The login controller redirects us to a front-end page to login. Then it tries to find the theme and it will fail, because there is no layout shape. The login can't be decoupled right now, because it's completely coupled to the front-end.

Because of these issues, Sébastien will redo the same demo once he has the correct APIs and fixed the mentioned issues. We will publish the recording of that demo instead of this one. But if you are interested in this demo, just go ahead and ask Sébastien to share the link of that video with you.

Demos

Two new Orchard Core templates

Marcos Aidos and Sijmen Koffeman created two new themes for Orchard Core using Liquid and on the latest Orchard community meeting they showed a demo about the Cafe Theme (Multipage website example) that is based on a StartBootstrap theme called Business Casual.
The other one that you can find in the GitHub repository is called New Age theme.

You have two different approaches when you build a new theme:

  1. You can construct the model first and create the theme. In this case you could have switchable themes for the precreated content.
  2. You can construct the theme first and then build the model.

You can build your theme using Razor or Liquid. Both ways you will face with pros and cons:

  • In Razor, the refences are mandatory, but you can write C# code in the templates. Razor is not safe, because its C#. If we let the admins or anyone to write Razor, we let them write C#. If we let them write C#, we let them to have access to everything.
  • Liquid has "noise-free" templates, because there is no need to add references to your files. To use Liquid you have to learn the syntax of Liquid and implement your own helpers to be able to render the requested content in the layout. So, you only have access to the properties that are opted in, it’s like a sandbox.

Webhook module

You can watch a demo about how to use the new Webhooks module to post a message to a Discord channel when publishing Articles in Orchard Core.

This module is still under development, so you will not find the code in the dev branch of Orchard Core.

Facebook Login module

With the help of this module you can authenticate yourself using Facebook. If you registered to Facebook and to the Orchard Core site with the same e-mail address, you have the ability to link these two account based on the e-mail address by the OpenId client. If the user doesn't exist in Orchard Core, it will create a new one based on the Facebook account's email address.

This module is also under development, so you will not find the code in the dev branch of Orchard Core.

On Lombiq

Conference site with custom Bootstrap template - GPU Day case study

The GPU Day conference series organized by the Wigner Research Centre for Physics of the Hungarian Academy of Sciences is dedicated to the fields of parallel and high-performance computing, visualization and data analysis in scientific and industrial applications. On the last three conferences Lombiq presented its cutting edge technology, called Hastlayer. The conference site was developed by Gábor Domonkos from Lombiq here on DotNest which is a great proof of how far you can get using only the built-in DotNest features and Media Theme for theming. If you are interested in the case study about the development of the GPU Day theme, don't forget to visit the DotNest blog!

DotNest developer survey

We at Lombiq want to make DotNest the best developer-focused Orchard hosting platform around and we can't thank you enough for taking the time to help us understand the best way to do that. If you would like to help us, please fill our short DotNest developer survey.

No Comments

Add a Comment