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

Featured tags

IIS
API
All tags >

Resource Manifest source generator, Orchard Core Pair Programming by Lombiq - This week in Orchard (10/05/2024)

Add extensions to register conditions in the Rules module, add Redis Health Check, demo about the Resource Manifest source generator, and don't forget to join our next Orchard Core Pair Programming session! Let's see the details! Orchard Core updates Add extensions to register conditions in the Rules module Here is a summary of the changes: Added new OrchardCore.Rules.Core project. Added the new AddRule<> extensions in the Core project. Cleaned up the OrchardCore.Rules project by using the new extensions. And it means that now, you can simplify your code by using the newly added extensions to register custom conditions. For example, services.AddRule<HomepageCondition, HomepageConditionEvaluator, HomepageConditionDisplayDriver>(); Add Redis Health Check This new feature provides the Redis health check to report the status of the Redis server if Redis is enabled. The health check endpoint is available at /health/live for each tenant that needs to be checked. More information about health checks in ASP.NET Core can be found here: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/health-checks Demos Resource Manifest source generator If we look at the ResorceManagementOptionsConfiguration today, it has a lot of resources including styles and scripts, and all are hard-coded. The big problem here is the URLs, a lot of times we find bugs for outdated or wrong CDN URLs. Instead of hard-coding all the resources, this PR's goal is to create a JSON file that contains the references for all the scripts and styles. If we go to the ResorceManagementOptionsConfiguration, you can see the usage of the ResourceManifestGenerator, which will get all the data from the resources.json file and add them to the resources directly. So, in a nutshell, just have a JSON file that contains the references for all the scripts and styles, and the ResourceManifestGenerator will get all the data from that resources.json file and add them to the resources directly. And if you are curious about this concept, head to YouTube for a demo! News from the community Theme development with Zig - Orchard Core Pair Programming by Lombiq Last Monday, we had the very first session of Orchard Core Pair Programming by Lombiq! In these, we do an hour of pair programming with an Orchard Core community member about a project of theirs. We learn together a lot, share best practices, and write some good code. All this is live, and you can join us with your questions! This time, Ermir Pellumbi aka Zig joined us with a theme project. If you missed the session, you can find the recording here. And we will have the next session of Orchard Core pair programming next Monday! Ermir Pellumbi (Zig) joins us with a theme project again. We learn a lot, share best practices, and write good code. Your host and the "navigator" of the pair programming session will be Zoltán Lehóczky from Lombiq. All this is live, you can join us too! Check it out here. Remember: 5 PM UTC on the 13th! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 470 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!

Update Lucene docs with recipe steps, .NET Foundation most active community projects 2023 - This week in Orchard (26/01/2024)

Update ResourceManager to better handle resources that don't specify a version, update Lucene docs with recipe steps, and Orchard Core is in the top 10 of the list of .NET Foundation's most active community projects of 2023! Without any further ado, let's get started! Orchard Core updates Update Lucene docs The Lucene module allows you to manage Lucene indices. This module contains a Lucene Worker feature, which creates a background task that will keep the local file system index synchronized with other instances that could have their local index. It is recommended to use it only if you are running the same tenant on multiple instances (farm) and using a Lucene file system index. The module also provides a management UI and APIs for querying Lucene data using ElasticSearch Queries. And of course, Lucene indices can be created during recipe execution using the ElasticIndexSettings step. The documentation of this module has been updated with these recipe steps to describe how to set the default search settings, how to restart the indexing process from the beginning to update current content items, or how to rebuild a Lucene index. Update ResourceManager to better handle resources that don't specify a version Let's say we have two scripts defined. A "default" version that doesn't specify a version. In another module, we define an override of that resource by defining a resource with the same name and specifying a version number. When we run the site, the script resources fail to load due to an ArgumentNullException. The issue lies in ResourceManager.FindMatchingResource, because when evaluating the second match, resource.Version is null, which causes a new Version(resource.Version) to throw the ArgumentNullException. Note that earlier in the method, the code takes care to avoid the ArgumentNullException by checking for null. A workaround for this issue is to just make sure that all resources specify a version, but since the version is not required by the API, it should handle null gracefully. You can reproduce this issue by following these steps: In an IConfigureOptions<ResourceManagementOptions>, register a new resource. For example, a script called "MyScript". Don't specify a version. Additionally, register a second resource with the same name, and this time also call SetVersion with a valid version number. For example, "MyScript" with a version of "1.0.0". Require the resource. For example, in Layout.cshtml, use the script tag helper to require "MyScript" and don't specify a version. Run the site and notice that the script doesn't load (in fact, no scripts load). Also, notice that you receive an ArgumentNullException in the log. The expectation would be that version 1.0.0 of the resource to be loaded on the page (winning out over the one without a version, and not throwing an error). So, this change is about updating the ResourceManager.cs to better handle resources that don't specify a version. News from the community .NET Foundation most active community projects 2023 Shaun Walker shared this image on X that contains the most active community projects based on the number of pull requests, the number of commits, and the number of new contributors. As you can see, Orchard has 1136 pull requests in 2023, which is great. Orchard has 854 commits, which is weird. Why do we have more pull requests than commits? Do we close that many pull requests? The reason for that could be that we have some mini PRs created by Dependabot. And we haven't talked about which projects are using squash and merge and which aren't. But it's still a nice thing to be able to see Orchard in the top 10 again! And don't forget about the fact that Orchard Core recently reached 7000 stars on GitHub! Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 481 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!

Bootstrap 5 in the default Admin theme, Orchard Core Commerce survey - This week in Orchard (27/05/2022)

The default Admin theme now using Bootstrap 5, logging warning when a Zone isn't a Shape, adding documentation on Query API results changes and if you do e-commerce or if you have an opinion about e-commerce, please share your opinion with us by filling out this survey! Orchard Core updates Bootstrap 5 in the default Admin theme The Admin theme now using Bootstrap 5! The change only affects the Admin theme, there is no change in the built-in themes, you can use whatever Bootstrap version would you like to use there (or any other framework of course). If you open up the ResourceManagementOptionsConfiguration file in the Resources module, you can see that now you have the option to use the new Bootstrap version. Log warning when a Zone isn't a Shape You can't use both <zone> tag helpers and widgets for the same zone. If you have a widget in the zone, the content in zone tag helpers are ignored. Steps to reproduce the behavior: Create a new Orchard Core CMS Web App solution. Add a new Orchard Core Theme project. Replace the Views/Layout.liquid with Views/Layout.cshtml having the following content to keep it simple: @inherits OrchardCore.DisplayManagement.Razor.RazorPage<TModel>@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers@addTagHelper *, OrchardCore.DisplayManagement@addTagHelper *, OrchardCore.ResourceManagement<zone name="Footer"> <p>Hello from zone tag helper!</p></zone>@await RenderSectionAsync("Content", required: false)@await RenderSectionAsync("Footer", required: false) Launch and set up the web app. Go to /Admin/Themes, and select the newly created theme. Confirm "Hello from zone tag helper!" is visible on the home page. Create a zone "Footer" and a layer "Always" (boolean true condition). Create a widget content type with Html Body and add a new item with "Hello from Widget!" to the Footer zone. Go back to the home page. You only see Hello from Widget! and any tag helpers are ignored. The expected behavior would be that you should see Hello from zone tag helper!Hello from Widget! in the footer. From now, the code will log a warning instead of failing silently if the zone is not a shape. Here you can see the logging in the ZoneTagHelper and in the ZoneTag. Add documentation on Query API results changes If you called the api/query/{name} endpoint in Orchard Core 1.0.0, the query returned with the following schema: [ { "Id": 321, "UserName": "test", "Email": "[email protected]" }] If you upgraded to Orchard Core 1.1.0, this endpoint returns the data in a different format: { "items": [ { "Id": 321, "UserName": "test", "Email": "[email protected]" } ] } To make sure you handle the response correctly, the documentation of Orchard Core has been updated to reflect these changes. News from the community Orchard Core Commerce MVP planning and survey A few weeks ago you could see a nice demo about the Orchard Core Commerce module. And in that blog post, we also mentioned that Lombiq provides stewardship for this module. That actually means that we will do code reviews, and work on features and fixes. To have that, Márk Bartha (who is the project leader from our side) started this thread and added this survey. This is about asking the community what the most important features for you would be in an Orchard Core-based e-commerce solution. If you do e-commerce or if you have an opinion about e-commerce, please share your opinion here. The point of this is to try to do not all the things but focus on what is really needed first. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 271 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!

Update ImageSharp.Web v2, Lombiq Helpful Libraries - Resource Management for Orchard Core - This week in Orchard (19/05/2022)

Updating ImageSharp.Web v2, removing pagenum=1 from the 1 pager link to improve SEO, adding OnMessageSendingAsync() protected method and news and updates around the Lombiq Helpful Libraries. Check out our current post to read about the details! Orchard Core updates Update ImageSharp.Web v2 ImageSharp is a new, fully-featured, fully managed, cross-platform, 2D graphics library. Designed to simplify image processing, ImageSharp brings you an incredibly powerful yet beautifully simple API. ImageSharp is designed from the ground up to be flexible and extensible. The library provides API endpoints for common image processing operations and the building blocks to allow for the development of additional operations. ImageSharp.Web is a high-performance ASP.NET Core Middleware built on top of ImageSharp that allows the processing and caching of image requests via a simple API. ImageSharp.Web provides API endpoints for common image processing operations and the building blocks to allow for the development of additional extensions to add image sources, caching mechanisms, or even your own processing API. A few weeks ago ImageSharp.Web v2 had been released, and now Orchard is using the latest version of ImageSharp thanks to Dean Marcussen. ImageSharp is used in Orchard Core when you would like to work with Media Profiles or when you work with images (like setting up a crop point) from the Media Library using the Media Field. Remove pagenum=1 from the "1" pager link to improve SEO There's a minor SEO problem with the pager when pagenum=1. Since the content of pagenum=1 is identical to the page where the pagenum parameter is absent, SEO audit tools want a canonical URL to be specified. Though arguably, the pagenum parameter should just be removed when the value is 1. Steps to reproduce the behavior: Set up your site with the Blog recipe. Navigate to Configuration -> Settings -> General and set the Page size to 1. View the content items and observe the pager behavior. The expectation would be the pagenum parameter to be removed for the 1 link like it is for the < and << links. From now, you will not find pagenum=1 when you would like to navigate to the first page of your lists, even when you are hovering over the list item that contains 1 in your pager. Adding OnMessageSendingAsync() protected method There is a new protected virtual method called OnMessageSendingAsync, which is called before you want to send a new email using the STMP service. Now you can define how to configure the SMTP client before sending your message. News from the community Lombiq Helpful Libraries - Resource Management for Orchard Core The resource filter makes it possible to include resources automatically based on the current context. E.g., inject home page styling only when the home page is being loaded., Let's see a quick and simple sample about how you can use it and, what can you do exactly with this filter! Last week we mentioned that our Base Theme for Orchard Core is released, which contains all the foundations to build Orchard themes efficiently with included detailed samples. If you want to quickly try out this project and see it in action, clone our Open-Source Orchard Core Extensions full Orchard Core solution and also see our other useful Orchard Core-related open-source projects! We will clone the Lombiq's Open-Source Orchard Core Extensions repository for this demo as well. We will set up our site using the Blog recipe. After that, you can navigate to Design -> Themes and enable the Lombiq Base Theme and Lombiq Base Theme - Samples themes. You can also make the Samples one as the current site theme. Don't forget to enable the Lombiq Helpful Extensions - Helpful Widgets feature from Configuration -> Features. And now, you can go to the home page of your site and open the predefined blog post that comes from the recipe. You will see that our theme is applied with our stylesheets too, which will apply a different look when the site renders the detailed view of a blog post content item. And here comes the resource filters. To add resource filters the IResourceFilterProvider interface needs to be implemented, and the registration needs to be added to the service collection as well. As you can see here, we used the Always, and WhenContentType methods to define when to inject the stylesheets that we registered using the RegisterStylesheet method. We also have a RegisterFootScript and a RegisterHeadScript method to register scripts that will be displayed in the head or at the foot of the page. If you always want to inject the resource named Site, you can use the Always method. And if you only want to inject the resource named BlogPost when we display the detail view of the BlogPost content type, use the WhenContentType method and provide the BlogPost as the name of the content type. And don't forget to activate the resource filter middleware by adding app.UseResourceFilters() to the Configure method of the Startup file located in a common module or the web project. E.g.: public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider){ app.UseResourceFilters();} If you check out the ResourceFilterBuilder.cs (right side of the screen) you will find any other helpful methods that can be used to conditionally inject resources. Like the WhenHomePage and the WhenPathStartsWith ones, which have self-describing names. For more information, don't forget to check out the readme file about Resource Management. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 253 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!

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!

Code Generation Templates for .NET 5, Fluid 2 breaking changes - This week in Orchard (18/04/2021)

This week we will do some deep dives and take a look at the latest changes of Fluid 2. After, you can see how you can register your custom resources in Orchard Core and how to use the updated code generation templates with .NET 5! Check out our post for more! Orchard Core updates Fluid 2 breaking changes and fixes Let's say you had an expression something like foo != null and foo != "*" in your Liquid code. There are two things here: the null doesn't exist in Liquid. There is no such thing as null in Liquid. When you write null, it's like typing bread, there's nothing like bread in Liquid. Typing foo != null in this case is just about making sure that foo does really exists. Is it set to something? If you would like to check for null, you have to use nil because in Liquid that's how we check for null values. And let's say you write foo != "*" and foo =! null, that means you change the order here. Or let's say you have a code in Liquid like a or b and c or d and e. If you do it in C#, if you have an and and the first part of the expression is false, it won't check the value of the other parts, it will return with false. In Liquid, this is the opposite. In C#, the evaluation of this expression will happen from left to right but in Liquid it will happen from right to left. Let's see an example with this expression: 1 == 2 or b == 3 Liquid will start the evaluation of this expression in the following way: 1 == 2 or (b == 3) 1 == (2 or (b == 3)) (1 == (2 or (b == 3))) So, it will never check that when 1 will be equals to 2 because the evaluation will start from the right. This has been fixed in this version and Fluid now supports the following processing of the evaluation: (1 == 2) or (b == 3) So if you wrote foo != "*" and foo != null it was first checks if the foo is not equal to null. Then it will go to foo != ("*" and (foo != null)). Let's say you do something in your templates like: {% assign foo = 1 + 2 %} This is not valid in Liquid. In Liquid, there are no such operators like +, -, *, /. They are don't exist. They are supported in the first version of Fluid but now it has been removed to be close to the specification, so it's now not supported anymore. What you need to do actually is to change your operators in a way like {% assign foo = 1 |plus: 2 %}. The goal of doing that from the Liquid templating language is to be able to distinguish how to behave in terms of numeric operators and string operators. So if you have the following line of code in Liquid, the result you will get will be 12, not 3. {% assign foo = 1 |append: 2 %} If you have operators in your code, don't forget to rewrite them in the mentioned way. ResourceManifest breaking changes A resource used to be declared by implementing the IResourceManifestProvider interface that was resolved all the time on every page rendering and this change is about to redefine that. Now it's not using IResourceManifestProvider anymore, there is no such interface. You need to create an IConfigureOptions<ResourceManagementOptions> of a ResourceManagementOptions. The ResourceManagementOptions is just a class that can be resolved everywhere. It can be configured in the startup. And in this case, what we do is that is a static constructor of this class is instantiating one manifest instance, and then when the option is configured for every tenant, it's adding this instance (which is immutable) to the list of resource manifests that is in the ResourceManagementOptions class. Your own configuration can even remove existing manifests from the resource manifest or replace them with something else or add new ones. So, the two things here are that now we use the Options pattern from ASP.NET which is more standard. It's also better in terms of performance because it's a singleton for all the tenants. And here we are initializing the ResourceManifest instance in a static property. It's done once for all the tenants, even if you have one thousand tenants, there will be one instance of the ResourceManifest. Modifying the Lucene API To accept Post Form Data Now you can invoke Lucene queries with POST and GET requests too. And there are two methods: a route called content to get the content items and a route called documents to get the full JSON document. Add support for collections to OpenID Tokens Today all the documents are stored in a table called Documents. YesSql supports the notion of collections, which is a way to store some specific types or classes in different document tables to isolate them. So, instead of having everything in the same Documents table, you can have different document tables. When the content of this table can be isolated from the rest, you should do that. This is the case for the OpenId module. There are different levels of isolation. You could say every class should have its own document table. You could say also that every module can have its own document table. And then you can say that everything will go to the same document table. In this case, everything related to OpenId will go to the OpenId document table, which means everything in the collection named OpenId. This configuration tells YesSql there is a collection named OpenId. But how can you use that collection when you do queries? In this case, you have to say to query a class in a collection named OpenId. It will request that document table and get all the indexes that all related to this document table. We also do that when one of the classes has lots of items so it can scale better than putting everything in the same table. Like if you have one million content items it will be slow. In that case, it should be in their own custom collection. Demos Code generation templates for .NET 5 If you install the project templates pointing to the preview source, you are able to use new command line commands when generating an Orchard CMS Web Application to use the .NET 5 framework. You can find every information more detailed on this page of the Orchard core documentation. Right now we will just focus on the new stuff. So, don't forget to install the Orchard CMS templates for creating web applications. You will need to use the latest dev branch of Orchard Core to be able to use .NET 5, so this will be your command: dotnet new -i OrchardCore.ProjectTemplates::1.0.0-rc2-* --nuget-source https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json If you do that, you can head to the folder where you would like to create your new solution. The only thing you have to do is to type the following line: dotnet new occms --framework net5.0 This means the .NET framework 5.0 will be used. If you don't use the --framework or the --fm options, your web application will be using the .NET Core framework 3.1. A number of predefined projects and item templates are installed with Visual Studio. These templates, such as the ASP.NET Web Application and Class Library templates, are available to choose from when you create a new project. Item templates, such as code files, XML files, HTML pages, and Style Sheets, appear in the Add New Item window. These templates provide a starting point for users to begin creating projects, or to expand existing projects. Project templates provide the files that are required for a particular project type, include standard assembly references, and set default project properties and compiler options. Item templates can range in complexity from a single empty file that has a certain file extension to multiple source code files with stub code, designer information files, and embedded resources. You may know that we have some Visual Studio Project Templates for Orchard Core too (we wrote about them in this post). It's still a preview feature in Visual Studio, so, you need to navigate to Tools -> Options -> Environment -> Preview Features and put a tick in the Show all .NET Core templates in the New Project dialog (requires restart) checkbox. After you can just say I want to create a new project File -> New -> Project and you will be able to select the Orchard Core one as the project type. Let's select the Orchard Core Cms Web App (Orchard Project) one for example. After you can set the name of the project, the location, and the name of your solution. The next, Additional information window will contain the property that we are focusing on right now. As you see on the screen, you can select which kind of framework you would like to use for your web application. It can be .NET Core 3.1 and .NET 5.0 as well. The default is .NET Core 3.1 in this case too. Here we are just creating our new solution using the name Test. And if we open up the Test.csproj file, we will see the following content here, where the value of the TargetFramework will be set to net5.0. If you would like to know more don't forget to check out a previous This week in Orchard post, where we first wrote about this topic. And as always, here comes the recording of this demo! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 196 subscribers! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

Rules module, Html Menu Item - This week in Orchard (21/03/2021)

This time you can read about the new Html Menu Item content type, you could see how to use the new Rules module, and can watch a recording about a new Orchard Core theme! Check out our post for more! Orchard Core updates Add new HTML Menu Item content type This is a new content type that is super useful for menus that are customized like you have items that are links but there is one item with a special div or with a custom HTML to provide like images and stuff inside. Let's take a look at the HtmlMenuItemPart. Using that part you can just edit the Row HTML directly. The content here is sanitized by default to prevent custom scripts, but if you navigate to Content -> Content Definition -> Content Types -> Html Menu Item and hit the Edit near the Html Menu Item Part you can disable the sanitization anytime. On the screen below you can see the new HtmlMenuItemPart Content Part and the liquid file that is responsible to render its content when using the Blog theme. But let's see how you can use this content type in your site! Let's say you set up your site using the Blog recipe. By using the Blog recipe you will get a default menu, called Main Menu, that contains two Link Menu Items, called Home and About. The first one is just about redirecting the user to the home page and the second one is about redirecting the user to the slug of the built-in About Article. Now head to the Main Menu option of the admin menu and click on the Add Menu Item button to add a new Menu Item. Here you can see the new option that you can select: the Html Menu Item. Select this one and fill out the form. The Url will be the target link where the user will be redirected when clicking on this menu item. And the Html box will contain the custom HTML of our menu item. Here we are just using the HTML code from the Category terms of the Blog Post and modified it a little. And we put this new menu item between the two existing ones as you can see here. And one last note here. When you add a name to your menu item (you saw we used the My new Html Menu Item just for the sake of demonstration) it will be persisted in the string property called Name that is available on any existing parts that can be used as a menu item (LinkMenuItemPart, ContentMenuItemPart, and MenuItemsListPart). But you cannot see the Name property when you check out the implementation of the HtmlMenuItemPart. The reason for that is the Name property is obsolete and will be removed in a future version and you should use the DisplayText instead. And as you can see, the MigrateMenuItems method in the Migrations.cs of the Menu module is just about to migrate the existing menu items to use the DisplayText property instead of the Name. jQuery 3.6.0 released and added to Orchard Core jQuery 3.6.0 has been released! In jQuery 3.5.0, the major change was a security fix for the HTML prefilter. This release does not include a security fix but does have some good bug fixes and improvements. If you want to read about this new version, head to this post now! But now let's focus on the fact that you can also use this new version of jQuery in your custom themes or modules by default without the need of including it by yourself. If you open up the content of the OrchardCore.Resources module, you will find the ResourceManagementOptionsConfiguration.cs file there which is responsible to register some scripts and stylesheets for you by default that you can easily use anytime you want. So, from now we have several jQuery versions that you can use in Orchard Core, like version 3.6.0, 3.5.1, and 3.4.1. You can specify which version you want to use but if you don't do that, the CMS will inject you the newest one. Demos Rules module Using layers in Orchard Core was not a good idea because every time someone would like to use layers, the members of the community always said to don't do that, layers are too slow. But layers are really useful and the good news is the performance of the layers is now much better. Let's see the topic of this demo, the Rules module which allows you to build rules for the layers without using JavaScript. What you have now if you edit a layer, you have rules that you can add to a layer with a nice little popup. The easiest one is the Always layer, which has a boolean condition of true or you can choose to be false if you never want to show the widgets in this layer. You can also have two types of groups: All condition group, which means all of the rules inside this group should be true. Any condition group, which requires one condition to be true. The easiest way to show how grouping work maybe is to go with a GIF. Here you will see that we are creating an All condition group layer rule and inside that group, we have a Content type condition and a URL condition. We say that we only want to display the content of this layer if the content type of the currently displayed content item is BlogPost and if the URL contains the blog word. So our layer will not be visible if the URL just contains the blog word, we need a BlogPost content item to be displayed too. But you don't really need the all condition group here. If you just put the layer rules without using groups, the layer will be visible only if all the conditions here return true. If you want an OR behavior, use the any condition group layer rule. And one cool thing here: you can use drag and drop to move the rules between the groups. You can easily say that I want to move this outside from the all conditions group and put it into the any conditions group. And don't worry if you prefer the JavaScript conditions, you can still add a JavaScript condition where the script must return true or false to display or hide the content of the layer. And as usual, in Orchard Core everything is extensible. If you would like to add your own custom layer rules you can easily do that just by implementing the ConditionEvaluator abstract class where the EvaluateAsync method is responsible to return a boolean value that represents the result of your rule. Check out an easier one, like the HomepageConditionEvaluator! And as usual for the demos, if you would like to know more about this awesome new feature, don't forget to head to YouTube for a recording! Tailwind Blog Theme If you navigate to the following repository on GitHub you will find a simple blog template built with Tailwind and AlpineJS. Tailwind is a utility-first CSS framework packed with classes like flex, pt-4, text-center, and rotate-90 that can be composed to build any design, directly in your markup. Here you can see what kind of classes you need to add to be able to handle the margins, colors, the font-size, and almost everything. Tailwind doesn't give us automatically pre-styled components. Rather, it gives us utility classes that help us style our components in certain ways and allows us to build our own classes using these utility classes. In the following recording, you could see how you can build a blog theme in Orchard Core using the Tailwind blog template. News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 194 subscribers! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

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

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

This week in Orchard - 12/27/2019

New deployment step for Open ID Server, a new multi-tenant platform built with Orchard Core and a very interesting demo about a custom admin tree module with taxonomy terms menu are waiting for you among other exciting news in this year's last This week in Orchard post! On Orchard Core Allow replacing a Liquid filter Orchard Core has several built-in Liquid filters. You can make your own Liquid filter if you implement the ILiquidFilter interface. However, it could be a valid use case if you would like to change the behavior of one of the predefined built-in filters and replace it with your own one. When registering a Liquid Filter to the service container, you have to do it in the ConfigureServices method of your Startup.cs file: public override void ConfigureServices(IServiceCollection services){ services.AddLiquidFilter<BuildDisplayFilter>("shape_build_display"); services.AddLiquidFilter<ContentItemFilter>("content_item_id");} Here you can see how to register the shape_build_display and content_item_id filters. But let's have a closer look at that AddLiquidFilter extension method! public static IServiceCollection AddLiquidFilter<T>(this IServiceCollection services, string name) where T : class, ILiquidFilter{ services.Configure<LiquidOptions>(options => options.FilterRegistrations.Add(name, typeof(T))); services.AddScoped<T>(); return services;} You could see that every time when you call AddLiquidFilter it adds your filter to the FilterRegistrations Dictionary. To be able to override an existing Liquid filter with your own, Jean-Thierry Kéchichian had to change this extension method a little bit and instead of adding the new filter to this Dictionary, just overwrite an existing one. public static IServiceCollection AddLiquidFilter<T>(this IServiceCollection services, string name) where T : class, ILiquidFilter{ services.Configure<LiquidOptions>(options => options.FilterRegistrations[name] = typeof(T)); services.AddScoped<T>(); return services;} Delete role should warn the user if the role has associated users Let's create a custom role and let's name it Blogger. Now let's create a new user and add the Blogger role to it. Now go back to the Roles page and delete the Blogger role. If you hit the Delete button you will see a warning message, that says this role is associated to existing user(s). Prefix resource manager definitions for sample themes When you would like to register your resource using the ResourceManifest, you have to do something similar: manifest .DefineScript("vendor-bootstrap") .SetDependencies("vendor-jQuery") .SetUrl("~/TheBlogTheme/vendor/bootstrap/js/bootstrap.min.js", "~/TheBlogTheme/vendor/bootstrap/js/bootstrap.js") .SetCdn("https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js", "https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.js") .SetCdnIntegrity("sha384-JjSmVgy...", "sha384-rkSXwmdF/9eRLkw/gNZG+1...") .SetVersion("4.3.1"); But what if you want to register Bootstrap again in your custom theme? You can do that of course, but when there are multiple resources with the same name, the resource manager takes the one with the highest version. // Use the highest version of all matchesif (resource == null || (resourceDefinition.Version != null && new Version(resource.Version) < version)){ resource = resourceDefinition;} To make things easier every predefined resource in the themes available in Orchard Core now has prefixes, which is the name of the theme. As you can see in the following code snippet, we registered the script for Bootstrap in the Blog theme with the name: TheBlogTheme-vendor-bootstrap. manifest .DefineScript("TheBlogTheme-vendor-bootstrap") .SetDependencies("TheBlogTheme-vendor-jQuery") .SetUrl("~/TheBlogTheme/vendor/bootstrap/js/bootstrap.min.js", "~/TheBlogTheme/vendor/bootstrap/js/bootstrap.js") .SetCdn("https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js", "https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.js") .SetCdnIntegrity("sha384-JjSmV6OrQ6VrjIEaF...", "sha384-rkSGcqMuXXwmdF/9eRLkw/gNZG+1zYut...") .SetVersion("4.3.1"); Deployment step for Open ID Server Head to Configuration -> Features and enable the OpenID Authorization Server module. Then you will get a new OpenID Connect option under the Security menu, where you can set up the authorization server, application, and scopes. If you set up the server in a way (the way how it's not important right now) you can import the settings of your server if you create a new deployment plan under Configuration -> Import/Export -> Deployment Plans. If you select the OpenID Server step, that will export all the Open ID Server settings. Just execute the deployment plan locally. After if you open the Recipe.json file in the zip you will find a section called OpenIdServer in the steps section. "steps": [ { "name": "OpenIdServer", "OpenIdServer": { "AccessTokenFormat": 0, "Authority": null, "CertificateStoreLocation": null, "CertificateStoreName": null, "CertificateThumbprint": null, "AuthorizationEndpointPath": "/connect/authorize", "LogoutEndpointPath": "/connect/logout", "TokenEndpointPath": "/connect/token", "UserinfoEndpointPath": "/connect/userinfo", "GrantTypes": [ "authorization_code", "refresh_token" ], "UseRollingTokens": false } }] In the specific content type list only allow the creation of the new content item of the selected type In the admin page, you have a Content Types submenu under the Content menu, where you can list all of the content items. If you click on one of those (for example the Article) there was a green New button where you can create any type of content item that is creatable. Now with a new improvement, the UI responds to the type of the selected content type and (if the Content Type is marked as creatable) you can create only a new content item of the selected type. Here you could see the green button has a text: New Article. New multi-tenant Orchard Core platform GovBuilt has over 30 years of government software experience. They worked with government employees, contractors, and citizens to build a best-in-class online solution that streamlines the permitting and licensing process. They offer a GovBuilt Platform built for Government. And they are using Orchard Core to build their solution! They have several tenants, and https://pottcounty.govbuilt.com/ is one of that! Demos Custom Admin Tree module with taxonomy terms menu You can find a new module in this repository called ThisNetWorks.OrchardCore.AdminTree and a new theme here, called ThisNetWorks.OrchardCore.Themes. If you clone these repositories and add them to your Orchard Core solution you will see a new module under Configuration -> Fetaures called ThisNetWorks Admin Tree Menus. ThisNetWorks Admin Tree module displays content items based on a URL tree or taxonomy structure. This module presents a taxonomy and it's associated terms in a tree menu. The primary purpose of this menu is intended to provide a way to manage complex taxonomies, in combination with a navigation system that makes manages those terms, and content items easier. Let's enable this feature! Now go Design -> Themes and make the ThisNetWorks Admin Theme as the current theme. This adapts the default admin theme to support the menu's on the left sidebar to include clickable entries on tree nodes (i.e. nodes that contain child items can also contain a link to an entry). To be able to test the current capabilities of this solution quickly, you can use a recipe (Configuration -> Recipes) called Categories, that contains sample content items and taxonomy for a taxonomy menu tree. After you run this recipe you should see the following admin menu structure. Here you can see a Categories option with several sub-items. Categories is a taxonomy with the Category term content type and this admin menu shows you the structure of the Categories taxonomy in a clickable way. For example, if you select Motorbike, the site lists you all the content items that have this taxonomy and the category of that is Motorbike. If you click on the blue Create Leaf Article button you can create a content item that has a permalink and the Categories taxonomy will be set to Motorbike by default. Let's see what will happen if you click on the View button near the Articles content item, that is the root term content item of the Categories taxonomy. As you can see, users in the front-end can navigate between the different levels of terms and when navigating between the different content items, you can use different kinds of badges to show the terms and of course, the URL reflects this change as well. This feature is under development and we hope that this will be part of Orchard Core soon! If you are interested in this demo don't forget to check this video on YouTube! On Lombiq Orchard Dojo Newsletter Now we have 108 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!

Diving into the Orchard API - Dojo Course

UPDATE (2017-11-22): Dojo Course 2 is released with new, updated videos! This week on Dojo Course we dive into the Orchard API, use some of the build-in services and extending the capabilities of our module to make it even better! Using LazyField<T> to load data lazily so they are only loaded when we really need them. Using Work<T> to load dependencies lazily so they are only resolved when we really need them. Applying the [Admin] attribute for admin-related Getting to know an other Orchard service: IAuthorizer. Creating our own permissions by implementing the IPermissionProvider. Using the ContentManager so we can finally work with content items! Generating ad-hoc shapes and matching them to an actual template. Implementing the IResourceManifestProvider interface for managing static resources. Remember: if you have any questions don't hesitate to ask them by creating a new issue in the Orchard issue tracker with the "discussion" label. Make sure to prefix your thread's title with "Dojo Course - "! We keep an eye on these issues. Also follow us on Twitter to get notified about the latest Dojo Course news, including when a new tutorial is posted. Do you have some feedback about the course? Please send it in. Haven't you enrolled yet? Why not do it some time in the near future like right now?