Click to deploy improvements, autoroute container routing - This week in Orchard (24/04/2020)
This week we continue the journey with the new upcoming feature of Orchard Core called Click to deploy. But before that, we will check out the new Liquid helpers, the contributors' page, and many more! Finally, don't forget to take a look at our newest Orchard Nuggets post and the improvements in our Orchard Core Training Demo module!
Orchard Core updates
It can be hard sometimes to keep all the themes updated with the latest changes and improvements of Orchard Core. Now in every theme, you can add a custom template for the title or can use the features of the built-in one. If you check the code of the
PageTitle shape in the PageTitleShapes.cs file, you will see the usage of the
LiquidTemplateManager that helps you to customize the way how you would like to render the title of your page. We wrote about how to customize the title in Liquid here: https://orcharddojo.net/blog/this-week-in-orchard-09-06-2019.
And in some themes, the
HeadMeta zone hasn't been used in the layout. Now you have the possibility to show the content of this zone in every theme and rendering this at the end of the head tag. In this case, you can add your custom CSS in this section and have the ability to override the styling of the theme that you are using. Let's check the layout.liquid file of the Coming Soon Theme for these changes.
Orchard Core has more than 150 contributors! The repository of Orchard Core now contains a Contributors.md file, where you can find the profiles of the contributors. They can have different badges, based on the type of work. There are badges for answering questions, doing code reviews, writing blog posts, and so on.
Autoroute container routing
A few weeks ago we wrote about the new settings of the Autoroute part:
- Allow contained item routing: Check to allow users to enable routing of child content items.
- Manage contained item routes: Check to allow this part to apply routes to child content items.
- Allow absolute path: Check to allow users to enable absolute paths for child content items
If you prefer videos you can also find a demo about this feature on YouTube. And now the huge PR that contains this feature is merged in the dev branch of Orchard Core! Would you like to try this out yourself? Use the latest changes of dev branch now by adding this OrchardCore-preview MyGet URL to your NuGet sources: https://www.myget.org/F/orchardcore-preview/api/v3/index.json as it described here. Thanks for this great feature for Dean Marcussen!
Add support for DictionaryAttributePrefix and ModelExplorer property in Liquid
You can find an OrchardCore.Demo module in the source of Orchard Core. The goal of this project is to show you the different features of Orchard Core by providing great sample codes. This project has been updated with the latest Liquid helpers. If you open the
TodoController.cs in the module, you will find the endpoints of a simple To-do app. But that's not the interesting part. There are 4 related Liquid files in the module. Two in the Todo folder in the Views called Edit.liquid and Index.liquid and two in the root of the Views folder called Todo.Edit.liquid and Todo.liquid.
Here comes the content of the Index.liquid file. Here you can see a simple table contains the to-do items. But after the table, there is a button that navigates the users to a page where they can create new to-do items. You can see the
block Liquid helper here and the way about how to set the route values for the button.
So, if you click on that button you will be navigated to the
Create action of the
TodoController, that is about to render the Todo.Edit.liquid shape. Here you can also find several new helpers. The
form helper is about to render a form and the
helper Liquid helper is invoke the input tag helper of ASP.NET Core and binds Text of the Model.
If you check the rendered page of the Todo.Edit.liquid file you will see the form that is used to create new to-do items.
Every new Liquid helper (form, input, label, validation_summary, validation_for, span) can be found in the Orchard Core documentation.
Add icons to Configuration Settings menus
When you navigate to the admin UI of Orchard Core and check the root menu items in the navigation bar, you could see that these items have icons. From now, some submenu items are just about to show you some icons too. Head to Configuration -> Settings or Security to see the new ones.
Click to deploy improvements
If you haven't seen the demo about the upcoming feature called Click to deploy yet, head to YouTube to watch the recording or check out the previous This week in Orchard post because this will be the continuation of the Click to deploy feature.
First, navigate to Configuration -> Features and enable the three new features:
- Add Content to Deployment PLan
- Click to Deploy Content
- View or Export Content as JSON
Now head to the content items list (Content -> Content Items) and hit the Actions button to open the dropdown. You can see that the context menu is now getting a lot more items. The Export to Deployment Target is about to automatically create a custom recipe file that can be downloaded locally or send it to a remote instance. You can use the Available Targets modal to select the destination.
The Add to Deployment Plan is about to add a new content item step using this content item to an existing deployment plan. In this case, a new modal window will open again that lets you choose from the available deployment plans.
The Export as JSON is about to directly download the recipe to your computer locally and the View as JSON is a very helpful feature because as you could see in the screen below it shows you the JSON representation of the content item. The same JSON will go to the content step of the recipe when you are hitting the Export as JSON button. Here you have the availability to copy the JSON structure by clicking on the copy icon at the top-right corner of the page.
If you are interested in the full demo don't forget to watch the recording on YouTube! Note that this feature is under development and can be found in this branch!
News from the community
Orchard Core Training Demo module: creating a widget from code
We have just added some lines to our Orchard Core Training Demo module to show you the way about creating a new widget from code. In the PersonMigration.cs file we defined a PersonPart, an index table for this part, a Person content type, and from now a PersonWidget.
Orchard Core Training Demo module is a demo Orchard Core module for training purposes guiding you to become an Orchard developer. You can use this module as part of a vanilla Orchard Core source that including the full source code - which is the recommended way.
You can use it as part of a solution the uses Orchard Core NuGet packages, however, it's harder to look under the hood of Orchard Core features.
The module assumes that you have a good understanding of basic Orchard concepts and that you can get around the Orchard admin area (the official documentation may help you with that). You should also be familiar with how to use Visual Studio and write C#, as well as the concepts of ASP.NET Core MVC.
Bug reports, feature requests, and comments are warmly welcome, please do so via GitHub. Feel free to send pull requests too, no matter which source repository you choose for this purpose.
Orchard Nuggets: How to add a favicon under /favicon.ico in Orchard Core
Every website needs a favicon of course and you can easily add one to your Orchard Core site from a theme or module with a link tag in a template. However, there's a catch: Certain browsers will still search for it (as a first attempt) under the path /favicon.ico. This can be a tiny bit detrimental to the client-side performance, and show up as annoying errors in your logs. So what can you do to serve a favicon under that path too?
In our newest Orchard Nuggets post, we give you the answers! Check out the other posts for more such bite-sized Orchard tips and let us know if you'd have another question!
Orchard Core workshops
The contributors of Orchard Core will hold some unique online workshops in the coming months, between May and September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events.
Lombiq's developers will also give two workshops, on using Orchard from the admin UI and on developing a module.
Are you looking to get up to speed with Orchard? Check out the workshops' details on the Orchard Core homepage!
Orchard Dojo Newsletter
Now we have 139 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!