Our blog contains the activity stream of Orchard Dojo: general news, new resources or tutorials are announced here.

Featured tags

IIS
API
SMS
SEO
All tags >

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

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! 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: Change default culture to fi or fi-FI. Create a sitemap and add content to it. 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. 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. 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.! 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!

Amazon S3 Media Storage support, Content Localization module - This week in Orchard (17/06/2022)

New Amazon Media Storage feature that enables support for storing assets in Amazon S3 Bucket, a demo about the new Localization Matrix feature, and many more! Check out this post for the details! Orchard Core updates Amazon S3 Media Storage support The Amazon Media Storage feature enables support for storing assets in Amazon S3 Bucket. The feature replaces the default App_Data file-based media store with an Amazon Media Storage Provider. Media is still served by the Orchard Core website, and the Media Cache module takes responsibility for fetching media, on the fly, from the Amazon S3 Bucket. This allows the Amazon Media Storage feature to support image resizing on the fly through integration with ImageSharp.Web. The URL generated by the AssetUrl helpers points to the Orchard Core website. You can also find documentation about what configuration values are used by default and can be customized. In the docs, you can also read about the S3 Bucket policies, how to configure a bucket per tenant or how to configure a single bucket, with a base folder per tenant, and many more. Auto register IDisplayManager<T> for T on AddTheming In Orchard Core, to add a display manager, we configure services for each type as below eg, services.AddScoped<IDisplayManager<MenuItem>, DisplayManager<MenuItem>>();services.AddScoped<IDisplayManager<User>, DisplayManager<User>>(); It seems redundant code to resolve services for DisplayManager for a given type. Orchard builder should register generic display manager resolver as below, similar to what it's already done for Documents here. So, from now, instead of registering all the implementations of IDisplayManager<T>, there is a generic registration which is in the OrchardCoreBuilderExtensions.cs. So, anytime you resolve a generic IDisplayManager, you will get the DisplayManager of this time. Demos Content Localization 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. If you remember, you could also see a demo about the Swagger module made by Hisham, as well. This time we will check out how you can use the Content Localization Module. The point here is that this module provides easy integration. So, if you add the OrchardCoreContrib.ContentLocalization NuGet package to your Orchard Core host project, you are good to go. The module provides features for localizing content with one feature in it, called Localization Matrix, that shows a matrix for localized content per culture. Just head to the admin UI of Orchard Core and search for the matrix word in the Configuration -> Features screen. To be able to see the goal of this feature, we need to do some preparations first. That means, we need to have a content type with the Localization Part attached. We set up our site using the Blog recipe, so we just navigate to Content -> Content Definition -> Content Types and edit the Blog Post one. And under Parts, we add the Localization Part to it. And don't forget to have at least two cultures that are supported by the site (Configuration -> Settings -> Localization -> Cultures). Now, let's create another localized version for the built-in post, and let's create a new blog post as well with only one localization. Here come our blog post content items. Now let's see the new feature in action. If you navigate to Configuration -> Settings -> Localization -> Localization Matrix, you will see the new page added by this feature. This page shows you an overview of which content items are there in the system that is localizable (have Localization Part attached) and which versions they have. As you can see, we have the Hungarian and the US localization for the built-in blog post. But the blog post with the title Missing localization only has a US version but no Hungarian version. And as always, if you would like to know more about this feature, head to YouTube for a recording! News from the community Orchard Core Commerce MVP planning and survey A few weeks ago, you could see a nice demo about the Orchard Core Commerce module. And in that blog post, we also mentioned that Lombiq provides stewardship for this module. That actually means that we will do code reviews and work on features and fixes. To have that, Márk Bartha (who is the project leader from our side) started this thread and added this survey. This is about asking the community what the most important features for you would be in an Orchard Core-based e-commerce solution. If you do e-commerce or if you have an opinion about e-commerce, please share your opinion here. The point of this is to try to do not all the things but focus on what is really needed first. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 279 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!

Cache Failover and Shared options, YesSql updates - This week in Orchard (26/11/2021)

Huge YesSql updates, new cache failover and shared options, Media Library improvements, and a new site running on Orchard Core! Do you want to know more? Then don't forget to check out our current post! Orchard Core updates YesSql updates YesSql has updates for the following drivers: MySqlConnector 2.0, Npgsql 6.0, Microsoft.Data.Sqlite 6.0. The Npgsql 6.0 has breaking changes in terms of date and time serialization. The breaking change is in the way it handles time stamps and date-time storage and the type of column that it stores them into. The Microsoft.Data.Sqlite is on 6.0, which contains the SQLite Connection Pooling, so it's pooling SQLite connections now. If we check out the benchmarks for MVC, where Orchard is one of them, and it's running the About page on SQLite, and you can see that on both Windows and Linux it goes up from around 5000 requests per second to 16000 requests per second and also the latency went down. Removed beforeFolderAdded to stop multiple calls to fetch folders When you click OK on the new Media Folder name dialog, the first thing it does after creating the new folder emits beforeFolderAdded which loads the folder we are currently on. Then it emits the folderAdded, which selects the new folder (triggering a load of the new folder through the watcher). It appears that both requests are in flight at the same time, and we are seeing that occasionally the beforeFolderAdded request comes in last and then makes it appear as if the new folder has all the contents of the previously selected folder. bus.$on('addFolder', function (target, folder) { if (self.model == target) {bus.$emit('beforeFolderAdded', self.model); if (self.children !== null) { self.children.push(folder); } folder.parent = self.model; bus.$emit('folderAdded', folder); }}); So, when we create a folder, we fire the beforeFolderAdded then folderAdded both of which load contents of a folder, but there is no guarantee on the order these calls will resolve in. Occasionally, we are seeing the first call to the original folder come in second, and the new folder appears to be populated with images already. Cache Failover and Shared options Sometimes the Redis server is not available because there could be timeouts for example. What do you serve when Redis is down, and it's part of your system. Do you serve something or just wait and try again? You could say that if the cache fails then go to the database and return something from there. But at the same time, it can also be dangerous because you could expose yourself to put your site down. If you expect not to do a lot of database stuff because you have a caching layer, you can put your site down. The DefaultDynamicCacheService uses the IMemoryCache to at least prevent something if Redis is down. For example, cache the id of a requested document locally so that the memory cache is used during the FailoverRetryLatency, which is a configuration value that has a 30 seconds value by default. News from the community Dixin's Blog is running on Orchard Core If you navigate to https://weblogs.asp.net/dixin, you will find a blog that contains several interesting posts about .NET, Windows, and many more. The site is using Orchard Core, and as you may notice, it's very fast, no matter how much content it has on it. Lombiq Gulp Extensions with Stylelint Our Gulp Extensions project now also provides Sass SCSS linting with Stylelint! To use it in your Gulp JS SCSS build pipeline, just configure the corresponding SCSS targets Gulp task. Read more about how you can do that here! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 232 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 week's Orchard meeting!

Orchard Core 1.1 release, Dynamic style Content Field - This week in Orchard (28/10/2021)

We are thrilled to announce that Orchard Core 1.1 is now available! Check out this post to know everything about the latest release of Orchard Core and see a demo about a great third-party Orchard Core module that provides a dynamic styling content field for Orchard Core! Let's get started! Orchard Core updates Add Media background checkerboard pattern for transparent images Let's say that you have a site set up with the Blog recipe and you want to change the Banner Image of the predefined blog post. It's a possible scenario that you upload a PNG or a GIF file that has transparency. But the transparency of the selected image couldn't be easily seen because the admin theme has no support to show that the given image has a transparent background. To fix this issue, now you will have a background checkerboard to easily see the transparent parts of the image, that works in dark mode too. Here you can see that we uploaded and selected an Orchard Core logo that has a transparent background. Add Total support for Lucene API queries The change is just to return whatever the query object is returned from the query API, and it might contain more than what the interface exposes, which is just the items. For instance, Lucene can return the number, the total items. SQL won't do that because that's too costly. Demos Dynamic style Content Field The ThisNetWorks.OrchardCore.Styles module provides a dynamic styling Content Field for Orchard Core. The repository contains a sample project which includes custom configurations for the CKEditor toolbar. In this demo, we will clone the mentioned repository and run the solution inside. Set up your site using the Styles sample recipe that allows you to set up your site with additional pre-configured options, features, and settings out of the box. First of all, let's navigate to Design -> Style Schemas. A style schema defines how the Styles field will be edited, and which components will be available. Open up the one called H2 Color. As you can see here, we defined a component schema. At its most basic a schema entry must contain a reference to a Vuejs component and the description of how to render its entry as CSS. The renderer can be either a renderer name, e.g., "renderer": "CssSizeEntry" or a LiquidJS template for more complex schemas. Here the template says that set the color of the h2 tags to the #8bc34a hex value. Before moving forward, let's check out the content definition of the Style Guide content type that comes from the Styles sample recipe as well (Content -> Content Definition -> Content Types -> Style Guide). As you may notice, this content type has three Style fields attached. Now let's focus on the one with the display name Heading 2. Every Style field can have a selected style schema (H2 Color in this case), or you can select the Custom schema option from the drop-down to say I don't want to use a given style schema, I would like to define the schema here for this Style field. Now check out the predefined Style Guide content item. As you can see here, we have an h2 tag with the heading 2 text. And because we attached the H2 Color style schema with the Heading 2 Style field, when we render the content of this content item, the color of the text inside the h2 tag will be using the #8bc34a hex value. You can find other style schemas on the site, like the Css Variables one. Here you can see a range of CSS vars for the site. The BorderRadius adds rounded corners to the given elements. Here you can see we defined the value of the radius using rem. If you scroll back to the Style Guide content item, you will see that here we defined a my-sites-button class with a border value. The border-radius: var(--border-radius); means to use the defined BorderRadius value from a style schema. And here, you can see the usage of other variables from the style schemas like the button-background-color-hex, where you can easily say button-background-color-rgb as well if you defined the rgb value too. Here button is the name of the component, background-color is the name of the schema with a predefined hex and rgb colors. Now, if you open up the Style Guide content item, you will see something like this. Here you can see the color of heading 2, the border-radius of the buttons, and every other style that we defined using style schemas and attached them to our content type by using content fields. If you check out the README.md file of the repository, you will find nice, detailed documentation about the properties that you can use inside the schemas. And as always, you can find a recording about this module on YouTube to see this feature in action! News from the community Orchard Core 1.1 Orchard Core 1.1 is released! If you open up nuget.org and search for the OrchardCore.Application.Cms.Targets package, you will find the newest released version of Orchard Core! Upgrade your solution to 1.1 now! Feel free to drop on the dedicated Gitter chat or use the Discussions on GitHub and ask questions! Reusable tests in Lombiq UI Testing Toolbox The Lombiq UI Testing Toolbox is a web UI testing toolbox mostly for Orchard Core applications. Everything you need to do UI testing with Selenium for an Orchard app is here. UI Testing here is an automation that clicks through the web application in a browser. One of the most popular frameworks for that is Selenium, which does exactly that. You get an API to instruct a browser, and every major browser is supported. This UI Testing Toolbox provides a lot of features on top of Selenium for Orchard Core. Basically allowing you to UI test an Orchard Core application in a safe and parallelized way providing a lot of helpers, a lot of higher-level APIs allowing you to test your application with SQLite, with SQL Server with local media storage, or with Azure Blob Storage. And you can have a test e-mail sent with a local SMTP server too. Everything just works. Check out the highlights of the Readme.md file of this repository to see all of the features! We had a demo about the UI Testing Toolbox a few weeks ago. If you haven't seen it yet, check out this This week in Orchard post! And the UI Testing Toolbox just got something very useful: Reusable tests to check that basic Orchard Core features work, like login, registration, and content management. Make sure your Orchard app's basics work! Check out the sample here! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 231 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 week's Orchard meeting!

Fixing rendering of helper and block tag helper, Bynder for Orchard Core - This week in Orchard (21/10/2021)

Fixing rendering of helper and block tag helper, documentation for the Feature Profiles, OpenID improvements, and demo about a module that integrates Bynder for Orchard Core! Don't forget to check out our current post to know more! Orchard Core updates Documentation for Feature Profiles Last week we had a demo about the new Feature Profiles feature. If you haven't seen the demo video about that feature or you haven't read about it yet, you should check out our previous post! In the meantime, the Tenants page of the Orchard Core documentation has a new section that describes everything you need to know to use the Feature Profiles feature. Fixing rendering of helper and block tag helper We had an issue in Orchard Core when using Tag Helpers in Liquid. You can write a tag like a block that will implicitly invoke ASP.NET Tag Helpers and try to map the provided name and properties to the given Tag Helper. In this case, we say to invoke the anchor Tag Helper and with the provided action, class, and route_todoid properties. Here you can see a nice example in the OrchardCore.Demo module to see how you can call an ASP.NET Tag Helper using Liquid. OpenID Recipes: use step model instead of the view model, support update Orchard Core got several updates related to the OpenID feature. The changes in this addition are: Add unit tests for OpenID scopes. Add unit tests for OpenID apps. Replace OpenIdScopeStepViewModel with OpenIdScopeStepModel in recipe. Replace CreateOpenIdApplicationViewModel with OpenIdApplicationStepModel in recipe. Adjust OpenIdScopeStep to support update. Adjust OpenIdApplicationStep to support update. Adjust OpenIdApplicationStep to include importing scopes, which were not imported before. If you check out the code of the OpenIdApplicationStep, (which is a recipe step that adds an OpenID Connect app), you will see that now it's using a new OpenIdApplicationStepModel instead of the CreateOpenIdApplicationViewModel to serialize the data coming from a recipe file. Refactor IQueryResult usage This addition contains several changes: Moving LuceneQueryResults to OrchardCore.Lucene.Abstractions. Moving SqlQueryResult to OrchardCore.Data.Abstractions. Adding OrchardCore.Queries.Abstractions to both these projects to use the IQueryResults interface. This means now, if you would like to use the LuceneQueryResults in your solution, you will find that class in the OrchardCore.Lucene.Abstractions project, under the OrchardCore.Lucene namespace. The old LuceneQueryResults class is marked as obsolete to do not break your code when you will update your solution to the upcoming Orchard Core 1.1. Demos Bynder for Orchard Core This demo is about an Orchard Core module for integrating with the digital asset management platform Bynder. Foremost, it provides the Bynder Field content field that can be added to content parts so Bynder resources can be browsed and attached. But what is Bynder? Bynder’s digital asset management platform enables teams to collaborate in the cloud, get content to market faster, and maximize the impact of marketing assets. It's pretty much a media gallery for bigger companies or for governments used mostly by marketing people. You can upload images and else into Bynder and then everybody from marking will access and use them when publishing materials. If you are interested, you can easily create your 30-day trial here. This module adds a media picker field for Bynder into the Orchard admin. Let's see it in action! In this demo, we will go with a quicker way and use our Open-Source Orchard Core Extensions full Orchard Core solution. We just clone the repository of the Bynder module too and add it to this solution. You have to do one thing before using the module. You need to configure your Bynder Portal's URL to be used in all Bynder Fields via the BynderOptions see its definition. It means that you need to add the PortalUrl to the appsettings.json file. Now, let's set up a site using the Blog recipe. After, we need to enable the module. To do that, head to Configuration -> Features and find the one called CSM.Bynder. Let's say that we want to extend the content definition of the Blog Post by adding the Bynder Field to it (Content -> Content Definition -> Content Types -> Blog Post -> Add Field). Now we have the Bynder Field added to the Blog Post content type, let's see what will happen if we would like to edit the predefined blog post! You will find a new button called Browse Bynder. And if you click on that button, you have the ability to browse some images. Here you can see the dialog provided by the Bynder SDK where you can see all of the assets under the specific collection of the given company. The field is currently configured for allowing multiple of these pictures so we will be able to select more than one. And that's not all of it! If you would like to know more about this module developed by Lombiq Technologies, just head to YouTube for a recording! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 229 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 week's Orchard meeting!

Add UsersFolder for media assets, Liquid IntelliSense for Monaco editor - This week in Orchard (18/08/2021)

Updating Monaco editor to have Liquid IntelliSense, new UsersFolder for media assets, a brand new Orchard Core website, and many more in our upcoming post! Orchard Core updates Add UsersFolder for media assets Open up the admin UI of Orchard Core and head to Content -> Media Library. Here you will find a folder called _Users. Under this folder, you can find three different ones where each folder has the name by an ID of a given user. The reason for that is, we have three users in the system right now who have access to manage the content of the media folder and the content of their own media folder. If you check the permissions page for one of the roles you will see some new permissions come from the OrchardCore.Media feature: Manage All Media Folders Manage Media For Others Manage Own Media These permissions allow administrator users to be able to manage the content of other user's media folders but can restrict others to manage just their folders. Users with the Editor role can only see and manage their own media folder. Note that this is just about managing media assets not hiding the files of the folder. Every user can see the image served under the https://localhost:44300/media/_Users/4dsckq969tr2czhkskgg9nw3mj/image.jpg but they cannot delete this file and cannot modify the content of the 4dsckq969tr2czhkskgg9nw3mj folder. On the left window, the administrator user can see all of the folders, but on the right window, an editor user can only see their folder. If you don't like the naming _Users for the folder under AssetsPath, you can easily use another name for that just by using the appsettings.json file to configure media. If you navigate to Configuration -> Media -> Media Options you will find the name for the Assets user folder as well. Liquid IntelliSense for Monaco editor We have several custom Liquid filters and tags in Orchard Core and when you would like to use these from the admin UI of Orchard Core, (like editing a template or an Html Field using the Monaco editor) that would be nice to have some help with the registered filters and tags. This feature is about adding IntelliSense for Liquid in the Monaco editor. Let's see how we can try it out! Here we have a site installed with the Agency recipe. That recipe contains a Content__LandingPage template for the Landing Page content type by default. If we start to type the {% shape %} expression, we will see a list that contains all the registered filters with the word shape in it. Flow alignment icon always render as left aligned Let's say we have a content type with a Flow Part attached. If you are using Flow Part, you have the option to put several widgets to it. You can also set the alignments of the widgets and the width of the widgets meaning you can put two widgets near each other and you can say that I want to put this widget on the left side of the row and fill the 66% of the row with it and I want to put this widget on the right side of the row and fill the 33% of the row with it. You can do that using a nice UI but there was a minor bug which was about the little icon of the editor wasn't reflect the alignment of the given widget. You can see that now the icon here shows that the second Html widget inside the Container widget is right-aligned. News from the community A new website using Orchard Core: City of Santa Monica Santa Monica is a beachside city of 8.3 square miles on the westside of Los Angeles County. Offering an environment of unparalleled natural beauty, the city is home to a mix of residential communities, commercial districts, and recreational venues. And now the website of the City of Santa Monica is here, built by using Orchard Core! Check out this brand new, amazing-looking Orchard Core site here! If you are interested in more websites using Orchard and Orchard Core, don't forget to visit Show Orchard. Show Orchard is a website for showing representative Orchard CMS (and now Orchard Core) websites all around the internet. It was started by Ryan Drew Burnett, but since he doesn't work with Orchard anymore, as announced earlier it is now maintained by our team at Lombiq Technologies. DotNest Core DotNest Core is a complete redevelopment of the DotNest platform, all on the latest version of Orchard Core. We've been running it with a couple of select few customers for a while now, and it's time to open it up a bit more. While you can't yet just simply create an Orchard Core-based DotNest site, you can sign up for our limited beta here. You'll soon be able to get a fully functional, reliably hosted Orchard Core site on DotNest where you can build your personal website or something to showcase your Orchard skills with. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 216 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!

Extension method for site setting deployments, optimize AddTokenToPath - This week in Orchard (11/08/2021)

The development of Orchard Core of course has been continued after the release of 1.0. Are you curious about the newest improvements of Orchard Core? Well, let's check them out! Orchard Core updates Optimize AddTokenToPath The community tries to make Orchard Core as optimized and as fast as it could be. C# and ASP.NET Core with other third-party libraries offer several tricks and techniques to achieve this goal. For example, you can use ZString instead of StringBuilder. ZString is a library that provides StringBuilder and StringWriter with zero allocation, meaning it's allocating an array on the stack for small buffers, instead of creating new StringBuilders and StringWriters every time. All ZString methods only allocate the final string. Also, ZString has enabled to access the inner buffer, so if the output target has stringless API, you can achieve completely zero allocation. Or another improvement could be to not use string.Split that causing array allocation, use sub-strings instead. Add extension method for site setting deployments Whenever you would like to add a deployment step that allows exporting your custom site settings, you need to register three services with the transient, scoped, and singleton lifetimes. It's not a huge issue though because you can easily open a Startup.cs file of a module that contains these kinds of registrations and see how you can do it in your module but having an extension method for site setting deployments could reduce the lines that you need to copy every time. The new AddSiteSettingsPropertyDeploymentStep allows you to register your custom site settings deployments just in one line! Check out the Startup.cs files of any module to see the new way of registering your site setting deployments. Not use a current culture when checking invalid Autoroute path If you enable the Localization module and set a default culture to a non en-US culture, e.g. th-TH, you will get a validation error when trying to save a content item with an Autoroute part. Here is the screenshot when trying to save a content item and a default culture is th-TH. This issue is from AutoroutePartExtensions.ValidatePathFieldValue method. Inside the method, there is a call of autoroute.Path?.IndexOf("//") which returns 0 instead of -1 when a current culture is th-TH. According to the MS document, IndexOf(String) searches a word by using culture and case sensitivity. Refer to Recommendations for string usage, we should use StringComparison.Ordinal or StringComparison.OrdinalIgnoreCase for the non-linguistic string search. There is no case in a space and //, so the fix here was to pick StringComparison.Ordinal and to match IndexOf which is case-sensitive. Cypress 8.2.0 and Trumbowyg 2.25.1 If you are a huge Orchard Core enthusiast and like to check out the recent changes of the CMS from time to time, you may notice that the community upgrades the different .NET/Client-side/Test libraries from time to time. The Orchard Core documentation has a Libraries page under the Resources one where you can see the versions of these libraries that are used across the main branch of Orchard Core. Antoine Griffard recently updated Cypress to 8.2.0 and Trumbowyg to 2.25.1! With these updates, you can make sure that if you would like to use the built-in libraries of Orchard Core you will always have the latest versions! News from the community Lombiq Technologies: new developer colleagues and new group photo We had a great company trip last week where almost all of the colleagues of Lombiq gathered together to spend the whole day together offline. This was a great opportunity to update our group photo on our official website, so head to the About us page where you can see the most, but not all of our team as of the summer of 2021. And we also have two new colleagues to introduce: Ádám Jakab and Szabolcs Deme. Don't forget to check out their bio too! DotNest Core DotNest Core is a complete redevelopment of the DotNest platform, all on the latest version of Orchard Core. We've been running it with a couple of select few customers for a while now, and it's time to open it up a bit more. While you can't yet just simply create an Orchard Core-based DotNest site, you can sign up for our limited beta here. You'll soon be able to get a fully functional, reliably hosted Orchard Core site on DotNest where you can build your personal website or something to showcase your Orchard skills with. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 215 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!

Source Browser, Content Request Culture Provider cookie setting - This week in Orchard (12/07/2021)

Fixing forms multi submit, set the cookie in the Content Request Culture Provider, Source Browser with Orchard Core, and many more coming this week! Orchard Core updates Set the cookie in the ContentRequestCultureProvider The ContentRequestCultureProvider allows you to switch the current culture based on the content item URL. If you have a site in French and English and you go on a page that contains a French content item, then the full request will go in French. This is what the RequestCultureProvider does, it assigns the current thread culture to the one that a content item is taken. The issue is the following. Assume you have a drop-down French and English to switch languages. Like you are, for instance, on the home page for English. And in the drop-down, you select French using the content picker. In this case, your whole navigation is back in French. Everything you will click should be in French now; the widgets, the content items, everything. But if you go to a page that is in English, the cookie is still for French, which means the next page that will open will assume you still want to be in French. This new option lets you switch the cookie to the culture of the content item you are watching. That means if you go to a content item with a different culture, your cookie will say: 'Oh, I want to be in this culture now, I don't want to be in the one that the drop-down selected before!'. By default, the ContentCulturePicker sets a cookie for the CookieRequestCultureProvider. This can be disabled in the Configuration -> Settings -> Localization -> Content Culture Picker settings page. The ContentRequestCultureProvider can set the cookie based on the ContentItem that matches the current URL. This setting can be edited in the Configuration -> Settings -> Localization -> Content Request Culture Provider settings page. Minor security issue: Internal File Path Disclosure An issue has been raised that the Media module can potentially expose internal file paths, letting a would-be attacker find out what OS the server is using and gaining knowledge about the file structure being used by the web application. If you open up the AdminController and check out the HttpPost version of the Upload action, you would see the following lines in the code that prints the path of the given file. The media file stores are supposed to catch all exceptions and rethrow them as a FileStoreException. The issue was the result contains the path, while it shouldn't. This issue has been fixed by now. Fix forms multi submit The idea here is that if you add the no-multisubmit class, then you can't submit a form twice. So when you double click, there won't be two POST requests, just a single one. And the issues that it triggered were like locking issues or concurrency issues like two content items use the same version and then two published versions. This is preventing issues like this. And you had to change every single form to prevent that. Document Static File Provider Feature and robots.txt for Tenants There is a Static File Provider feature that allows you to have custom static files served for each tenant differently. And in this case, whatever file you put under the App_Data\Sites\[Tenant]\wwwroot will be served in priority over the module's static files or the theme's static files. This way you can customize, for instance, a CSS for a tenant by putting it in this folder. If all tenants use the same theme, you can customize CSS or JavaScript by putting the files there. If you would like to read more about this, check out this updated page of the documentation. Demos Source Browser Source browser website generator that powers https://referencesource.microsoft.com, http://sourceroslyn.io, https://source.dot.net, and others. Create and host your own static HTML website to browse your C#/VB/MSBuild/TypeScript source code. Note that it does require an ASP.NET Core website for hosting (symbol index is kept server-side), so without ASP.NET Core the search function doesn't work. Dean Marcussen decided to build one for Orchard Core. And you can now browse the source code of Orchard Core using Source Browser. You can find the source code in the dm/orchardcore branch of this repository. If you would like to see a nice demo and discussion about this feature, don't forget to check out the following recording on YouTube! News from the community Lombiq Helpful Libraries: Contents Libraries The Lombiq Helpful Libraries consist of several various libraries that can be handy when developing for Orchard Core CMS, to be used from your own Orchard modules. This time we will see some helpful constants and extensions regarding contents. The CommonContentDisplayTypes static class contains values that can be used with IContentItemDisplayManager.BuildDisplayAsync or OrchardRazorHelperExtensions.DisplayAsync to safely select the correct display type. Here we have a BuildDisplayAsync method that loads the content item if the display type is not SummaryAdmin. As you can see, we could use the SummaryAdmin constant string here. The PublicationStatus enum can be used for instance to query content items based on the status of the content item. The WithContentItem extension method also uses these enums to filters a query to match the publication status in ContentItemIndex. You can see we have a query.WithContentItem(PublicationStatus.Published) call that will extend the given query with the ContentItemIndex index and use the given status of the content item. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 207 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 week's Orchard meeting!

Media search indexing, code analysis - This week in Orchard (14/06/2021)

Improving the code quality of Orchard Core by code analysis, supporting multiple translation providers, and adding a media search indexing feature to Orchard Core! Check out our post now for more! Orchard Core updates Code analysis Software is critical in all aspects of our lives. From entertainment, shopping, and dating to business-critical systems and software where human lives are at stake. And yet, security bugs are all too frequent, mainly because the process of finding vulnerabilities is manual, tedious, and repetitive, and because the expertise is not shared with other security researchers or with developers. LGTM seeks to address this situation. If you open up that site and enter Orchard Core to the search box on the top, you will see the active alerts for this repository. So, this site will go on GitHub and analyze the source of the projects. It's like a static analyzer for the code that finds potential issues, like this variable is never used, or here you are throwing an exception where you should not, and so on. We can also filter by language to see the alerts related to the C# code of the repository. Based on these issues, some fixes have been made to the source code. For example, we could remove some unused variables to make the code cleaner. Do you know that our Lombiq .NET Analyzers repository contains .NET code analyzers and code convention settings for Lombiq projects? We use these to enforce common standards across all our .NET projects, including e.g. in all of our open-source Orchard Core extensions. If you contribute to our open-source projects while using that solution, you'll be guided by these rules too. If you are interested in how to add these analyzers to your solution too, check out This week in Orchard post, but if you prefer videos, you can find a short presentation about how to use those on YouTube! Support multiple translation providers The localization manager should be able to handle multiple instances of ITranslationProvider. This feature is about supporting multiple translation providers. This way, we can create more methods for storing translations, like filesystem plus database. Right now, we have only one ITranslationProvider implementation in Orchard Core, the PoFilesTranslationProvider. This provider is part of the Localization module, which module provides the infrastructure necessary to support the PO (Portable Object) localization file format. As you can see, the LocalizationManager now injects a list of available ITranslationProvider implementations and calls the LoadTranslations method of every provider to load the translations to the CultureDictionary. Recipes Dropdown focus during setup Let's say you want to set up your Orchard Core site, or you just want to add a new tenant to it. When you move the focus from site name to recipe combo box and press Arrow Down the recipe list pops up. But when you commit your choice via Enter, focus resets to the first item on the page. Not it's fixed. It's a nice to have feature because there are people who prefer using the keyboard to navigate on the site instead of using the mouse. Serve module compile view for package reference If a module is referenced as a NuGet package e.g., OrchardCore.Application.Cms.Targets and if the NuGet package includes precompiled Views.dll, in development views are not served from the Views.dll, instead, it re-compiles all embedded cshtml resulted in a slow start in development. This code is to just ensure that it doesn't try to recompile if it finds the correct DLLs. Demos Media search indexing The idea here was to allow to search for content in files. This demo shows a feature that provides a simple implementation to index media for search. More precisely, it indexes media files related to content items, so said content items will turn up in search when one of their media files matches the search query. The following data can be indexed for each file referenced from a Media Field: Media Text The textual content of PDF files To index the textual content of the PDF files, the pull request uses the PdfPig library, which allows users to read and extract text and other content from PDF files. In addition, the library can be used to create simple PDF documents containing text and geometrical shapes. First of all, let's set up your site using the Blog recipe. This recipe constructs the Blog Post content type that has a Media Field called Banner Image. Let's say we would like to search by using the media text of the Banner Image field. To allow that, open the settings of the Banner Image (Content -> Content Definition -> Content Types -> Blog Post -> Banner Image) and put a tick in the Include this element in the index checkbox. After that, you have to do some configuration for the search fields. If you navigate to Search -> Settings -> Search, you can find the comma-separated list of fields to use for search pages. You can see the Content.ContentItem.FullText value there by default. Here we need to add the BlogPost.Image one. BlogPost is the technical name of the content type (and in this case of the content part too) and Image is the technical name of the Banner Image Media Field. Let's try out this feature quickly! Let's say we just want to edit the predefined blog post with the title Man must explore, and this is exploration at its greatest. Select the browsed image of the Banner Image field and add a media text to it. Now let's navigate to the predefined search form (https://yoursite.com/search) and try to search for the Astronaut word. This is the one that we have just added as the media text to our blog post. Astronaut is not a word that would actually show up anywhere in the body. As you can see, our blog post has just appeared as a result of the search. If you attach a PDF file to the Banner Image media field and try to search for a word or a phrase that is inside the PDF file, the query will return that content item too. This feature is still under development by Zoltán Lehóczky from Lombiq and as we mentioned you can find the PR containing the code here. If you would like to know more about it, don't forget to check out the following recording on YouTube! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 203 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 week's Orchard meeting!

Admin Dashboard Widgets, GitHub Issue Templates - This week in Orchard (24/01/2021)

This week we will see the new issue templates in GitHub, the new View Media Options permission, and have a demo about a nice upcoming feature called Admin Dashboard Widgets! Check out our current post for more! Orchard Core updates Adding documentation for Resources Libraries If you navigate to the OrchardCore.Resources project and open the ResourceManifest.cs file there you can see the list of the resources used by Orchard Core by default. That means if you would like to use jQuery for example in your site, you don't have to add this resource again from your theme or module because Orchard Core already has it. The goal of this table in the documentation is to collect all the used libraries with their versions. New View Media Options permission You can use the appsettings.json file to configure different media options like the supported sizes, allowed file extensions, and so on. But if you don't remember the exact values off the top of your head you had to open the appsettings.json file to check out the configuration values. To solve this issue, you can just easily navigate to Configuration -> Media -> Media Options that means you just need the admin UI of Orchard Core to see the values. And now you will find new permission called View Media Options that can be used to control who can be able to view the content of this site. GitHub Issue Templates If you found a bug while using Orchard Core or you just have a suggestion or an idea to make the CMS better, feel free to add a new issue on the GitHub page of Orchard Core. All you have to do is to select the Issues tab and click on the New issue button. This will navigate you to a new page where you can select what kind of issue you would like to submit. You can see three different kinds of options here: Bug report, Feature request, and Discussions. If you select the Discussions one, you can start a new discussion. GitHub Discussions is a collaborative communication forum for the community around an open-source project. Community members can ask and answer questions, share updates, have open-ended conversations, and follow along on decisions affecting the community's way of working. Check out the existing discussions related to Orchard Core here! But if you found a bug or have a new feature request, select from the first two options. If you do that, you will be redirected to these pages. Here you can add your issue by using nice issue templates that help us to investigate the given bug, like how can we reproduce your issue. Or if you have a feature request, the template could help us to understand better what is the problem that can be solved by adding this new feature to the system. Feel free to try out and use them when submitting new issues! Refactor media tokens This is about replacing the used Data Protection to encrypt tokens, as the encrypted token changed every server restart (because of course encryption should never produce the same value twice, for a given input). This caused the browser and/or CDN to refresh all the images every time the server is restarted/deployed. The is-cache wasn't affected by this, just the browser/CDN caches. Demos Admin Dashboard Widgets A few weeks ago we wrote about an upcoming new feature called Admin Dashboard that allows you to add cards to the homepage of the dashboard, which is about to represent a piece of functionality of a given feature or module. This feature is still under development and it has changed in the meantime a lot, so it's time to check out the newest improvements! First of all, go to Configuration -> Features and enable the Admin Dashboard feature. If you do that, you will see the following screen when you navigate back to the homepage of your dashboard. You can see one predefined card here with the title Orchard Core, and at the bottom of the card, you can see an Edit and a Delete button. Let's click on the Edit one! As you can see this is an Html Dashboard Widget content type with a Title Part and a HtmlBody Part attached. But under that, you can see a textbox called Position. By using that setting you can control the order of your widgets on the dashboard. We have just this one, so whatever you type here, this will be rendered as the first widget. If you click on the Add Widget button on the dashboard, you can create as many other Html Dashboard Widgets as you want. But now let's look under the hood and see how you can create custom dashboard widgets! Navigate to Content -> Content Definition -> Content Types and create a new type, call it Markdown Dashboard Widget. Add the Title Part, the Markdown Body Part, and the Dashboard Part to it. The Dashboard Part is the one, that you will need to attach to every content type that you would like to mark as a dashboard widget. By using that part you can set the Position of your widget. And the final thing you have to do is to set the stereotype of your content type to DashboardWidget. Now let's get back to the dashboard of the admin UI and select the Markdown Dashboard Widget after clicking on the Add Widget button. As you can see, if we set the position to 1, it will be rendered after the predefined one with the title Orchard Core. If we modify the value of the position, we can change the ordering of the widgets. But that's not all! Head to YouTube now to see a video about this upcoming new feature! News from the community Execute an Orchard Core shape into HTML sample in the Lombiq Training Demo for Orchard Core The Lombiq Training Demo for Orchard Core is a demo Orchard Core CMS 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 includes the full source code - which is the recommended way. You can also use it as part of a solution that uses Orchard Core NuGet packages, however, it's harder to look under the hood of Orchard Core features. And now the module just got a new sample about how to execute an Orchard Core shape into HTML! Check it out now if you're learning Orchard and you haven't seen this feature yet! Work with us! You've completed the Dojo Course, congratulations! You’re now officially an Orchard Core developer. Would you like to work on a variety of challenging Orchard Core projects with the biggest Orchard team in the world? Work with us! Just send us an e-mail to crew at lombiq.com. Please include what you’re most interested in professionally and attach around 100 lines of any kind of code that you’re especially proud of or just link to the favorite open-source project of your own on GitHub or else. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 185 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 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 week's Orchard meeting!