Make Resources module always enabled, Content Preview module - This week in Orchard (22/04/2022)

Gábor Domonkos's avatar
This week in Orchard, Theme

This week you can read about making the Resources module always enabled, fixing HTML accessibility validation in the admin UI, using LinkGenerator instead of IUrlHelper in SignalMethodProvider, and a demo of the Content Preview module for Orchard Core! Are you interested in the details? Check out this post for more!

Orchard Core updates

Make Resources module always enabled

Let's say you have the Resources module enabled on your site. The Resources module declares scripts and stylesheets that you can use across your tenants like you can have jQuery, jQuery UI, Bootstrap, and CodeMirror just by using the assets defined in this module. But you were able to disable the Resources module without any warning. If you disable that module, you will face an exception. From now you can see that the IsAlwaysEnabled property is set to true in the Manifest file of the module. IsAlwaysEnabled only means that you can't disable the feature once it is enabled, so you can still not use it if not defined from a setup recipe, from a configuration, or from the app with the helpers and so on.

Make Resources module always enabled

Fix HTML accessibility validation in the admin UI

There were some UI warnings on the admin page if you run through these validators in the admin UI of Orchard Core:

Most of the warnings were found in the UserMenu.cshtml and the Layout. cshtml. For example:


  • Attribute class duplicated.
  • Attribute asp-route-returnurl should be lowercase.
  • <button> is missing the required type attribute.


  • <resources> must not be self-closed.
  • <button> is missing the required type attribute.
  • Anchor link must have a text describing its purpose.

Now - as you can see - the button has the type attribute, there are no duplicated class attributes, and the returnurl is lowercased.

Fixing HTML accessibility validation

Use LinkGenerator instead of IUrlHelper in SignalMethodProvider

The signalUrl() JavaScript helper method stopped working, and you were faced with this error:

The fault message of the signalUrl JavaScript helper method

The solution was to not use the IUrlHelper interface anymore but instead of that, use the LinkGenerator, which has a GetPathByAction method that can provide the URL for you.

Use LinkGenerator instead of IUrlHelper in SignalMethodProvider


Content Preview Module

Hisham Bin Ateya has an organization on GitHub called OrchardCore Contrib with a couple of projects under it. The OrchardCoreContrib.Modules repository contains several modules. This demo is about checking how you can use the Content Preview Module.

The Content preview feature of Orchard Core allows you to display the result that will be rendered on the front-end in a separate window while you are editing a content item in the admin. A Preview button is available in the action buttons when you create or edit a content item. And this module allows you to preview your page on different devices.

So, if you add the OrchardCoreContrib.ContentPreview NuGet package to your Orchard Core host project and run your application, you will find a new feature if you search for the bar word in the Configuration -> Features screen.

The Page Preview Bar feature

If you enable the Page Preview Bar feature, you will be able to preview the currently visited page on desktop, tablet, and mobile from within the top page preview bar. In our case, we hit the Preview button of the predefined About article of the Blog recipe.

Content Preview Module

If you would like to know more, head to YouTube for a short demonstration of this module!

News from the community

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 247 subscribers! 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 is 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!

If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

No Comments

Add a Comment