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 >

Redis connection across tenants, Data Migrations UI feature - This week in Orchard (05/05/2023)

Redis connection across Tenants, simplify email body, and a demo about the Data Migrations UI Feature! Check out our post for the details! Orchard Core updates Redis Connection across Tenants The number of Redis connections scales with the number of tenants. This leads to a large number of Redis connections being required when you have a large number of loaded tenants, even if individual tenants may not have a lot of actual activity. The problem is that when you use something like Azure Redis, you will quickly run into cost issues to allow for enough connections to exist even though Redis is barely being used (CPU/memory usage is very low). If we were able to share the Redis connection pool across all tenants, then scaling would be correlated with the actual usage of the system as opposed to tenant count. From now on, the connection creation was refactored, such that each tenant doesn't have its own connection but you can share the connection to the same Redis instances across tenants. The connection string is the same, and you can use different prefixes for the tenants. The CreateAsync method in the RedisDatabaseFactory class is responsible for returning only one connection, even if there are multiple accesses to the same connection string. Simplify email body Nowadays, when you are trying to create an email message, you should set either Body or BodyText, not only that you also need to set up another property: IsBodyHtml or IsBodyText. This needs simplification to make the setup easier. Furthermore, if someone set IsBodyText to true while they set the Body property, the email will be sent as plain text. So, instead of having two properties to set whether the email body contains HTML formatted text or not, there is a single one, called IsHtmlBody. So, there are no more BodyText and Body properties to set the body of your email. You can simply use the Body one and decide whether the body contains HTML or not based on the IsHtmlBody Boolean property. The IsBodyText and IsBodyHtml properties are also marked as obsolete. Demos Data Migrations UI Feature A few weeks ago, we showed you a conceptabout improving the data migrations in Orchard Core. This time we will check out a new feature, called Data Migrations UI, which allows us to manage the data migrations from the user interface. If you navigate to Configuration -> Features and enable the Data Migrations UI feature, you will find a new option in the root of the admin menu, called Data Migrations. This feature scans and discovers all the migrations from the enabled features and shows them in this list. Here, you can see that we have one migration in the Google Maps feature, which is already migrated. If you click on the Rollback button, you can roll back the given migration. The Migrate button of course runs the given migration. As you can see, the Gravatar feature contains multiple migrations. Migration1 is already applied, Migration2 should be skipped, and there are two migrations that are not applied. If you click on the Migrate button, you can apply the given migration. And as always, if you want to know more about this feature, check out this recording on YouTube! News from the community Orchard Harvest Online As many of you know, we have been working hard over the past months to organize the next Orchard Harvest in Las Vegas after the last Harvest in 2017. Unfortunately, based on the current economic situation and personal feedback, Las Vegas won’t work this year. Not to mention that unfortunately Microsoft Build, announced after we decided on our dates, also falls in line with the original dates we chose. So, a date change was also necessary. However, we did not want to let go of this opportunity to meet completely. Therefore, we are pleased to inform you that we will be holding our first online Orchard Harvest starting on the 31st of May at 13:00 UTC. You can start your registration for the event right now. Of course, we are still looking for speakers. You can apply to present by 12 May at the following link: https://forms.office.com/e/pfiExtEUuZ. Check out the details on the official site of Orchard Core! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 457 subscribers! We have started this newsletter to inform the community around Orchard of 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 would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Orchard Core goes to Oxford, fake video capture source in Lombiq UI Testing Toolbox - This week in Orchard (28/04/2023)

Fix background task description is no longer editable, add validation type for Validation Summary Part, demo about fake video capture source in Lombiq UI Testing Toolbox, and announce that Orchard Core goes to Oxford! Check out our post for the details! Orchard Core updates Fix background task description is no longer editable There was an issue with the Description of the background tasks were not editable. If you navigate to the admin UI of Orchard Core and head to Configuration -> Features and enable the Background Tasks feature, you can manage your background tasks under Configuration -> Tasks -> Background Tasks. The Orchard Core solution contains a module called OrchardCore.Demo. If you add it as a project reference to the OrchardCore.Application.Cms.Core.Targets project, you can utilize this module, which contains a test background task. The Lombiq Training Demo for the Orchard Core module also contains a sample of how you can implement your own background task. Add Validation type for Validation Summary Part In the Validation Summary widget, it is useful to be able to specify the type of summary we want to show. By default, we can show all errors. However, in some cases, we may only want to show a model-level error instead of all. This improvement is about simply adding an option that would allow the user to determine the type of summary to add to the form. By default, it would be all errors. To utilize this feature, you must enable the Forms feature, which provides widgets to implement forms. Now, if you edit a content item with the Flow Part attached (for example, the Page content item coming from the Blog recipe), you can build a simple form. We added a Form widget to this Page with some other widgets, and of course, with the updated Validation Summary widget. As you can see, now there is a Show Model Only Error checkbox, which you can use to decide to only display model-level errors or all errors. Demos Fake video capture source in Lombiq UI Testing Toolbox Maybe you have already heard about the Lombiq UI Testing Toolbox, our web UI testing toolbox mostly for Orchard Core applications. Everything you need to do UI testing with Selenium for an Orchard app is here. We wrote about it several times here as well, first when we open-sourced it, when we added some Orchard Core Features tests to it, when we added the automated monkey testing feature to it, or when we introduced the Visual verification testing. At the end of last year, we showed you the latest updates about integrating UI testing into Orchard Core and the way how you can use WebApplicationFactory. This time, we will check out a slightly different topic! Imagine you have an application that uses video sources to access visual information from the user or the environment using Media Capture and Streams API. The goal can be QR or bar code scanning, user identification, or other computer vision applications. To make sure that future changes to the code do not break anything, we need a way to automate testing. Here, the fake video capture source comes into play. If you check out the documentation, you can see that you can use y4m or mjpeg video files as a fake video capture source in the Chrome browser. In the demo, you can see a virtual business card service where the front end is built by Vue.js, and the back end is of course Orchard Core. If you show a QR code for the application, the back end gives you back a content item, which is a Business Card. This sample can be found in the Lombiq Vue.js module for Orchard Core under the Samples folder. Both of these modules are included in Lombiq's Open-Source Orchard Core Extensions solution, so we will open this solution and find the BehaviorVueTests class where you can find two tests, called QrCardScanShouldWorkAsync and QrCardScanShouldReportNotFoundAsync. The ConfigureFakeVideoSourceForPositiveTest and ConfigureFakeVideoSourceForNegativeTest extension methods are responsible to retrieve mjpeg files, which are embedded resources that we can utilize for these tests. If you run the QrCardScanShouldWorkAsync test, you will see that the test retrieves the information from the QR code and displays the card's content based on the card ID, which can be found in the QR code. And as always, if you want to know more about this new addition to the Lombiq UI Testing Toolbox for Orchard Core, check out this recording on YouTube! News from the community Orchard Core goes to Oxford Zoltán Lehóczky will give an Orchard Core intro at .NET Oxford on the 16th of May. .NET Oxford is an Oxford-based .NET meetup/user group. It'll be online, so you can join from anywhere if you're just learning about Orchard! Check it out here! Orchard Harvest Online As many of you know, we have been working hard over the past months to organize the next Orchard Harvest in Las Vegas after the last Harvest in 2017. Unfortunately, based on the current economic situation and personal feedback, Las Vegas won’t work this year. Not to mention that unfortunately Microsoft Build, announced after we decided on our dates, also falls in line with the original dates we chose. So, a date change was also necessary. However, we did not want to let go of this opportunity to meet completely. Therefore, we are pleased to inform you that we will be holding our first online Orchard Harvest starting on the 31st of May at 13:00 UTC. You can start your registration for the event right now. Of course, we are still looking for speakers. You can apply to present by 12 May at the following link: https://forms.office.com/e/pfiExtEUuZ. Jump into the following GitHub discussion for the details! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 446 subscribers! We have started this newsletter to inform the community around Orchard of 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 would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Orchard Core 1.6.0, Data Migrations Poc - This week in Orchard (21/04/2023)

We are thrilled to announce that Orchard Core 1.6.0 is now available! Check out this post to know everything about the latest release of Orchard Core! Now let's see the newest features and editions of the current release, check out the announcement about the first online Orchard Harvest, and watch a demo about a Data Migrations PoC! Orchard Core updates Document Ticket Store The Users Authentication Ticket Store stores users' authentication tickets on the server in the memory cache instead of cookies. If distributed cache feature is enabled it will store authentication tickets on the distributed cache. There were no page in the Orchard Core documentation about the User Ticket store, so now you can find some lines about it. Add support for built-in and custom Elasticsearch analyzers Orchard Core only has support for standard analyzers, which is good in most cases. But we do not allow for implementing custom analyzers or the use of built-in analyzers. This feature is about adding support for the built-in analyzers and updating the documentation of the Elasticsearch module, where you can see some examples of how to use the built-in stop and standard analyzers and define custom analyzers using the appsettings.json file. Demos Data Migrations Poc This demo shows you a concept about improving the data migrations in Orchard Core. All the data migrations are hosted in a single class, called Migrations, which is easy for simple migration but hard for big migration. Meaning the readability and maintainability could be improved. If you check the Migrations.cs file in the OrchardCore.Users module, you can see it may be hard to read and follow. Another issue could be that we are relying on reflection. The naming convention comes from Orchard 1.x, where we are using numbers at the end of each method to specify the current version of the given migration. Both IDataMigration and DataMigration are hosted on OrchardCore.Data.YesSql assemblies and it could be an improvement to move the IDataMigration and DataMigration into the OrchardCore.Data assembly. Hisham Bin Ateya did a prototype by splitting the migrations into multiple files. It will be easy to read, and easy to maintain, and there is no reflection anymore. Both IMigration and Migration are hosted on OrchardCoreContrib.Data assemblies and YesSqlMigration in the OrchardCoreContrib.Data.YesSql assembly. You can clean up everything by roll-backing the applied migrations. For this demo, we will clone the following GitHub repository, which contains a set of modules for Orchard Core CMS that is driven by community members who love Orchard Core. This will encourage all the passionate developers to build modules that aren't included in Orchard Core. Such modules may be necessary for the community or essential for any sort of CMS. If you open up the CreateGoogleMapPart migration of the GoogleMaps module, you will find a Migration attribute where you can specify the version and override the Up and Down methods. By default, you put your code into the Up method, so it will be applied when the migration is run, and the Down method is responsible for "reverting" the changes made by this migration in the Up method. And we are just scratching the surface here. If you would like to know more about the implementation details, don't forget to check out this recording on YouTube! News from the community Orchard Core 1.6.0 Orchard Core 1.6.0 is now available! If you open up nuget.org and search for the OrchardCore.Application.Cms.Targets package, you will find the updated version of Orchard Core! There is a new page in the documentation with the breaking changes. Upgrade your solution to 1.6.0 now! Feel free to drop by the dedicated Gitter chat and ask questions or use GitHub Discussions! Orchard Harvest Online As many of you know, we have been working hard over the past months to organize the next Orchard Harvest in Las Vegas after the last Harvest in 2017. Unfortunately, based on the current economic situation and personal feedback, Las Vegas won’t work this year. Not to mention that unfortunately Microsoft Build, announced after we decided on our dates, also falls in line with the original dates we chose. So, a date change was also necessary. However, we did not want to let go of this opportunity to meet completely. Therefore, we are pleased to inform you that we will be holding our first online Orchard Harvest starting on the 31st of May at 13:00 UTC. You can start your registration for the event right now. Of course, we are still looking for speakers. You can apply to present by 12 May at the following link: https://forms.office.com/e/pfiExtEUuZ. Jump into the following GitHub discussion for the details! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 442 subscribers! We have started this newsletter to inform the community around Orchard of 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 would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Add AlterAsync for a named part, Transliteration Feature - This week in Orchard (14/04/2023)

Add AlterAsync for a named part, updating documentation to use Program.cs instead of Startup.cs, and a demo about the Transliteration Feature! Check out our post for the details! Orchard Core updates Updating documentation to use Program.cs instead of Startup.cs Within .NET 6, Startup.cs has been sunsetted. In the new world, it is still possible to use a Startup.cs, however, it is not a mandatory class anymore. This means when upgrading, you do not need to do anything if you wish so. However, if you want your code to use some of the latest framework features, you will need to perform some refactoring by munging the two files together. And now, the documentation for Orchard Core has been updated with new code samples to show you how to register Orchard CMS service in your Program.cs file when creating a new ASP.NET Core Web Application using Visual Studio. Add AlterAsync for a named part There is an Alter extension method in Orchard Core that you can use to modify a new or existing content element by name. But the awaitable AlterAsync was missing from ContentExtensions. Now you will find an AlterAsync extension method that supports named parts like Alter. Demos Transliteration Feature Transliteration helps us to pronounce words in another language whereas translation gives us the meaning of words. Transliteration changes the words from one language or alphabet into another corresponding, with similar-sounding letters with different characters. So, for this demo, we will clone the following GitHub repository, which contains a set of modules for Orchard Core CMS that is driven by community members who love Orchard Core. This will encourage all the passionate developers to build modules that aren't included in Orchard Core. Such modules may be necessary for the community or essential for any sort of CMS. The module that enables transliteration using the default implementation of the ITransliterationService service is called the Transliteration feature. If you run this solution and enter the admin site using the admin username and admin@OCC123 password, you can navigate to Configuration -> Features. Search for the "transliteration" word to enable the Transliteration feature. Now you can inject the ITransliterationService, then use Transliterate() method to transliterate from one script to another. Here you can see we injected the ITransliterationService and passed the script and the text itself which we wanted to transliterate. There is a DefaultTransliterateRuleProvider that supports converting Cyrillic and Arabic letters to Latin. Meaning that in our example, we wanted to convert a Cyrillic text to Latin. Let's run the solution and check out the content of this page! And as you can see, we wrote "Welcome to Orchard Core" and "Feel free to browse the menu and discover all its possibilities" two times here. For the first time, we used Latin letters, and for the second time, we used Cyrillic letters. And by using the TransliterationService, the Cyrillic letters were converted to Latin. And as always, if you would like to learn more about this module, don't forget to check out this recording on YouTube! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 435 subscribers! We have started this newsletter to inform the community around Orchard of 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 would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Add search handler, Gravatar Module - This week in Orchard (06/04/2023)

Add search handler; fix bad async usage in RecipeHarvester, and a demo about the Gravatar Module! Check out our post for the details! Orchard Core updates Add search handler You may need a way to be able to log search attempts. Like if a search is leading to 0 hits, you want to know about it and report on it. This is something we can easily add by adding a handler that is called after a search is executed. So, this feature is about adding an ISearchHandler which is called from the search controller. This handler has a SearchedAsync method that is triggered after a search is executed. In the following screen, you can see the ISearchHandler interface itself, and the code that invokes its SearchedAsync method. Fix bad async usage in RecipeHarvester The IRecipeReader interface has a GetRecipeDescriptor method, which is now marked as obsolete. Instead of that, you will need to use the new GetRecipeDescriptorAsync in the future. The reason for that is the HarvestRecipesAsync method in the RecipeHarvester was not awaited, and the solution was to have a foreach loop to do an await GetRecipeDescriptorAsync() since it doesn't require thread safety. Demos Gravatar Module Gravatar (globally recognized avatar) is a service for providing globally unique avatars. On Gravatar, users can register an account based on their email address, and upload an image of their choice to be associated with that email address. And the OrchardCoreContrib.Modules repository contains a module that utilizes the Gravatar service! So, for this demo, we will clone the following GitHub repository, which contains a set of modules for Orchard Core CMS that is driven by community members who love Orchard Core. This will encourage all the passionate developers to build modules that aren't included in Orchard Core. Such modules may be necessary for the community or essential for any sort of CMS. The module that enables user avatars using the Gravatar service is called the Gravatar Module. If you run this solution and enter the admin site using the admin username and admin@OCC123 password, you can navigate to Configuration -> Features and search for the "gravatar" word to enable the Gravatar feature. This will mean that now you can utilize the new Gravatar HTML Tag Helper and the gravatar_url Liquid Filter. Let's try them out! To use the new Liquid Filter, we created a new content type with the Liquid Part attached to be able to add some Liquid code to our content item. We created a new content item of this content type and called it Gravatar Liquid Filter Demo. Here we constructed a list that contains the names and email addresses of some of the main Orchard Core contributors. Please note that the reason why we can use these email addresses here is that all of these addresses have an associated Gravatar. The gravatar_url Liquid Filter calls the GetAvatarUrl method of the GravatarService to retrieve the Gravatar image URL. Once we have the URL, we can use it as the src for the img HTML tag. The Gravatar Tag Helper is already utilized by the Gravatar module. If you check out the navigation bar of the admin site, you can see the Gravatar of the currently logged-in user here instead of the default one. That's because the module contains a UserMenu.cshtml file which overrides the given shape. Here we used the email address of the currently logged-in user and also provided a size, which is the width of the rendered image. And as always, if you would like to learn more about this module, don't forget to check out this recording on YouTube! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 434 subscribers! We have started this newsletter to inform the community around Orchard of 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 would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Admin Culture Picker, Health Checks Module - This week in Orchard (31/03/2023)

Add Culture Picker for the Admin Site; a new version of Fluid, and a demo about the Health Checks Module! Check out our post for the details! Orchard Core updates Add Culture Picker for the Admin Site Unless you have a language switcher on website pages you cannot switch a language in the admin panel. This can be solved by having a dropdown in the admin panel header to switch languages. If you head to Configuration -> Features and type "culture", you will see two features: Admin Culture Picker which provides a culture picker shape for the admin area. Content Culture Picker which provides a culture picker shape for the frontend. The first one is the new one, so enable the Admin Culture Picker feature! After you enable this feature, probably nothing will change. But why? Well, that's because if your site only supports one culture, there is no need to display a culture picker to choose from the different cultures. So, let's navigate to Configuration -> Settings -> Localization and have at least two different supported cultures. After that, you will see the new dropdown in the NavbarTop zone of the admin theme which you can use to switch between cultures. Fluid 2.4.0 Fluid is an open-source .NET templating engine that is as close as possible to the Liquid template language. It's a secure template language that is also very accessible to non-programmer audiences. It also contains an ASP.NET Core MVC View Engine. And of course, Orchard Core is using Fluid too to generate templates. Fluid 2.4.0 has been released this month, so let's see some of the changes that this release contains! This release contains the implementation of some missing strftime formats. You can write: var source = "date:"{{Date | date:'%F %T.%3N'}}""; which results date:"2022-12-19 14:23:02. %3N". And as you can see, the %3N does not take effect. So, now all of these formatting parameters are implemented in Fluid meaning you can have more ways to print formatted dates. Like adding support for formats that will depend based on the first day of the week. Or if you ask for the number of weeks of the current day, then it might depend on what is the first day of the week. And there is a standard like Monday but sometimes you say that Sunday is the first day of the week. Another change is to introduce a "local" time zone for the time_zone filter. Meaning if you want to use a time zone that is the local time zone of the configuration (in Orchard it would be configured as the standard time zone), then you can use "local". Because you might get a UTC date and you want to display it with the local time zone. To do that, you can do: {{ now | date | time_zone: 'local' }}. Demos Health Checks Module For this demo, we will clone the following GitHub repository which contains a set of modules for Orchard Core CMS that is driven by the community members who love Orchard Core. This will encourage all the passionate developers to build modules that aren't included in Orchard Core. Such modules may be necessary for the community or essential for any sort of CMS. This repository contains several modules, this time we will check out the one called Health Checks Module, which provides health checks for the website. Orchard Core has a built-in Health Check module, the goal of this one is the extend the functionality of the built-in one. If you run this repository and enter the admin site using the admin username and admin@OCC123 password, you can navigate to Configuration -> Features and enable the Health Checks module. And while we are here, let's also ensure that the SendGrid module is enabled. But why? Because the Health Checks module is capable of checking the status of the SendGrid module. If you navigate to /health/sendgrid, you will see an Unhealthy message. Meaning that the SendGrid module is available and could be used without any issues but you have to configure its settings to make that service available for the users. Try to enable the Multitenancy feature as well and create a new tenant but do not set it up, just create it. After, head to the /health URL and see what it shows. Here you can find the status of SendGrid as before and another one called Tenants Health Check. As you can see, the name of the tenant that we have just created is Blog, but we haven't set it up (just created it), that's why you can see an Unhealthy status here. You can see the System Updates Health Check here as well because we enabled the System Module last week. And as always, if you would like to learn more about this module, don't forget to check out this recording on YouTube! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 434 subscribers! We have started this newsletter to inform the community around Orchard of 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 would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Enhance the Search module and UI, System Module - This week in Orchard (24/03/2023)

Ensure the Background tasks name is visible for old entries, enhance the Search module and UI, and a demo about the System Module! Check out our post for the details! Orchard Core updates Ensure the Background tasks name is visible for old entries In a recent change to the background tasks, a title was added to the background tasks. This works great for entries that have not been saved into the database. However, for entries that are already saved in the database, we do not have a title to show so it leads to no name being displayed on the UI. Since the title is not an editable field, we should always set the title to the default settings when showing tasks on the UI. Enhance the Search module and UI Currently, we have two different SearchController. Each one handles its own search provider, Lucence and Elasticsearch. We should be able to combine these two into one and place it on the Search module since that module's sole purpose is to export a front-end UI for the search. Also, we should add a setting to change the placeholder for the search bar. Additionally, we should have a Search Form widget that would allow the user to add a search widget. So, this update contains the following enhancements: Remove the SearchController from both Elasticsearch and the Lucene module. We now have one common SearchController in the Search module. The new controller now returns a shape instead of a view model which allows the user to override the default views. Adds settings to allow the user to define a title for the search page and also a placeholder text for the search bar. Add a Search widget that a user can add to their site. The default widget will direct the user to the /search route. Allow the user to optionally pass the index name in the route value. For example, /search/index-name the index-name is an optional value, and when it is not provided, the default index is used. Let's see some of the improvements mentioned in action! For this demonstration, we set up our site using the Blog recipe, and to be able to test the enhanced Search module, we have to enable the Search module itself and one search provider, which will be Lucene, for example. Now, we need to create a Lucene index under Search -> Indexing -> Lucene Indices. Here we added the name BlogPosts and included the Blog Post content type to the index. After that, we navigated to Search -> Settings -> Lucene and selected the BlogPosts search index as the default index to use for the search page and put a tick into the "Allow Lucene queries in search form" checkbox. Now we have a simple search set up, let's see the new Search Widget in action! We decided to place this widget on the home page. The predefined Blog content item is the home page in this recipe, so we edited the content definition of the Blog content type by adding a Flow Part to it. By having a Flow Part, we can add the new Search Form widget to the Blog content item. Here we can add some placeholder text if we want and can define the index name. Now it's time to utilize our widget! If we navigate to the home page of our site, we will see our Search Form widget. Let's type something and hit the Search button. As you can see, it lists our test posts which contain the "post" word. And you may notice the index name in the URL too (BlogPosts). If we had multiple indices, we can replace the BlogPosts one with any other existing index and that would mean that we search for something based on the content of that index. Remove .tiff from the supported images array Most modern web browsers, including Google Chrome, Microsoft Edge, Mozilla Firefox, and Opera, do not support the display of TIFF images natively on web pages. This is because TIFF files are typically very large in size and may take a long time to load. If you check out the MediaOrchardHelperExtensions class, you will see that the .tiff is now missing from the _imageExtensions. Demos System Module For this demo, we will clone the following GitHub repository which contains a set of modules for Orchard Core CMS that is driven by the community members who love Orchard Core. This will encourage all the passionate developers to build modules that aren't included in Orchard Core. Such modules may be necessary for the community or essential for any sort of CMS. This repository contains several modules, this time we will check out the one called System Module, which provides information about the currently running application; it can display the available system updates and put your site in maintenance mode while you upgrade. If you run this repository and enter the admin site using the admin username and admin@OCC123 password, you can navigate to Configuration -> Features and search for the "system" word. This will list the following features: System, System Maintenance, and System Updates. Enable them all! Now you will find a new option on the menu called System. Click on the Info under System! This page lists several useful information, like the ASP.NET Core Version, the OS Version, the Tenants, the enabled features, and so on. But you can find another option under System, called Updates. On this page, you can make sure that you are using the latest version of Orchard Core. If you are using the latest one (1.5 currently), you will see a "You're all up to date!" text, meaning there is no newer version of Orchard Core. And the third thing is the Maintenance mode. You can enable this mode by navigating to Configuration -> Settings -> System -> Maintenance and putting a tick into the "Allow maintenance mode" checkbox. If you do that and navigate to the front end of your site, you will see the page which shows you that the site is currently offline for maintenance. And as always, if you would like to learn more about this module, don't forget to check out this recording on YouTube! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 430 subscribers! We have started this newsletter to inform the community around Orchard of 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 would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Add new permission to allow editing content owner, add new GetAsync extension - This week in Orchard (17/03/2023)

Updating Workflows documentation, adding new permission to allow editing content owner, and adding new GetAsync extension. Interested in the details? Well, then check out our post for the details! Orchard Core updates Update Workflows docs Let's say you have a workflow event (implemented EventActivity), and you want to print a property value using Liquid when using a for loop like this: <h4>Here is the responses</h4><ul> {% for item in Workflow.Input["ThresholdSummaries"] %} <li>The response to '{{ item.Title }}' was '{{ item.Respond }}' while threshold is '{{ item.Threshold }}'</li> {% endfor %}</ul> However, the notification replaces {{ item.Title }}, {{ item.Respond }}, and {{ item.Threshold }} by empty string instead of the actual value. The reason for that is from memory, you need to define a Liquid MemberAccessStrategy for this custom type to allow its properties to be accessed. The Orchard Core documentation has been updated to describe how you can trigger a custom event activity and register a member access strategy if you are looking to use Liquid to access the member of a custom object. Add new permission to allow editing content owner Currently, SiteOwner permission is required to be able to see/edit the Common Part info like the owner. Let's say you want to allow a moderator to change the owner of a specific content type. Currently, there is no way to do that without granting moderators SiteOwner which isn't acceptable. From now on, we have EditContentOwner and EditContentOwner_{} permission to control who can edit the owner of a content item when Common Part is attached. Let's see this quickly in action! Here we assume that you set up your site using the Blog recipe. First of all, we have to make sure that we are logged in with a user who has permission "Edit the owner of a content item permission". If you check out the permissions of the Administrator role, you will see that users within this role have this permission by default. Now, we will modify the content definition of the Blog Post content type a little bit, and attach the Common Part to it. We can do it under Content -> Content Definition -> Content Types where we need to hit the Edit button near the Blog Post. After that, we can simply add the Common Part to the Blog Post. Before finalizing editing the content definition, don't forget to edit the Common Part settings and put a tick into the "Display owner editor" checkbox. It's time to see the result of our work! We have one predefined blog post on the site, so we will edit that one. And as you can see, the first textbox here is the one called Owner (we can move this textbox anywhere of course) with the value "admin". That's because the username of our super user is "admin" and we set up the site with this user. And of course, now you can modify the owner user of this content item. But don't forget, here you have to provide the user's name of an existing user. In the following screen, we tried to change the owner to "admin2" but we faced an error because we don't have a user with that user name in our system. Add new GetAsync extension Currently, we have GetAsync(IEnumerable<string> contentItemIds, bool latest = false) and GetAsync(string contentItemId, VersionOptions options) but not GetAsync(IEnumerable<string> contentItemIds, VersionOptions options). When doing a bulk update, it is much more helpful to use GetAsync(IEnumerable<string> contentItemIds, VersionOptions options) than GetAsync(IEnumerable<string> contentItemIds, bool latest = false) if we want to get multiple VersionOptions.DraftRequired, not just the latest. And here you can see the new GetAsync method, which accepts the contentItemIds and the VersionOptions! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 412 subscribers! We have started this newsletter to inform the community around Orchard of 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 about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Tenant APIs improvements, MiniProfiler visibility based on permissions - This week in Orchard (10/03/2023)

The MiniProfiler visibility is now based on permissions, tenant APIs improvements, and using ListContent permission instead of ViewContent to see the content items list. Interested in the details? Well, then check out our post for the details! Orchard Core updates MiniProfiler visibility based on permissions MiniProfiler is a library and UI for profiling your application. By letting you see where your time is spent, which queries are run, and any other custom timings you want to add, MiniProfiler helps you debug issues and optimize performance. And MiniProfiler is a built-in feature in Orchard Core that has some updates. Let's say an admin needs to profile a production instance. Enabling MiniProfiler for everyone to see is not acceptable in most cases. Also, a user may want to profile an ajax request to analyze a query or other info. The solution here is to provide new permissions when you enable the Mini Profiler feature. If you navigate to Security -> Roles and hit Edit near any role, you can see the new permissions which enable you to view the Mini Profiler widget on the back end and the front-end pages. Tenant APIs improvements Orchard Core tenant APIs got several updates lately. First of all, there was no way to update some tenant settings from API calls. Meaning, the tenant's category was missing in the ApiController. We should be able to set a tenant's description via an API call, so this property is now included in the sent model. Another improvement is the new Edit endpoint because there was no way to update tenant settings from API calls. The new Edit endpoint in the Tenant's ApiController takes care of this and enables us to modify the tenant settings either if the tenant is uninitialized or running. The updateable properties are the same as what is displayed on the tenant editor on the Admin UI. Use ListContent permission instead of ViewContent Currently, we use View Content as a minimal permission to list the contents in the content items UI. We use the same permission to also show the Content -> Content Items admin menu. Here the List Content permission should be used, not View Content. What if someone wants to allow a user to view content using a direct link but does not want them to list the contents in the UI? Currently, this isn't possible. Additionally, ViewContent is granted to all Anonymous and Authenticated roles, which is fine. But, access to list contents should be granted by the ListContent permission to avoid allowing listing content without explicit permission grant. If you check out the change logs in the docs of the upcoming release, you can read about the updated permissions. News from the community Hastlayer is now fully open-source Hastlayer is being developed by Lombiq Technologies, a software, training, and services company focusing on web development with open Microsoft technologies. Hastlayer transforms .NET software into FPGA-implemented logic circuits. (FPGAs are chips that can mimic other chips.) The result is code that runs faster and uses less power than a code-only solution without sacrificing the ability of further developing your software. Using Hastlayer will optimize your performance and lower the power consumption of hardware, which will bring you more satisfied customers who want your solution and a boost in your company’s revenue. And we have just recently fully open-sourced Hastlayer! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 410 subscribers! We have started this newsletter to inform the community around Orchard of 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 about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Delivering a Node.js asset pipeline as a NuGet package

How long does it take you to set up a Node.js-based frontend asset pipeline? That lints and compiles your SCSS, JavaScript, Markdown? That makes code style inconsistencies a tale of the past? In .NET? With Lombiq Node.js Extensions, it'll take you under a minute. In this post, we will provide an overview of what we’ve squeezed into Lombiq Node.js Extensions, how we packaged it for NuGet, why we ditched Gulp, and some gems on MSBuild integration. If you want to see a demo of Lombiq Node.js Extensions in action, check out our recent This week in Orchard post. Web Development in 2023 needs Node.js Even in the .NET world, Node.js has become a first-class citizen for all matters frontend. Grunt, Gulp, Babel, Webpack – all Node.js-based tools – have conquered the frontend landscape. Orchard Core uses Gulp to build its modules’ assets. At Lombiq, we used to use Gulp to build our assets. But it's... Time to say goodbye While Gulp provides a great development experience, there are downsides: Gulp wrappers around NPM packages were not always available or up to date. Sometimes, they caused unexpected errors after updates. Lack of support for Node.js 14 and above became an issue. Plain NPM and Node.js scripts can do the same work as a Gulp script. One less moving part in our tooling ecosystem means less friction. Based on experience with our Gulp Extensions project, we've built a tool that eliminates its weaknesses. Building a reusable frontend asset pipeline on top of Node.js Why? - So you can simply plug it into your projects. Like we do! How? - Read on! What? - Here's an excerpt of what Lombiq Node.js Extensions does: lints SCSS, compiles, autoprefixes and minifies it, generating source maps on the way lints JS, minifies it, generates source maps lints Markdown provides sensible defaults for Orchard-based web development, i.e. needs no manual configuration in the default scenario! can copy assets to a webroot folder, like image files and frontend libraries is usable from a NuGet package integrates tightly with MSBuild adds generated assets to the project's assembly allows to keep generated assets excluded from version control uses PNPM to efficiently install packages and execute scripts (if you don't know it, PNPM is a Node.js package manager with a lot of advantage over NPM) The important pieces Let's look at some of the magic sauce that makes all this possible! MSBuild takes care of the build We use our Lombiq NPM MSBuild Targets project to hook the necessary Node.js work into the MSBuild build pipeline. All the asset manipulation happens before a project's Compile target executes. That allows us to generate frontend assets and embed them into the project's assembly as part of the .NET build. There was a challenge here, though: Files that are generated during the build need to be added manually to the EmbeddedResource item group, else they won't be embedded in the DLL. Here's the relevant piece from the AddGeneratedFilesToEmbeddedResourceList target in Lombiq.NodeJs.Extensions.targets: <ItemGroup> <EmbeddedResource Include="@(NodeJsExtensionsTargetFiles)" WithCulture="false" Type="Non-Resx" /> </ItemGroup> Node.js complexities are handled under the hood Setting up Stylelint, ESLint, Markdownlint and other NPM packages can be time-consuming and complex. Lombiq Node.js Extensions has it all set up and configured out of the box! When your project integrates Lombiq Node.js Extensions and you accept the defaults, you are done. Installation and execution of the SCSS and JavaScript pipelines happen automagically. You even get live ESLint support in Visual Studio with our preconfigured settings! And if you need, you are free to extend them. Packing it up with NuGet Configuring NuGet packaging can be tedious, but here's our successful configuration. Most of all, we include all the files that are necessary to later install this project as an NPM package in any consuming project. As the documentation states: A package [can be] a folder containing a program described by a package.json file. Using Lombiq Node.js Extensions from a NuGet package is the simplest way to get started. When using it from a Git submodule, you will need to edit your project file. Outsource your frontend asset pipelines Are you still writing CSS, because you don't want to invest in setting up the necessary tooling to compile SCSS as part of your build? Do you still argue over your JavaScript files' code styling? Is inconsistent Markdown formatting plaguing you? Let Lombiq Node.js Extensions handle all that for you. Get the NuGet package today! Should you need any further help, file an issue or contact us for commercial-grade support.