With many more features and updates, this week we check out the new headless recipe, the new
jsonparse Liquid filter and the updates of the Orchard Core documentation. We show you a demo about the Sitemaps feature and write about when to ship version 1.0 of Orchard Core!
Orchard Core updates
Add Headless recipe
Now you can find a new recipe called Headless. This is a new setup recipe that sets up a headless site that consists of CMS modules with GraphQL and OpenID. If you want to build a headless site, you will need to set up your site using this recipe. By the past, we were suggesting users do an empty site using the Blank recipe (empty.recipe.json) and then to enable OpenID and the needed modules. By using this recipe these modules are enabled by default. If you haven't seen it yet: there is a great detailed demo on YouTube about what will you get if you install your site using the Headless recipe.
Documentation for recipes and starter themes included with Orchard Core
Orchard Core is available for use via two different NuGet meta-packages:
You can also use several built-in themes:
- The Blog theme
- The Admin theme
- The Agency theme
- The Coming Soon theme
- The Theme
And choose from different kind of recipes:
- Empty recipe
- Blog recipe
- Headless recipe
- Agency recipe
- Coming Soon recipe
- Saas recipe
These themes and recipes include different configurations, different range of Content Types, Widgets and so on. There is a new getting started guide that lists what will you get if you install your site with one of the built-in recipes. If you are new to Orchard Core this guide will help you a lot to choose the recipe that fits the best for you.
When you preview a content item we create a transient content item in the server-side memory and then we asked it to be rendered. Then we send the rendering to the client. That's how the preview feature works. Every time when you do a keystroke, we fake like it's a real content item, ask the server to create it in memory and to render it in HTML and send us back by the HTML. The issue was when we create it on the server-side it's like a real creation including indexing. Lucene will be like: there is a new content item to index, so let's index it! And then it will appear in the index, but it's just a preview. The idea is to find a way to mark it. A possible solution is to check the ID of the content item and if it's -1 (it's a logical value that we set for the content item to say it's transient), it's not a real content item, so just ignore it.
Update "Creating a modular ASP.NET Core application" guide
The section called Registering a custom route in the Creating a modular ASP.NET Core application is out of date with code generation templates and implementation since the upgrade to .Net Core 3.0. Generation templates create a
Configure() method which accepts an
IRouteBuilder), which does not have a
MapAreaControllerRoute() is the method to use here.
Get draft content item by the alias
Before we just indexed the published version of the aliases. If you are following the Creating a new decoupled CMS Website guide it tells you how to get a preview of a content item using an alias in a custom Razor Page. The issue is that it would not work if you were creating a new item and then previewing it, because there would be no published version of the content item, so it would not be able to find the content item by its alias. Now we are indexing the alias for both for the latest and published versions of a content item. The latest version can be the published one if there is no draft.
Add jsonparse Liquid filter
Let's say you would like to be able to pass a custom JSON using Liquid. Before that, we have to create a string separated by commas and then split it and then you will have an array. And then do it for each property you want, because you wanted to generate tables based on existing values you had. In the documentation, you can see an array of objects captured to a variable named
someCollection. Using that,
someCollection becomes a string variable that contains that JSON document. By calling the
jsonparse using the
someCollection you will get a JObject and then it can be iterated on and accessed by the key and value properties. This filter is enabled by default when you do Liquid.
When to ship Orchard Core 1.0?
We have issues labeled with P0 and P1. These issues should be fixed to ship version 1.0. We can't ship the new version without fixing these issues. The more the community works on these ones, the quicker we can release 1.0. Feel free to grab from these to be able to release sooner!
Sitemaps module revisited
Let's set up a site using the Blog recipe. Then head to Configuration - > Features and enable the Sitemaps module. To use this module you need to set up the Base URL of your site under Configuration -> Settings -> General. After you have typed a fully qualified base URL of the web site, head to Configuration again, where you will see a new submenu called Sitemaps with two options: Sitemaps and Sitemap Index. Choose the Sitemaps one and click on the Add Sitemap button. Here you can see an Enabled checkbox, that gives you the ability to enable or disable your sitemap. If you uncheck this, you can disable the routing to the sitemap. If you are in the middle of constructing your sitemap or you don't want to publish it for some reason, you can uncheck this box. Give your sitemap a likable name and hit Create. Now you can add sources to your sitemap using the Add Source button. Here you can add Sitemap content types, that are entries for each one of the selected content types.
Here you have the possibility to index all content types or just the selected ones. You can also limit the number of content items to provide from this source. Let's say we want to include the first 50000 blog posts to this sitemap source. After you hit Save, you can view your sitemap.
To create a sitemap index, select the Sitemap Index option. Here you can set the URL of the sitemap index and the sitemaps this index contains. We have only one sitemap, so, select that one.
When you enabled the Sitemaps feature, you could see another related one in the Features list, called Localized Content Items Sitemaps. If you enable this module and have localized content items, you can build localized content items sitemaps. Let's see how a sitemap like this looks like! Here you can see the language of the given content item inside the
hreflang elements of the
XHTML tags. The content with the primary culture of your site goes first, which is en-US in this case. In the screen below you can see a sitemap that contains one blog post, that has a Hungarian localization too.
And that's not all! If you would like to know more about sitemaps, head to YouTube, where you can find the full demo about sitemaps!
This feature is still under development, but you can check the PR here.
News from the community
Tell us about your .NET performance challenges! - Hastlayer developer survey
Help us build the nerdiest .NET thing, Hastlayer: It turns performance-critical sections of .NET programs into computer chips! If you fill out our short questionnaire you can win a cool compute accelerator board worth $265! Check it out here:
The reason we're asking this is that we're building a .NET hardware accelerator, Hastlayer (https://github.com/Lombiq/Hastlayer-SDK it turns your program into a chip!) and want to better understand what other developers do. Thank you in advance!
Orchard Dojo Newsletter
Now we have 113 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course.
Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!