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 >

Users with permission can disable Two-Factor Authentication, Orchard Nuggets: How to add an audit trail to an ASP.NET Core app - This week in Orchard (15/11/2024)

New NamedRecipeStepHandler base class and users with permission can disable Two-Factor Authentication are the topics for this week. Don't forget to check out our newest Orchard Nuggets post about how to add an audit trail to an ASP.NET Core app! Let's see the details!

Dynamic index tables, allow any user to manage two-factor authentication - This week in Orchard (28/06/2024)

Allow any user to manage two-factor authentication, show recipe error instead of throwing an exception, and a demo about Dynamic index tables are the topics for the week. You can still apply to speak at Harvest 2024 and share your insights on Orchard Core's future, CMS roles, AI tools, cloud integrations, and more! Let's see the details! Orchard Core updates Allow any user to manage two-factor authentication Two-factor authentication (2FA) is now available for all users. Previously, only users with permission to access the admin area could set up their 2FA methods, although all users could still use 2FA if it was set up by an admin. To enable this change, the method IsRequiredAsync() in both the ITwoFactorAuthenticationHandlerCoordinator and ITwoFactorAuthenticationHandler interfaces has been updated to IsRequiredAsync(IUser user). Summary of changes The feature OrchardCore.Users.EmailConfirmation was removed. This feature was recently added and was enabled by dependency only. Its services have been moved up to the OrchardCore.Users feature since it is a core functional and needed by OrchardCore.Users. Using the 2FA email method now requires email confirmation using the existing email confirmation process. As mentioned, the method IsRequiredAsync() in both the ITwoFactorAuthenticationHandlerCoordinator and ITwoFactorAuthenticationHandler was changed to IsRequiredAsync(IUser user). OK, so, what does it look like in action? First of all, you have to make sure that you have at least one two-factor authentication method enabled. To do that, you have to navigate to Configuration -> Features and enable the regarding features. We enabled two modules: Two-Factor Authenticator App Method: Provides users with a two-factor authentication method through any Authentication App. Two-Factor Email Method: Provides users with a two-factor authentication method through an Email service. Orchard Core provides a third two-factor authentication method through an SMS service but these two will be enough for demonstration. After that, we need to have a user without any special roles. We created a user under Security -> Users, where we used John as the user's name. Make sure that this user is enabled to be able to log in as John. The last thing we have to do is to make sure that the Default Theme is the current site theme because that theme renders the navbar by default and includes the dropdown with the Security-related settings. And as you can see in the screen below, we logged in as John. If you click Security on the dropdown menu that we mentioned earlier, you may notice that John can enable the two-factor authentication by adding one of the below two-factor methods. The SMS is not here, because we have only enabled the App Method and the Email Method features. Show recipe error instead of throwing an exception Currently, when importing a recipe and something goes throw, implementations of IRecipeStepHandler or IRecipeEventHandler will throw exceptions to report errors if something fails to import. In a production environment, the user gets a white page, which leaves them lost on what had happened. This is no longer the recommended approach for error reporting. Now, to handle errors, we have introduced a new property named Errors in the RecipeExecutionContext. This property allows you to log errors instead of throwing exceptions. These errors should be localized and must not contain any sensitive data, as they are visible to the end user. Exceptions are still used for logging additional information, but these are not shown to the end user. Additionally, if an error occurs, a new custom exception, RecipeExecutionException, is thrown. Let's say you want to import a deployment package or import JSON from text. Assume that the JSON contains some errors in both cases. Here, you can see that Orchard Core shows the error to the user so they have feedback instead of dumping an exception or a white page. And the same applies if you want to execute a recipe that contains errors. Demos Dynamic Index Tables When using YesSql index tables, you have to build these index tables using code. This solution provides you with a way to build index tables without the need to write code. Using the admin UI, you can select the content type you want to index and you can add the table columns using a nice UI. You can also use a script to execute to build the column value mapping. Here, you can return how you wanted to be your content item indexed. In the screen below, you can see the index table for the content type called Comic Book. In the Map Script editor, we defined what we should need to return when retrieving the values inside the DisplayText, IssueVolumeNumber, and ReleaseDate columns. After that, if you do a SELECT * query for this index table, you may notice that the table contains the columns defined in the previous step. And it's just the top of everything this feature offers. If you are curious about the details, check out this demo video on YouTube for more! News from the community Orchard Harvest 2024 date and location Get ready to power up your Orchard skills at Orchard Harvest Conference 2024! Join us on September 12th-13th at the Orleans Hotel and Casino in lively Las Vegas for two days packed with learning, coding, and community fun. What can you expect at Orchard Harvest Conference 2024? Hands-On Workshops: Elevate your coding game with interactive sessions led by industry experts. Insider Insights: Learn best practices, advanced techniques, and real-world insights from qualified developers. Global Connections: Connect with fellow enthusiasts, exchange ideas, and forge meaningful relationships within the Orchard community. Special Perks: Participants get exclusive discounts on accommodations at the Orleans Hotel and Casino. Can't wait until September? Check out recordings from last year's special online Orchard Harvest on our YouTube channel here. Ready to be a part of something extraordinary? Reserve your spot today and take advantage of early-bird pricing at Orchard Harvest Conference 2024. We also opened the registration form for the speakers: https://forms.office.com/e/fewh7hh20d This year's leading themes: Leading up to a v3.0, what will the future Orchard Core look like? What's the role of a CMS nowadays (with the decoupled/headless operating models, and AI development tools) Explore some advanced topics such as Shapes, Placements, Cloud Integrations, Performance, module extensibility, etc. Showcases on implementing Orchard Core in action. We've extended the sign-up period by another 2 weeks, so if you haven't signed up yet, you can still sign up now! Apply to be a speaker until the 29th of June, midnight Anywhere on Earth! We'll notify you whether your talk is selected for Harvest in 1 or 2 weeks after the application period. The chosen speakers will receive complimentary tickets for the event. Want to support our mission? Become a sponsor! Reach out to us at [email protected] or [email protected] to explore sponsorship opportunities. Secure your spot today and get ready to level up your skills at Orchard Harvest Conference 2024! See you there! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 473 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!

Support comments in recipes, multitenant decoupled Blazor InteractiveServer example - This week in Orchard (05/04/2024)

Support comments in recipes, support Create and CreateAsync in DataMigrationManager, and a demo about a Multitenant Decoupled Blazor InteractiveServer Example! Let's see the details! Orchard Core updates Support comments in recipes The recipe reader doesn't support comments in JSON (it's a mode that isn't turned on). This can be annoying when you have a lot of recipes and need to make notes in them as to why you did something. It's because System.Text.Json by default doesn't support comments. We parse using JOptions.Document that is not configured to allow comments. From now on, the settings of the JOptions have been changed to allow comments in recipes. Support Create and CreateAsync in DataMigrationManager You could run into a problem with data migrations: your migrations may not proceed after a module's initialization. The reason for that could be a change of synchronous code to asynchronous. It can happen because you may forget to add the Async suffix in the CreateAsync method. That could be OK, but there is inconsistency in the behavior of UpdateFromX(Async) and Create(Async). Updates work correctly no matter what suffix but Create does not. Now, this behavior has been unified; both Create and CreateAsync methods are now supported. Demos Multitenant Decoupled Blazor InteractiveServer Example In this demo, you can see how to use Orchard Core in a decoupled scenario. There's also a discussion under a GitHub PR to add a Blazor guide for decoupled CMS. Sijmen Koffeman decided to follow this guide and make this a multi-tenant application because that would be very interesting to do in his current situation where he maintains a line of business applications that they provide to several tenants. He took the example from the guide and made it further, and that works so far. In his demo, you can do a deep dive into the code that sits inside the Orchard Core Multitenant Decoupled Blazor InteractiveServer Example repository to see the current state of this work. Head to YouTube for a recording to know more! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 472 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!

Lucene index rebuild and reset steps, Lombiq GitHub Actions - This week in Orchard (21/10/2022)

Lucene index rebuild and reset steps, update all action bars, utilize ContentTypeExtensions, and a demo about the Lombiq GitHub Actions project! Do we need to tell more about the content of our current post? Let's jump into the recent news of Orchard Core! Orchard Core updates Lucene index rebuild and reset steps Currently, when we are creating a search index from a recipe it doesn't build the index. This causes issues with Lucene and Elasticsearch where the Queries won't return any results, and also Elasticsearch will log an issue about "all shards failed" if nothing has been indexed yet in its indexes. It would be nice to be able to trigger an index to be rebuilt or reset from a scheduled background task as a one-time-only task. And from now on, you will find two new recipe steps that will help you with that: The Reset Lucene Search Index Step resets a Lucene index. The Rebuild Lucene Search Index Step rebuilds a Lucene index. You can find more information about how you can use these new recipe steps in the Orchard Core documentation. Update all action bars We have some improvements regarding the action bars on the admin UI of Orchard Core. As you can see on the screen below, there was a lot of wasted space between the search box and the New button. There was an extra round space between the filter icon and the search box and we also had uneven spaces, as you can see. The other thing is when using a mobile phone to manage contents (or any view with an action bar), the search input on the top shows up very small because of the wasted space between the search box and the New button. And here you can see the updated action bar. You can see that all of the mentioned issues are resolved like the search box is now longer, and we have equal spaces. Utilize ContentTypeExtensions We have had a static class called ContentTypeExtensions for a while now in the source, which contains several useful extensions. Like shortcuts to tell that the given content type is creatable, versionable, has stereotypes, and so on. Here the goal was to use the newly added extensions ContentTypeExtensions across the solution. Demos Lombiq GitHub Actions The Lombiq GitHub Actions project contains extensions that make a lot of things very easy in an Orchard Core or an Orchard Core-based project. If you don't know GitHub Actions or aren't entirely clear with the terminology, GitHub actions are GitHub's automation platform or CI/CD platform. Orchard Core of course also uses it to run various builds. And how you define a pipeline there is by creating workflows and/or composite actions. Workflows are what actually run, and actions are something that you can add on your own as well, these are things that workflows can call. Workflow is kind of like a program, and action is like a library that your program calls into. And of course, actions can be third-party as well. The point here is that you can use GitHub actions to automate a lot of things, like .NET builds, running tests, and doing various verifications on a pull request, and you can also do all kinds of modularization between these builds. And what we have under this project are workflows and actions. Workflows that you can call from your own workflows. Pretty much like one-liners, for example, to run the .NET build and execute a test. Actions are the building blocks that you can also use if you just want to have something specific. And we have quite a lot of actions and workflows here. Let's check out the workflow called Build and Test Orchard Core solution workflow! Here you can see how you use it. The example above is not even a minimal usage actually, it can be even shorter. This can be your GitHub Actions workflow in your own repository with an Orchard Core application, where you execute the workflow that we provide here. This is actually used in Orchard Core Commerce as well. If you check out the build-and-test.yml file inside the repository, you will find all the code that is necessary to run such builds. If you check out the details of a pull request inside the Commerce repository, you will see there are builds for Ubuntu and Windows as well. These are all the automated checks that we run. This is quite a long build because it's not just a .NET build, it also runs all kinds of static code analysis. It verifies that .NET packages are consolidated, and it also runs unit and UI tests with SQL Server and Azure Storage actually. And the Lombiq GitHub Actions projects contain a lot more than that! Are you interested in the details of what you can achieve if you use this project in yours too? If your answer is yes, or you want to know more about this automation platform check out this recording on YouTube for more! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 365 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 around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Leverage CSPROJ meta information, Lombiq Helpful Libraries - Navigation for Orchard Core - This week in Orchard (29/04/2022)

Adding an AppSetting option to disable SQLite connection pooling, leveraging your CSPROJ meta information and news and updates around the Lombiq Helpful Libraries! Check out our current post to read about the details! Orchard Core updates Remove Lucene from built-in recipes This is about making the built-in setup recipes lightweight: Lucene is a feature that you don't need on every site, especially due to it storing files on the local file system that need to be preserved (i.e., not temp files) it needs special considerations for hosting (you need to take care of those files when moving the app between environments and doing deployments). The goal here is to not enable Lucene by default in the following recipes: Headless: just remove it. Blank: just remove it. Blog: Create an SQL RecentBlogPosts Query and don't enable Lucene by default. Have a separate, non-setup recipe to set up the search just for a frontend search page (i.e., 90% of what happens related to Lucene in the recipe now). Have a second non-setup recipe that runs the previous one and also swaps out RecentBlogPosts with a Lucene Query. And from now you can find two new optional recipes in the TheBlogTheme: Lucene Query Recipe: this recipe runs the Blog Lucene Search recipe and as an example, the recipe replaces the RecentBlogPosts SQL query with a Lucene query. Lucene Search Recipe: this recipe enables the Lucene feature and creates the Search setting, Lucene indices, and permissions. The Recipes and Starter Themes page of the Orchard Core documentation has also been updated to reflect these changes. Leverage CSPROJ meta information Out of the box, a Manifest.cs file is generated, which includes the ModuleAttribute, FeatureAttribute, ThemeAttribute, and so forth, that describe the Orchard Core meta-information about your projects. However, let's say you want to connect available meta properties at the CSPROJ level, i.e., such properties as $(MSBuildProjectName), $(AssemblyVersion), $(PackageTags), to name a few. At its core, you may want to follow a pattern similar to InternalsVisibleTo, i.e. <ItemGroup> <AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo"> <_Parameter1>Test.$(MSBuildProjectName)</_Parameter1> </AssemblyAttribute></ItemGroup> The principles are the same, but in prior versions, the attribute constructors were not available to lean into. Michael W Powell also decided to provide helpful MSBuild Items as a more accessible, self-documenting shorthand input. From now, you can connect available meta properties at the CSPROJ level by leveraging CSPROJ meta information. If you are interested in how to leverage Orchard Core CSPROJ item lists and properties to enrich and get the absolute most from your authoring experience, this is the page you should take a look at! News from the community Lombiq Helpful Libraries - Navigation for Orchard Core The Lombiq Helpful Libraries contains various useful libraries that can be handy when developing for .NET, ASP.NET Core, and Orchard Core, to be used for your own projects. This time we would like to show you two helpful abstract classes: the NavigationProviderBase and the MainMenuNavigationProviderBase. NavigationProviderBase: an abstract base class for creating reducing boilerplate in INavigationProvider for checking the name parameter and if the user is authenticated. MainMenuNavigationProviderBase: an abstract base class derived from NavigationProviderBase for creating a home page menu structure using the main navigation name. If you use the Lombiq.BaseTheme automatically displays the generated menu as a widget in the Navigation zone. There is a Lombiq.HelpfulLibraries.Samples project for various examples in the form of an Orchard Core module. And that project contains a class called HelpfulLibrariesNavigationProvider. This class inherits the MainMenuNavigationProviderBase, which overrides the NavigationName with the "main" value. And if you check out the sample code here, you can see some other interesting stuff, like how we set up where to navigate users when they click on the given menu items. .ActionTask<LinqToDbSamplesController>(context, controller => controller.SimpleQuery())) In this case, we say that let's navigate the user to the SimpleQuery action of the LinqToDbSamplesController. And of course, you have the option to provide additional arguments as well if you check out the NavigationItemBuilderExtensions static class. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 247 subscribers! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Hide the "New" option if they are not authorized to edit, UI testing PoC with the Lombiq UI Testing Toolbox - This week in Orchard (04/03/2022)

This week you can read about hiding the "New" option from the admin UI if they are not authorized to edit, changing the content of the built-in recipes, and a demo about a UI testing PoC with the Lombiq UI Testing Toolbox! Are you interested in the details? Check out this post for more! Orchard Core updates Hide the "New" option if they are not authorized to edit If you have a list content type (e.g., Blog) with the contained type (Blog Post) and the user doesn't have Edit Blog Post permission, they still see the New Blog Post button on the Blog editor. Note, that the user has permission to edit the Blog. And it was a bug that could be reproduced by just following some simple steps: Create a Blog Post content type. Create a Blog content type with a ListPart containing the Blog Post type. Update the Moderator role: set Edit for Blog but don't set it to Blog Post. Create a test user and associate them with the Moderator role. Log in with the test user and create a Blog. Observe that the New Blog Post button appears on the top-right corner, but you'll get a 403 when you click on it. The solution was just to similarly to the Content list page authorize the user to edit the types so if they are not authorized to edit, then hide the New option. Remove FileContentDefinition from recipes Last December, the community decided to do not to enable the File Content Definition feature by default. And by doing that, the OrchardCore.Contents.FileContentDefinition usage was removed from the Agency and Blog recipes. It's only useful in specific cases, and most of the time you need to turn it off. The same issue is there with the Headless and Blank recipes. Especially for the Blank recipe, there is no reason to include anything apart from the bare bones. The solution was just to remove the OrchardCore.Contents.FileContentDefinition enables a step from the two recipes. Demos UI testing PoC with the Lombiq UI Testing Toolbox In this demo, we will talk about this particular pull request, which is about a proof of concept. 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, and some weeks ago, you could read about the automated monkey testing feature of the toolbox. So, what about trying out this toolbox in Orchard itself, and let's see whether it works and whether it can be useful. Of course, we have Cypress tests in Orchard Core, so this will be something with the same goal - not necessarily useful, not necessarily wanted to add - it's a proof of concept. Let's see how it looks! If you check out the mentioned pull request, you will find a new OrchardCore.Tests.UI project which references the UI Testing Toolbox. It contains a couple of classes, the main point here is the BasicOrchardFeaturesTests one. As you can see, this contains two xUnit test methods. The first is just running the TestBasicOrchardFeaturesExceptRegistrationAsync method, which tests all the basic Orchard features except for registration with the Blog recipe. You can specify the recipe itself with several other options like enabling accessibility checks. The second test is a failing test that you can check out on the CI. It's a usual Dotnet test execution, so you get a test summary in the end. You can see what the test did, and you can find the exact reason why this test failed (because it's cannot find the element by the navbar ID on a given page). If you go to Summary and check out Artifacts, you can download a file that contains the whole dump of the application with screenshots, HTML output, the Orchard logs, everything that you may need for troubleshooting. And, of course, you can also execute the test from Visual Studio as usual. The next steps here would be to: Recreate the Cypress tests so we can see how it compares. Most possibly, this would be running TestBasicOrchardFeaturesExceptRegistrationAsync with all recipes. Using WebApplicationFactory directly instead of running the tested app with the Dotnet CLI would be useful. What's behind TestBasicOrchardFeaturesExceptRegistrationAsync would potentially need to be copied to be serious here, since if something changes in Orchard deliberately, it can fail. If you would like to know more about this PoC, head to YouTube for a recording! News from the community War in Ukraine and Lombiq War in Ukraine and Lombiq: How does it affect us at Lombiq and what we're doing to help: https://lombiq.com/blog/war-in-ukraine-and-lombiq Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 238 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!

JSON Recipe Deployment Step, Tenant Feature Profiles - This week in Orchard (14/10/2021)

A new extension method to encode redirect URLs, documentation for the image Shortcode, a new JSON Recipe deployment step, and a nice demo about the Tenant Feature Profiles feature! Don't forget to check out our current post to know more! Orchard Core updates JSON Recipe Deployment Step The only way before being able to execute a custom JSON recipe step was to create a file with the recipe inside and execute the recipe. Now it's much easier, you can just paste JSON, and then you have the Monaco IntelliSense inside the editor. To try this out, set up your site using any recipe and make sure you have the Deployment feature enabled (Configuration -> Features). Now head to Configuration -> Import/Export -> Deployment Plans and add a new deployment plan. Hit the Add Step button to add a new step to it and find the one called JSON Recipe that exports a JSON Recipe. Here we would like to disable the OrchardCore.Templates feature when someone imports this deployment package. If you execute your deployment plan, you will see that the recipe contains one step with the JSON content that we have just provided in the JSON Recipe deployment plan. Document Encode redirect URLs If you publish a content item (a blog post for example) with a permalink that contains non-English characters, the redirect goes to a URL where the non-English characters are encoded. Like /Admin/Contents/ContentItems/Ελληνας-ϰαὶ-δὴ-ϰαὶ-γράμματα and of course we are getting a page not found message. The fix was for that to encode the redirect URLs. It has been merged but after a while, it had to be changed because the EscapeUriString method has been deprecated in .NET 6. and it was not building anymore. It was removed because it was not used correctly by users, and it was apparently buggy. The solution is there is a new custom method in Orchard Core called EscapeLocationHeader because it's a custom escape for the location headers. It's using GetComponents with custom parameters to do that. The idea is that anytime you do a redirect, the server will not accept custom characters because it contains non escaped characters, and it needs to be escaped. But not all of them need to be escaped, just the query strings, the parts that are not like slashes and equals. So, if you are using the this.LocalRedirect(returnUrl, true) or the this.Redirect(returnUrl, true) extension methods, it will use the EscapeLocationHeader method to correctly escape the URL. Demos Tenant Feature Profiles We had a demo a few weeks ago about a feature that is about through app settings/configuration adds the ability to restrict the features and/or themes that are available to either a tenant and/or all tenants or a mix of both. This time we will see the final, merged version of this feature that you can check out any time if you clone the main branch of Orchard Core! First of all, set up your site and enable the Tenants and the Tenant Feature Profiles features, which provides a way to manage available features for each tenant. Now head to the new option under Configuration called Tenant Feature Profiles where you can add feature profiles. Here you can set the rules that you want to use. By default, you can have an Include and an Exclude rule. By using these you can easily say that I don't want to allow the given feature for the assigned tenants or I want to allow my custom feature to the given tenants. The Expression contains the name of the feature but it can include stars like OrchardCore.*Templates that will match the OrchardCore.Templates, OrchardCore.AdminTemplates and OrchardCore.ShortCodes.Templates feature as well. Let's say that we don't want to allow the TheAgencyTheme and the features with names to start with OrchardCore. and end with .Templates. Now let's create a tenant with these rules. To do that, navigate to Configuration -> Tenants and hit the Add Tenant button. The first thing that you may notice here is the new Feature Profile dropdown where you can optionally specify which feature profile should be applied to this tenant (as you can read the hint). We have one, called restricted profile, let's select that one. And it's time to set up our tenant to see what are the available features there. If you search for the text templates, you will see that the search returned no results. If you navigate to Design -> Themes and try to find the TheAgency theme, you will see that the theme is not there in the list. Note that the Tenant Feature Profiles feature is only available for the default tenant naturally. And that's not all of that! If you would like to see more, don't forget to check out this recording on YouTube! News from the community .NET Community Standup - What's new in Orchard Core The .NET Community Standups are weekly live shows, hosted by the .NET team, are casual sessions full of community content, demos, Q&A, and discussions around what's happening in .NET. Last week you could see Sébastien Ros showing you the latest improvements and features of Orchard Core. If you are new to Orchard Core or you if are a developer who hasn't worked with Orchard Core in a long time or just wants to see a nice overview about what Orchard Core can provides you with version 1.0, head to YouTube now for the recording! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 228 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!

Include or exclude tenant features and/or themes, allow editing Time Field seconds and milliseconds - This week in Orchard (07/09/2021)

Allow to edit Time Field seconds and milliseconds, document dependency version selection in ResourceManagementOptionsConfiguration class, demo about a feature to include or exclude tenant features and/or themes, and many more coming this week! Check out our post for more! Orchard Core updates Document dependency version selection in ResourceManagementOptionsConfiguration class Let's say that in the theme layout, you want to enforce Bootstrap 4.6 and added this <script asp-name="bootstrap" version="4" at="Foot"></script> which includes Bootstrap 4 as desired. Now let's have a custom module that allows converting a select-menu to a searchable-menu. This module depends on Bootstrap and jQuery to be able to function. So in the ResourceManagementOptionsConfiguration class, we need to define the dependencies like this: _manifest.DefineScript("SearchableDropdown") .SetUrl("~/SearchableDropdowns/bootstrap-select.min.js", "~/SearchableDropdowns/bootstrap-select.js") .SetDependencies("jquery", "bootstrap") .SetVersion("1.0.0"); _manifest.DefineStyle("SearchableDropdown") .SetUrl("~/SearchableDropdowns/bootstrap-select.min.css", "~/SearchableDropdowns/bootstrap-select.css") .SetDependencies("bootstrap") .SetVersion("1.0.0"); Unfortunately, the SetDependencies("bootstrap") call here forces to include Bootstrap 5, which will cause Bootstrap 4 and 5 to be included! Obviously, this is a problem. But you can easily solve this problem. You can use the SetDependencies method to ensure the script or style is loaded after their dependency, where you can set a specific version of your choice or the latest version available. Check out this new section in the Orchard Core documentation where we used SetDependencies("bootstrap:4") to say that we would like to define a style that depends on Bootstrap version 4. Allow editing Time Field seconds and milliseconds Let's take a quick look at the improvements of the Time Field. In our example, we have set up our Orchard Core site using the Blog recipe and modified the content definition of the Blog Post content type by adding a new Time Field to it. When you navigate to the settings of the Time Field, you will see a new setting here, called Step. This is just about manipulating the value of the step attribute of the time input type. You can read a lot about the step attribute here, now we just want to show you a small example of how you can use this new option. Let's say we want to allow to be able to edit the seconds for the Time Field too, but not the milliseconds. If we type 15 for the Step here, users can choose from the following values when setting the seconds: 0, 15, 30, and 45. It means, setting the value of this field to 03:39:15 PM would be suitable. If the user would like to create a new blog post and enter an invalid value for the Time Field, they would see the following message by showing some suggestions about the nearest valid values. Do not enable OrchardCore.Feeds by default in standard recipes By default by enabling the OrcardCore.Feeds module your lists will have feeds capabilities but for the Blank and the Agency recipe. This doesn't make any sense because we don't have any lists defined by default in these recipes. The change here is the Blank and the Agency recipes now will not enable the Feeds module by default. Demos Include or exclude tenant features and/or themes This upcoming feature is about through app settings/configuration adds the ability to restrict the features and/or themes that are available to either a tenant and/or all tenants or a mix of both. If you checkout to the deanmarcussen/excludefeatures branch, you will see a new OrchardCore_Features section in the appsettings.json file where you can see rules that you can apply to the various features. The idea here is that you can have the rule to either exclude or include a given expression based on the feature name. By default, the OrchardCore.Templates feature and the TheAgencyTheme are excluded for all tenants, but the default tenant has an include rule with a "*" expression which means that tenant gets everything. Now let's see this in practice! Let's set up a site using the Software as a Service recipe to get the Tenants feature enabled by default. If you navigate to Configuration -> Features on the admin UI, you will see that the Templates feature is available with the TheAgencyTheme as well (Design -> Themes). But if you have a tenant called blog1 and search for templates on the Features page, you will only find the Shortcode Templates one because the Templates feature is excluded for this tenant. And the same will apply if you navigate to Design -> Themes and try to find The Agency Theme. A nice additional feature would be to have a UI, where you can specify what kind of features and/or themes would like to exclude or include for the given tenant. But we are just scratching the surface of this upcoming feature. If you would like to know more, don't forget to head to YouTube for a recording to learn more! News from the community Helping the City of Santa Monica with Orchard Core consulting A few weeks ago we mentioned a new website using Orchard Core: the site of the City of Santa Monica, which you can find on Show Orchard as well! 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. 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 we actually had a small part in this by helping the creation of this site with some Orchard Core consulting. If you would like to know more, check out the case study on our site here. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 224 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!