Add WebP to Media Profile options, Sitemap DateTime format should be ISO 8601 compliant - This week in Orchard (24/06/2022)

Gábor Domonkos's avatar
Media Library, Documentation, This week in Orchard, Sitemaps

Adding WebP to Media Profile Options, fixing that Sitemap DateTime format should be ISO 8601 compliant, and updating the Scripting docs to reflect the correct way to use IScriptingManager and IScriptingEngine! Check out our current post to read about the details!

Orchard Core updates

Add WebP to Media Profile options

WebP is an image file format developed by Google intended as a replacement for JPEG, PNG, and GIF file formats. It supports both lossy and lossless compression, as well as animation and alpha transparency. Google announced the WebP format in September 2010 and released the first version of its supporting library in April 2018. And from now you can select the WebP when adding a new Media Profile!

To try that out, simply navigate to the admin UI of Orchard and find Configuration -> Media -> Media Profiles. Here you can add a new Media Profile or edit the existing ones. And the editor contains a dropdown where you can select the format for the processed image (a default value means a format command will not be applied). And from now, you can see that the list contains the WebP as well. Don't forget to check out the docs to know more about Media and Media Profiles!

New WebP Media Profile format

Sitemap DateTime format should be ISO 8601 compliant

When formatting DateTime, sitemap source builders use the current culture instead of an invariant one. Here are the steps to reproduce the behavior:

  1. Change default culture to fi or fi-FI.
  2. Create a sitemap and add content to it.
  3. As a result, the formatted DateTime in the sitemap uses a period as a separator instead of a colon as you can see on the screen.

The wrong DateTime format in the sitemap

Now, this has been fixed to use a colon as a separator instead of a period.

Update the Scripting docs to reflect the correct way to use IScriptingManager and IScriptingEngine

The scripting module provides an API allowing you to evaluate custom scripts in different languages. The example in the docs on how to evaluate code by executing some script using the IScriptingManager did not work. In the past, the example shows this way to get the current date using script.

var scriptingManager = serviceProvider.GetService<IScriptingManager>();
var date = scriptingManager.Evaluate("js: new Date().toISOString()");

However, the IScriptingManager does not expose a method that accepts string only.

The goal here is to update the example to something like:

var scriptingManager = serviceProvider.GetService<IScriptingManager>();
var engine = scriptingManager.GetScriptingEngine("js");
var scope = engine.CreateScope(_scriptingManager.GlobalMethodProviders.SelectMany(x => x.GetMethods()), serviceProvider, null, null);
var date = engine.Evaluate("js: new Date().toISOString()");

If you open up the page from the docs about the Scripting module, you will find an updated example code that describes the correct way how to execute a script by using the IScriptingManager interface.

Updated sample in the docs about executing a script

News from the community

Updated Lombiq's Open-Source Orchard Core Extensions

Lombiq's Open-Source Orchard Core Extensions is an Orchard Core CMS Visual Studio solution. It contains most of Lombiq's open-source Orchard modules and themes, as well as related utilities and libraries, like the Lombiq UI Testing Toolbox or the Training Demo module that guides you to become an Orchard Core developer. And from now, this solution with all the extensions inside is updated for Orchard Core 1.4.!

Included projects in the Lombiq's Open-Source Orchard Core Extensions

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 287 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