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

Show a badge if a user is locked out, Lombiq Orchard Visual Studio Extension v.1.8.1 - This week in Orchard (27/06/2025)

This week's topics include displaying a badge when a user is locked out, renaming the ResetIndexProfile and RebuildIndexProfile recipe steps, and enhancing documentation for the indexing module. And have we mentioned that we've released a new version of our Orchard Visual Studio Extension, which now includes support for Razor Pages to the Dependency Injector?

Latest tutorials

Featured tags

IIS
API
SMS
SEO
MCP
All tags >

Short codes, new content filters - This week in Orchard (22/05/2020)

Would you like to have an enhanced way to filter your content items in the content items list? Or are you looking for a feature that could work similarly to the short codes in WordPress? If your answers are yes, then this post is written for you! Orchard Core updates Configure Dev package source If you would like to use the nightly builds of Orchard Core, then you will need to use MyGet instead of NuGet. Now the documentation contains a dedicated page to explain how to add the dev package source pointing to MyGet. Preserve external authentication tokens There is a new feature to save the external tokens to be able to reuse them inside the user payload. They are encrypted inside the User object and the UserStore now implements the interface named IUserAuthenticationTokenStore. If you are about to manage tokens you just need to use the methods here to get/set/update or remove the tokens. Document activate-links.js and extend functionality for nested menu items and action URLs In the past, by using the activate-links.js script there was no way to expand a nested menu item if the active URL was in a sub-navigation item. Also if you had an active menu link like for example /todo-items, and navigated to an action from there like /todo-items/Create or /todo-items/Edit/{id} and the URL does not appear in the menu, no item was active in the menu. Now the activate-links.js is extended to traverse URL segments to find out the active menu item and you can find a callback function to perform more actions on nested menus. There is also nice documentation about how to mark the active item in a menu. Short codes Let us show you a way to inject some predefined HTML snippets like a media snippet that you can inject in your content editors. Today when we render for example an HTML BodyPart, we will optionally evaluate it as a Liquid template, and we will also use the new Short Codes feature of Orchard Core. The idea is that there is a module in Orchard Core called ShortCodes. This feature is about letting you evaluate some HTML blocks and replace short codes. We had that in Orchard 1 (remember the notion of filters and the tokens feature). This short code is actually looking much more like tokens in Orchard 1, but with a difference. You have a ShortCodeService that has a ProcessAsync method with string input. It processes and replaces all the short codes in the HTML and returns you another string. The implementation is looking for IShortCode implementations, right now we have only one implementation, called MediaShortCode. When you call ProcessAsync, it will look for everything that has the text between [media] and [/media] and then take whatever is inside. Ensure its a valid URL and sanitize the output of this thing just in case it would contain some ref to a JavaScript or anything that could look like a script and returns the result. That is actually lighter than Liquid and easier to read. We use Liquid, because we had that, and of course you can still use Liquid. So, now you can create as many short codes as you want. For example there could be a Read more short code that is just about to render a Read more link from the summary to the full blog post. Later we can have a service like ShortCodeDefinition, that would let you describe the short code that you can support with the name, the properties, and the description, like in Orchard 1, where whenever something is tokenizable there is a little pop-up button that you can use to list all the tokens that are available. This would be very useful to have in Orchard Core too. In Orchard 1, the tokens were code-based. There was a way to chain them, which means you could have a token to return the user and from the user you could say give me his email, and so on. But in this case you had to chain them in some way. For that you can use Liquid in Orchard Core by providing good flexibility to write anything without the limitation of tokens. The token is like in the middle between the short codes and Liquid. It's not powerful enough, but it's more powerful than short codes. Short codes would be super-easy to use and you can't chain them. But you can use them recursively like you could use maybe B short code to make something bold inside an A short code. They are individually functional, they don't work together like tokens would do. And we can make short codes dynamically or from the admin like templates. We could not change the behavior of tokens from the admin, but with this logic we could list all the available short codes and also add new custom short codes. Like you could add a new Twitter short code by yourself where the template itself could be in Liquid. In this case the users can use short codes that could be easier to write than Liquid. But why is it call short codes? This name comes from WordPress, where you can already meet with a thing called shortcodes. Here is a screen from WordPress where you can see all the short codes. We can also add queries to this list, like let's inject the recent blog posts! But that's enough talk for now, let's see the media short code in action! Imagine we have an Orchard Core site installed with the Blog recipe. Now navigate to the admin site and upload an image to the root of the Media Library. We added an image here called cat.jpg. Leave a comment below and try to guess what can you see in this picture! Now navigate to the Blog and edit the built-in one. The goal is to add the media short code somewhere in the body of the post. Here you could see the way of using the media short code. Now we have one step left to do: publish the post and see it in action! As we mentioned you can use as many short codes here as you want and can display multiple cats too! Demos New content filters The header section of the content items list will be updated and different modules and features can apply filters to the content listing. The first one is the culture filter, which means that you will have the availability to filter by localized content. You can also apply the taxonomy filter and filter by categories. Or you can filter by tags if you want. To set up which taxonomies you want to use in the content list to filter on, you will find a new setting under Configuration -> Settings -> Taxonomy Contents List Filters, where you can choose which you want to use. If you are interested in the full demo and the way how it will implement, don't forget to check out the recording on YouTube! News from the community Poking around with Orchard Core You can find a huge detailed blog post about how to build modular, multi-tenant applications using Orchard Core. Thanks to Lewis for this great post! A new website using Orchard Core Shipwrecked alone on an uncharted island, explore, adapt, and navigate the land and perilous seas to stay alive. Brave the storm in Windbound, the new survival open-world role-playing game coming this August 2020 on PC, PlayStation 4, Xbox One, and Nintendo Switch. Let us show you the official website of Windbound - Brave the storm! If you are interested in more websites using Orchard and Orchard Core, don't forget to visit Show Orchard. Show Orchard is a website for showing representative Orchard CMS (and now Orchard Core) websites all around the internet. It was started by Ryan Drew Burnett, but since he doesn't work with Orchard anymore, as announced earlier it is now maintained by our team at Lombiq Technologies. Orchard Nuggets: How to call an external API from a workflow task? In our newest Orchard Nuggets post we will show you the way how to use the Http Request Task to call an external API in Orchard Core! And guess what, we will also show you the way how you can work with the response data in your custom workflow task! Check out the other posts for more such bite-sized Orchard tips and let us know if you'd have another question! Orchard Core workshops The contributors of Orchard Core will hold some unique online workshops in the coming months, between May and September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. Lombiq's developers will also give two workshops, on using Orchard from the admin UI and on developing a module. Are you looking to get up to speed with Orchard? Check out the workshops' details on the Orchard Core homepage! Orchard Dojo Newsletter Now we have 145 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! 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!

How can I call an external API from a workflow task? - Orchard Core Nuggets

You have several options to send an HTTP request to an external API in Orchard Core, but maybe you haven't tried the Http Request Task. Let's see quickly how you can hook up a workflow! The HTTP Request Task comes from the HTTP Workflows Activities feature, so before doing anything, don't forget the enable that module. Now navigate to the Workflows option from the menu and hit Create Workflow Type to add your workflow. JSONPlaceholder is a nice fake online REST API that you can use whenever you need some fake data. It comes with a set of 6 common resources and we are going to use the first one and making a GET HTTP request to get 100 user posts in a JSON format. Choose the Add Task button in the Workflow editor and select the HTTP Request one from the HTTP category. Here you can see a nice editor where you can provide the details of your request. We added a custom title to our activity as Get 100 posts. The URL will be the URL provided by the JSONPlaceholder API. To get the posts we have to make a GET request. If you would like to add a new post, make a POST request to the same endpoint, and provide the body to send. Don't forget to handle the 201 HTTP response code, because this will be the number that will show you that you are good to go and the server faked that your content was created. You may notice that you can type Liquid code everywhere in this editor. Let's say that the title of our new post will be the name of our site. To do that, we can pass the {{ Site.SiteName }} Liquid expression. As we mentioned, we get 201 if everything goes well. If the server returned with anything else, then something bad happened and we should handle that in our workflow of course. To handle the failed requests, we can use the Unhandled HTTP Status branch of the HTTP Request Task (we named in Create a new post) and notice the user somehow. OK, it's not a useful workflow, because we are only dealing with the response codes, but not with the response body. But how can we use the response details? To find the answer we have to check the source code of the HTTP Request Task activity and take a look at the ExecutyAsync method. Here you can see that the code uses the LastResult of the workflowContext and the LastResult has a Body property where you can find the response body itself. The LastResult property of the WorkflowExecutionContext is an object, that means you can easily put everything into the LastResult, but it could be a little bit harder to get the content from it. public override async Task<ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext) { using (var httpClient = new HttpClient()) { var headersText = await _expressionEvaluator.EvaluateAsync(Headers, workflowContext); var headers = ParseHeaders(headersText); foreach (var header in headers) { httpClient.DefaultRequestHeaders.TryAddWithoutValidation(header.Key, header.Value); } var httpMethod = HttpMethod; var url = await _expressionEvaluator.EvaluateAsync(Url, workflowContext); var request = new HttpRequestMessage(new HttpMethod(httpMethod), url); var postMethods = new[] { HttpMethods.Patch, HttpMethods.Post, HttpMethods.Put }; if (postMethods.Any(x => string.Equals(x, httpMethod, StringComparison.OrdinalIgnoreCase))) { var body = await _expressionEvaluator.EvaluateAsync(Body, workflowContext); var contentType = await _expressionEvaluator.EvaluateAsync(ContentType, workflowContext); request.Content = new StringContent(body, Encoding.UTF8, contentType); } var response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseContentRead); var responseCodes = ParseResponseCodes(HttpResponseCodes); var outcome = responseCodes.FirstOrDefault(x => x == (int)response.StatusCode); workflowContext.LastResult = new { Body = await response.Content.ReadAsStringAsync(), Headers = response.Headers.ToDictionary(x => x.Key), StatusCode = response.StatusCode, ReasonPhrase = response.ReasonPhrase, IsSuccessStatusCode = response.IsSuccessStatusCode }; return Outcomes(outcome != 0 ? outcome.ToString() : "UnhandledHttpStatus"); } } Imagine you are implementing a custom activity that creates content items based on the response body. For that, you need to get the JSON then serialize it to a typed class. That makes the data easier to work with. In the ExecutyAsync method of your custom activity you can get the JSON like: var responseBody = workflowContext.LastResult.GetType().GetProperty("Body").GetValue(workflowContext.LastResult).ToString(); Here the responseBody variable will contain a JSON in a string. You may notice that the value of the title here is Orchard Core, which comes from the {{ Site.SiteName }} Liquid value. To deserialize the response to typed classes you can use the built-in Json.NET package in Orchard Core and for instance, use the JsonConvert.DeserializeObject method of it. And that's it, now do what you want with the data. Did you like this post? It's part of our Orchard Core Nuggets series where we answer common Orchard questions, be it about user-facing features or developer-level issues. Check out the other posts for more such bite-sized Orchard Core tips and let us know if you have another question!

New Orchard Core theme, Make Content recipe step idempotent - This week in Orchard (16/05/2020)

Are you tired of the existing built-in themes in Orchard Core? Do you want to try new ones? Well, let us show you a brand new theme called The Medium Theme! The scheduled publish feature now can be used with the nightly build packages! And if you want to expand your knowledge you can read about the security-critical permissions, the new methods in the IContentHandler interface, and many more! Orchard Core updates Make FormPart generic Now you can customize a FormPart attached to any content type and define the enctype to use when submitting the form using POST method or you can enable the Antiforgery Token if you want. You can also customize the wrapper around your form. Just enable the Forms module and attach the FormPart to your type. Then you will find the following screen when editing your content type. Render BagPart items with Summary display type If you have widgets inside a BagPart, they would be displayed with the Detail display type and shows unnecessary stuffs. But the whole thing is quite weird. Why would you add a widget to a BagPart? For widgets, you can use the FlowPart and add widgets there. BagPart is for content items not for widgets. If they are in BagPart it will break your themes if you have provided custom templates for widgets using the Detail display type instead of the Summary one. You can still change the display type for the items in the BagPart to another display type if you want to customize the rendering. Here you could see a widget Summary template (Widget.Summary.cshtml) that would be used in case if you render a widget inside a BagPart because it will use the Summary display type. So, in a nutshell: BagPart will render content items as Summary display type. If any content type template was customized for Detail (Content-Foo.cshtml) in BagParts, it will need to be changed to the Summary display type (Content-Foo.Summary.cshtml). Make content recipe step idempotent If you check the IContentHandler interface you will find some new endpoints: ImportingAsync ImportedAsync ValidatingAsync ValidatedAsync The goal of these new methods is that any import or API call to query content have to be idempotent, meaning that the same action will be executed multiple times and that will result in the same effect, like if you say create a content item with the ID = 1, the first time it will create it, the second time it will tell you it's nothing to do because it's already done. Or if you call delete something 10 times, it will do it for the first time and don't do anything for the next one, don't break anything, just tell you that the call is already done. But if you say create new items 10 times, it will create them 10 times, depends on the parameters you pass. Let's see an example in the AliasPartHandler. If you try to import a content item with an alias that already exists, the result will be a fail with an error Your alias is already in use. Update configuration docs There is a section in the documentation that now shows you how to create a tenant just from the configuration. Add Scheduled Publish functionality Some weeks ago we showed you an upcoming feature to Orchard Core that is about to publish a content item in a given time in the future. Now, this feature is merged to the dev branch of Orchard Core, so if you are using the nightly builds of Orchard Core, update to the latest and try out this feature now! If you haven't heard about this module yet, check out the demo about how to use it on YouTube! Make Import Data a security-critical permission As a reminder, security-critical permission is a permission that could enable you to elevate your permissions and abuse a feature to become a super admin. There are some critical features in Orchard Core like running a recipe. If you run a recipe you can enable any feature, a feature that might give you access to anything or change some content that might give you access to anything. The Import Data Permission should be listed as security-critical because with it you can import any data to the site, including changes to roles, which could elevate permissions. The way how you can create security permissions can be seen for example in the Permissions class of the Deployment module. Demos New Orchard Core theme: The Medium Theme The Medium Theme is a free, open-source theme that you can find in the following repository. Sipke Schoorstra decided to create an Orchard Core theme based on The Medium Theme and make it open-source. This repository not just containing the theme itself, but you can find there some useful features too. Later, the theme will get its own repository. The comments are not supported yet, but that's on the roadmap that you can also find in the Readme.md file of the repository. The blog posts are associated with owners, for that the User extended with a couple of settings. Blog posts can have tags and you have many other features to use in your theme. If you are interested in everything about the new theme, don't forget to check the following recording on YouTube! News from the community Stability updates for our Orchard Visual Studio Extension Lombiq Orchard Visual Studio Extension is a Visual Studio extension with many features and templates frequently used by Lombiq developers. It contains Orchard-related (including Orchard Core) as well as generic goodies. This extension has an Orchard Log Watcher feature, that alerts you when you have any new entry in the log file. When you install this extension, you will see a new button on the Orchard Log Watcher toolbar. The button of this toolbar will be enabled when you have unread entries in the error log files. If you click on this button, the log file will be opened with the editor assigned to open .log files. And that's not all of the features of this extension! This week we released a new version that contains stability updates that fixing some potential embarrassing UI freezes. If you have it installed, the update will arrive automatically, otherwise check out here the open-source extension. In GitHub, you can find the extension's Readme with release notes too. Also, if you encountered bugs or have a feature request please add it on the GitHub page as well. Lombiq and open-source Open-source software is something we live and breathe. Check out how we contribute to the very foundation of the IT world by reading the Lombiq and open-source post on our website! Orchard Core workshops The contributors of Orchard Core will hold some unique online workshops in the coming months, between May and September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. Lombiq's developers will also give two workshops, on using Orchard from the admin UI and on developing a module. Are you looking to get up to speed with Orchard? Check out the workshops' details on the Orchard Core homepage! Orchard Dojo Newsletter Now we have 145 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! 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!

Named style and script Tag Helpers, This is Lombiq! - This week in Orchard (09/05/2020)

Have you ever developed a great feature for Orchard Core that you wanted to add to the source code, but you were not sure about how to contribute the code and submit a pull request? And do you want to know the team behind all that we do at Lombiq Technologies? Here are all the faces, the whole Lombiq team. This is Lombiq! Don't hesitate and check our current post for more! Orchard Core updates Make Login, Logout and ChangePassword paths configurable Now you can change the endpoints for the login URLs. These can't be changed by using code, that's why they had to be in the appsettings.json. You can find the correct way about setting these values in the documentation. How to contribute? Since now there weren't any pages where you can find details about how you can contribute your source code back to Orchard Core. Now if you checkout to the dev branch of Orchard Core you will find a CONTRIBUTING.md file in the root of the repository which tells you everything about how to contribute code and content, submit pull requests and so on. Allow registering named style and script resources with inline content You have Liquid and Razor tags for custom styling/custom scripts and the ability to say where you want your style/script to be rendered. And if you inject a custom script/styling you can set the dependency of your custom script/style. Let's see some Razor example for these additions! Imagine that you would like to add a custom script for your page and use the ID selector from jQuery to select a single element with the given ID attribute. For that, you will need to include jQuery for your page. To do that you have 2 options:Register your script using the IResourceManifestProvider, set the dependencies of your script (for example jQuery), and just simply use the script Tag Helper to inject that to your Razor page. <script name="myVeryCustomScript" asp-src="~/areallycustomscript.js" at="Foot"></script> But you can also set the dependency here by using the depends-on attribute. The second way is to add a custom script and say that you are using jQuery functions, so you will need jQuery to be able to run your script. <script at="Foot" depends-on="jQuery"> $('#myDiv').css('border', '3px solid red');</script> In both cases, you inject your script in the wanted location (foot or head) and set the dependencies of the page. That's great, but imagine that this script is in the template of a widget. And of course, a page can contain several instances of your widget. In that case, your script will be injected multiple times. In some cases, that's what you want, but if not, it's unnecessary to have that script on the page multiple times. You have several workarounds to check if the script/styling is already injected to the page or not, but now you have an easier solution for that. Let's see the following code: <script name="MyScript" at="Foot" depends-on="jQuery"> $('#myDiv').css('border', '3px solid red');</script> The only difference here is the name attribute and this makes this block a named script. Named scripts will only be injected once and can optionally specify dependencies. You can use the style Tag Helper in the same ways: <style name="my-style" depends-on="the-theme"> .my-class { /* some style */ }</style> Adding option to enable MiniProfiler on the admin too The MiniProfiler module can only display its little widget on the frontend currently. Now you have an option to enable it for the admin too. To see it in action set the option, which can be done in OrchardCore.Cms.Web's Startup class with this snippet: public void ConfigureServices(IServiceCollection services){ services.AddOrchardCms(builder => builder.ConfigureServices(services => services.PostConfigure<MiniProfilerOptions>(options => { options.AllowOnAdmin = true; })));} Or you can use the AllowMiniProfilerOnAdmin() extension method in the same method: public void ConfigureServices(IServiceCollection services){ services.AddOrchardCms(builder => builder.AllowMiniProfilerOnAdmin());} For more information about the Mini Profiler head to the documentation, where you can also find a link to the updated Configuration page. Fix RSS items description The issue in the screen below was that if the bodyAspect was not null, we are reused the bodyAspect. The bodyAspect was cached during a request, but if you are rendering many different content items, then we would reuse the same bodyAspect for all of them. In an RSS feed when we build the body of the content items, all the RSS items would have the same body. Now we are also caching the content item ID. If we don't match the exact content item ID we don't restore the cached version of the body. Check the diff in the HtmlBodyPartHandler! Here you could see the related code changes where we also cache the content item ID. Demos Kast Group Finder: an Orchard Core site Kast is an Australian company and one of their primary goals is to implement the Kast platform with the Kast Group Finder component. We worked together with Seth Cleaver (Co-founder and Director of Kast) on this tool to be able to create an intuitive self-service process that enables people within a church to easily find a suitable group to attend, simplify the administrative processes required for getting people into groups, and provide information to the group co-ordinators that might assist in planning and measuring effectiveness. Check out this YouTube video about what can you achieve by using Orchard Core and how you can use the Group Finder and let us know if you have any questions! News from the community RC2 branch If you navigate to the GitHub page of Orchard Core and check the issues, you will find one with the name RC2 Validation. There is a list that contains all the things that are needed to be done to ship RC2. Here you can find a branch that contains the list of to-dos to work on. In this checklist, you can find the items that needed to do when publishing a release. You can check this issue from time to time to monitor the current state of the RC2 release. New Orchard Nuggets posts A breadcrumb menu is a simple but effective navigation aid that shows the user where they are in the site's content structure and which path they can take back. It's also part of the web accessibility guidelines. However, there's no feature built into Orchard Core for this. Nevertheless, how to create a breadcrumb menu? It's actually really easy, just copy a piece of code from this brand new Orchard Nuggets post! Let's suppose you're building your shiny new Orchard Core website. In there you're also building a shiny new page, with Flow Part obviously. You throw together a lot of widgets to get all the bells and whistles on the page, then you save it and BAM! Internal Server Error: "InvalidDataException: Form value count limit 1024 exceeded." What's this, did I break Orchard? Is Orchard trying to break me? Let's find out how to fix this in the second Orchard Nuggets post of the week! This is Lombiq! Do you want to know the team behind all that we do at Lombiq Technologies? Here are all the faces, the whole Lombiq team. All the Orchard developers, leaders, office managers, hardware and software engineers, accountants, advisors! This is Lombiq. The two projects of ours mentioned in the video are DotNest, the Orchard SaaS (https://dotnest.com/), and Hastlayer, the .NET hardware accelerator (https://hastlayer.com/). Note that while we published this video during the coronavirus pandemic it was actually recorded during our 2019 RnDay event, in December 2019. Everyone was safe :). Orchard Core workshops The contributors of Orchard Core will hold some unique online workshops in the coming months, between May and September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. Lombiq's developers will also give two workshops, on using Orchard from the admin UI and on developing a module. Are you looking to get up to speed with Orchard? Check out the workshops' details on the Orchard Core homepage! Orchard Dojo Newsletter Now we have 142 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! 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!

How to fix "InvalidDataException: Form value count limit 1024 exceeded." in Orchard Core - Orchard Core Nuggets

Let's suppose you're building your shiny new Orchard Core website. In there you're also building a shiny new page, with Flow Part obviously. You throw together a lot of widgets to get all the bells and whistles on the page, then you save it and BAM! Internal Server Error: "InvalidDataException: Form value count limit 1024 exceeded." What's this, did I break Orchard? Is Orchard trying to break me? Let's fix this! The exception happens because the structure you've built with Flow Part is simply too large for the default ASP.NET Core limits. This is not something that would be too extreme to achieve, actually: If you have more complex widgets (with a lot of fields each) and you put several of them into a complex nested structure you can quite possibly build something by hand that would fail like this. Ask how I know! You can increase the limits restricting posted form value sizes, and in this particular case you'd need to change the ValueCountLimit value of FormOptions. Put this into the Startup class of your Orchard-based web app project (it won't work in a module or theme!): services.Configure This increased the limit to 4096, plenty more than the default. However, keep in mind that these limits have their uses: Malicious users could try to post large pieces of data to your server, trying to overwhelm it for example. So only increase this as much you only need! Note BTW that we're using the ASP.NET Core configuration API here, something which is also demonstrated in detail in our Training Demo Module, so follow up learning there! Did you like this post? It's part of our Orchard Core Nuggets series where we answer common Orchard questions, be it about user-facing features or developer-level issues. Check out the other posts for more such bite-sized Orchard Core tips and let us know if you have another question!

How to add a breadcrumb menu in Orchard Core - Orchard Core Nuggets

A breadcrumb menu is a simple but effective navigation aid that shows the user where they are in the site's content structure and which path they can take back. It's also part of the web accessibility guidelines. However, there's no feature built into Orchard Core for this. Nevertheless, how to create a breadcrumb menu? It's actually really easy, you just have to copy a piece of code from Orchard Dojo! Oh wait, we're Orchard Dojo. So here you go: @inject OrchardCore.ContentManagement.IContentAliasManager ContentAliasManager; @inject OrchardCore.ContentManagement.IContentManager ContentManager; @inject Microsoft.AspNetCore.Http.IHttpContextAccessor HttpContextAccessor; @using OrchardCore.ContentManagement; @using OrchardCore.Menu.Models; @{ // Retrieving the menu we want to build the breadcrum menu for, in this case the one with the alias "main-menu". var menu = await ContentManager.GetAsync(await ContentAliasManager.GetContentItemIdAsync("alias:main-menu")); // We'll need the current URL to be able to check which menu item corresponds to the page. var currentRelativeUrl = HttpContextAccessor.HttpContext.Request.Path; var breadcrumbItems = new Stack<ContentItem>(); // Building the path in the menu tree to the current item. bool SearchActiveItem(IEnumerable<ContentItem> menuItems) { if (menuItems == null) return false; // Note that for the sake of simplicity this will work only with Link Menu Items, not with Conten Menu Items. foreach (var menuItem in menuItems.Select(item => item.As<LinkMenuItemPart>()).Where(item => item != null)) { if (!string.IsNullOrEmpty(menuItem.Url)) { var url = menuItem.Url; if (url.StartsWith("~")) url = url.Substring(1); if (url.Equals(currentRelativeUrl, StringComparison.OrdinalIgnoreCase)) { breadcrumbItems.Push(menuItem.ContentItem); return true; } else { if (SearchActiveItem(menuItem.ContentItem.As<MenuItemsListPart>()?.MenuItems)) { breadcrumbItems.Push(menuItem.ContentItem); return true; } } } } return false; } SearchActiveItem(menu.As<MenuItemsListPart>().MenuItems); } @* Using the Bootstrap breadcrumb classes. *@ <ul class="breadcrumb"> <li class="breadcrumb-item"> <a href="@Url.Content("~/")">@T["Home"]</a> </li> @while (breadcrumbItems.TryPop(out var menuItem)) { var linkItem = menuItem.As<LinkMenuItemPart>(); <li class="breadcrumb-item"> <a href="@Url.Content(linkItem.Url)">@linkItem.Name</a> </li> } </ul> Wait, wait, slow a bit down. What is this? This is the code that would render a simple breadcrumb menu for the menu with the alias "main-menu". If you've set up your Orchard site with any of the built-in recipes you already should have such a menu. But do take a look at the code in detail, we have a lot of helpful comments in there! Once you're clear on what this piece of code does you can copy it somewhere in your theme to display it. For example, you can just put it into the Layout shape template. A cleaner approach would be to put it into its own separate template, like BreadcrumbMenu.cshtml, and display it in one of the many ways possible. Pretty much that's it! Now let's suppose you built e.g. a menu like this: With the above snippet you can have a breadcrumb menu like this when you open the Module Development page: This just uses the default Bootstrap breadcrumbs styling. And that's it, we're done with our breadcrumbs, enjoy! To be fair, this could use some work to make it bulletproof. We could e.g. optimize away the whole lookup when we're on the homepage. Then, it only supports only a single menu item for a given page. Nevertheless, it should get you going. If you'd like to see a generic and more advanced breadcrumb menu feature in Orchard check out this issue. Did you like this post? It's part of our Orchard Core Nuggets series where we answer common Orchard questions, be it about user-facing features or developer-level issues. Check out the other posts for more such bite-sized Orchard Core tips and let us know if you have another question!

Content Picker Menu Item, Kast case study - This week in Orchard (02/05/2020)

Soon you will able to show content items in your menu easily! How? Check our newest This week in Orchard post and read about an amazing demo to see the new Content Picker Menu Item in action! We published a brand new case study this week on our website about the latest Orchard Core site we developed. By reading that study you can see the possibilities that you can easily achieve by using Orchard Core as your CMS! Don't forget to read our whole post for the most interesting news around the community! Orchard Core updates Added ability to restrict widgets within a flow part You can use the FlowPartSettings to give content managers the capability to restrict which widgets are available within the flow editor. If no widgets have been selected then all widgets will be available, as per the current implementation. Let's see it quickly! Set up a site with the Blog recipe and then edit the content type definition of the Page content type. To do that navigate to Content -> Content Definition -> Content Types and choose the Page. Then find the attached parts and hit Edit near the Flow one. Here you can select which content types this flow can contain. Just for the sake of demonstration, we say that the Flow editor of this page can only accept Liquid widgets. Let's see what will happen when we create a new Page! Hit New -> Page and try to add something to the Flow editor. You will see that only the Liquid one will be on the list because in the previous step we only allowed Liquid widgets. So, when you attach a FlowPart now you can decide what content types you want to be able to use in a FlowPart. It can be useful if you create a form page type with a FlowPart for it. You could then decide just to allow for form widgets. Remember: if you don't select anything you will be able to use any type of content type with the Widget stereotype in your editor. Added support for IN (SELECT) SQL statements You can use a custom SQL statement, that is about to parse for the queries module, the one that uses the generic SQL language and that will be translated to any dialect that the CMS supports (PostgreSQL, MySQL, SQLite, Microsoft SQL Server). If you use this language now you can use the select expression inside an in statement. It's also supporting the not in correctly and the like and not like was not working well, so these are also fixed. Check the new InlineData attributes added to the ShouldParseExpression test method to see some examples with the new expression. Fix shape table providers There was an issue with the way you would be able to override a template from your module, override a template for a dependent module. This change will look for shape templates in a module for any first-level dependencies and it's also improving performance because there would be fewer shape templates loaded in the memory. And if you have a feature depending on another feature then it won't be able to override the second level feature, you have to depend on that. It makes sense because you are creating a template for the second level feature, so you can depend on that because you expected that it would be there. Deployment plans search Let's navigate to Configuration -> Import/Export and create one or more deployment plans. Here you can filter the deployment plans and also do bulk actions. To do bulk actions select two or more deployment plans and after that, you will see the Delete option in the Actions dropdown. Content culture picker shape documentation If you navigate to the Content Localization section in the Orchard Core documentation, you may have noticed that there were no Razor example codes. From now the documentation has been improved with Razor examples! Demos Content Picker Menu Item Let's set up a site with the Blog recipe, create a new Page, and call it My brand new page. Then choose the Main Menu option in the admin UI and hit the Add Menu Item button. Here you could see the Available Menu Items modal window with two options: Link Menu Item and Content Picker Menu Item. Let's choose the second one! The Content Picker Menu Item is about having the ability to choose from the content items available in the CMS with a content picker. There is the Selected ContentItem dropdown, that can be used to select the content item that you would like to show on the menu. You can type to search or just simply select your item from the list. We will select our newly created page here. Publish the menu and navigate to the homepage of your site to see your menu. We placed the new menu item after the About, but of course, it's your choice to set the position of your menu item. If you are interested in the full demo don't forget to watch the recording on YouTube! Note that this feature is under development and can be found in this branch! News from the community Orchard Nuggets: How to add a culture URL segment for localization in Orchard Core So you're building a localized Orchard Core site and want all URLs to be in the form of /culture-name/rest/of/the/url, e.g. /hu-HU/my-page. What do you need to achieve this? In our newest Orchard Nuggets post, we give you the answers! Check out the other posts for more such bite-sized Orchard tips and let us know if you'd have another question! Helping Kast build a multi-tenant platform on Orchard Core Kast is an Australian company and one of their primary goals is to implement the Kast platform with the Kast Group Finder component. We worked together with Seth Cleaver (Co-founder and Director of Kast) on this tool to be able to create an intuitive self-service process that enables people within a church to easily find a suitable group to attend, simplify the administrative processes required for getting people into groups, and provide information to the group co-ordinators that might assist in planning and measuring effectiveness. Check out this case study about how we've developed this multi-tenant social group management platform for churches! If you are interested in more websites using Orchard and Orchard Core, don't forget to visit Show Orchard. Show Orchard is a website for showing representative Orchard CMS (and now Orchard Core) websites all around the internet. It was started by Ryan Drew Burnett, but since he doesn't work with Orchard anymore, as announced earlier it is now maintained by our team at Lombiq Technologies. Orchard Core Training Demo module: combining ASP.NET Core Options with Orchard Core site settings Our Orchard Core Training Demo module has a new tutorial on combining ASP.NET Core Options with Orchard Core site settings. In the SiteSettingsController you could see how to use the Site Settings to access tenant-level settings and any other custom settings! Orchard Core Training Demo module is a demo Orchard Core 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 including the full source code - which is the recommended way. You can use it as part of a solution the uses Orchard Core NuGet packages, however, it's harder to look under the hood of Orchard Core features. The module assumes that you have a good understanding of basic Orchard concepts and that you can get around the Orchard admin area (the official documentation may help you with that). You should also be familiar with how to use Visual Studio and write C#, as well as the concepts of ASP.NET Core MVC. Bug reports, feature requests, and comments are warmly welcome, please do so via GitHub. Feel free to send pull requests too, no matter which source repository you choose for this purpose. Updated Lombiq Technologies logos You may have noticed that we rolled out our updated logo in the last few days. The spirit is the same: The lab flask with which we distill our IT solutions ("lombik" in Hungarian means lab flask :)). So, please welcome it! Orchard Core workshops The contributors of Orchard Core will hold some unique online workshops in the coming months, between May and September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. Lombiq's developers will also give two workshops, on using Orchard from the admin UI and on developing a module. Are you looking to get up to speed with Orchard? Check out the workshops' details on the Orchard Core homepage! Orchard Dojo Newsletter Now we have 140 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! 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!

How to add a culture URL segment for localization in Orchard Core - Orchard Core Nuggets

So you're building a localized Orchard Core site and want all URLs to be in the form of /culture-name/rest/of/the/url, e.g. /hu-HU/my-page. (Figure out what "hu-HU" is! Hint: It's not an owl, neither a rock band from Mongolia!) What do you need to achieve this? Well, we've already seen how to localize content items to achieve this, but that's just for content pages. There is one small piece missing though: How to get the same functionality for controller actions, i.e. coded pages? There is nothing built into Orchard Core for this, actually. And the reason is that all you need is available in ASP.NET Core MVC already. First, you'll need to set up RouteDataRequestCultureProvider so the URL segment indicating the culture will be used to set the culture of the current request. Just add this to your module's or theme's Startup class (if you don't yet know how to build a module, check out our Training Demo!): services.Configure So far so good. Next, you'll need the controller actions you want to be culture-aware to be routed in a way that the culture name is included in the URL: public class CultureAwareController : Controller { [Route("{culture}/culture-aware"] public ActionResult CultureAwareAction() { // Build the result here. } } So now you'll be able to reach this action from under /hu-HU/culture-aware for example. There's one final part missing: Building URLs for these actions. This is quite simple too, you'd e.g. create a link for this action like following: <a asp-action="CultureAwareAction" asp-controller="CultureAware" asp-area="CultureAwareModule" asp-all-route-data="routeParams">Click here</a> That's it! Of course, this can get more complex. You can make route configuration as well as URL generation easier by centralizing this culture parameter handling, which is useful if you have loads of such controllers and links. Did you like this post? It's part of our Orchard Core Nuggets series where we answer common Orchard questions, be it about user-facing features or developer-level issues. Check out the other posts for more such bite-sized Orchard Core tips and let us know if you have another question!

Click to deploy improvements, autoroute container routing - This week in Orchard (24/04/2020)

This week we continue the journey with the new upcoming feature of Orchard Core called Click to deploy. But before that, we will check out the new Liquid helpers, the contributors' page, and many more! Finally, don't forget to take a look at our newest Orchard Nuggets post and the improvements in our Orchard Core Training Demo module! Orchard Core updates Themes standardization It can be hard sometimes to keep all the themes updated with the latest changes and improvements of Orchard Core. Now in every theme, you can add a custom template for the title or can use the features of the built-in one. If you check the code of the PageTitle shape in the PageTitleShapes.cs file, you will see the usage of the LiquidTemplateManager that helps you to customize the way how you would like to render the title of your page. We wrote about how to customize the title in Liquid here: https://orcharddojo.net/blog/this-week-in-orchard-09-06-2019. And in some themes, the HeadMeta zone hasn't been used in the layout. Now you have the possibility to show the content of this zone in every theme and rendering this at the end of the head tag. In this case, you can add your custom CSS in this section and have the ability to override the styling of the theme that you are using. Let's check the layout.liquid file of the Coming Soon Theme for these changes. Contributors Orchard Core has more than 150 contributors! The repository of Orchard Core now contains a Contributors.md file, where you can find the profiles of the contributors. They can have different badges, based on the type of work. There are badges for answering questions, doing code reviews, writing blog posts, and so on. Autoroute container routing A few weeks ago we wrote about the new settings of the Autoroute part: Allow contained item routing: Check to allow users to enable routing of child content items. Manage contained item routes: Check to allow this part to apply routes to child content items. Allow absolute path: Check to allow users to enable absolute paths for child content items If you prefer videos you can also find a demo about this feature on YouTube. And now the huge PR that contains this feature is merged in the dev branch of Orchard Core! Would you like to try this out yourself? Use the latest changes of dev branch now by adding this OrchardCore-preview MyGet URL to your NuGet sources: https://www.myget.org/F/orchardcore-preview/api/v3/index.json as it described here. Thanks for this great feature for Dean Marcussen! Add support for DictionaryAttributePrefix and ModelExplorer property in Liquid You can find an OrchardCore.Demo module in the source of Orchard Core. The goal of this project is to show you the different features of Orchard Core by providing great sample codes. This project has been updated with the latest Liquid helpers. If you open the TodoController.cs in the module, you will find the endpoints of a simple To-do app. But that's not the interesting part. There are 4 related Liquid files in the module. Two in the Todo folder in the Views called Edit.liquid and Index.liquid and two in the root of the Views folder called Todo.Edit.liquid and Todo.liquid. Here comes the content of the Index.liquid file. Here you can see a simple table contains the to-do items. But after the table, there is a button that navigates the users to a page where they can create new to-do items. You can see the block Liquid helper here and the way about how to set the route values for the button. So, if you click on that button you will be navigated to the Create action of the TodoController, that is about to render the Todo.Edit.liquid shape. Here you can also find several new helpers. The form helper is about to render a form and the helper Liquid helper is invoke the input tag helper of ASP.NET Core and binds Text of the Model. If you check the rendered page of the Todo.Edit.liquid file you will see the form that is used to create new to-do items. Every new Liquid helper (form, input, label, validation_summary, validation_for, span) can be found in the Orchard Core documentation. Add icons to Configuration Settings menus When you navigate to the admin UI of Orchard Core and check the root menu items in the navigation bar, you could see that these items have icons. From now, some submenu items are just about to show you some icons too. Head to Configuration -> Settings or Security to see the new ones. Demos Click to deploy improvements If you haven't seen the demo about the upcoming feature called Click to deploy yet, head to YouTube to watch the recording or check out the previous This week in Orchard post because this will be the continuation of the Click to deploy feature. First, navigate to Configuration -> Features and enable the three new features: Add Content to Deployment PLan Click to Deploy Content View or Export Content as JSON Now head to the content items list (Content -> Content Items) and hit the Actions button to open the dropdown. You can see that the context menu is now getting a lot more items. The Export to Deployment Target is about to automatically create a custom recipe file that can be downloaded locally or send it to a remote instance. You can use the Available Targets modal to select the destination. The Add to Deployment Plan is about to add a new content item step using this content item to an existing deployment plan. In this case, a new modal window will open again that lets you choose from the available deployment plans. The Export as JSON is about to directly download the recipe to your computer locally and the View as JSON is a very helpful feature because as you could see in the screen below it shows you the JSON representation of the content item. The same JSON will go to the content step of the recipe when you are hitting the Export as JSON button. Here you have the availability to copy the JSON structure by clicking on the copy icon at the top-right corner of the page. If you are interested in the full demo don't forget to watch the recording on YouTube! Note that this feature is under development and can be found in this branch! News from the community Orchard Core Training Demo module: creating a widget from code We have just added some lines to our Orchard Core Training Demo module to show you the way about creating a new widget from code. In the PersonMigration.cs file we defined a PersonPart, an index table for this part, a Person content type, and from now a PersonWidget. Orchard Core Training Demo module is a demo Orchard Core 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 including the full source code - which is the recommended way. You can use it as part of a solution the uses Orchard Core NuGet packages, however, it's harder to look under the hood of Orchard Core features. The module assumes that you have a good understanding of basic Orchard concepts and that you can get around the Orchard admin area (the official documentation may help you with that). You should also be familiar with how to use Visual Studio and write C#, as well as the concepts of ASP.NET Core MVC. Bug reports, feature requests, and comments are warmly welcome, please do so via GitHub. Feel free to send pull requests too, no matter which source repository you choose for this purpose. Orchard Nuggets: How to add a favicon under /favicon.ico in Orchard Core Every website needs a favicon of course and you can easily add one to your Orchard Core site from a theme or module with a link tag in a template. However, there's a catch: Certain browsers will still search for it (as a first attempt) under the path /favicon.ico. This can be a tiny bit detrimental to the client-side performance, and show up as annoying errors in your logs. So what can you do to serve a favicon under that path too? In our newest Orchard Nuggets post, we give you the answers! Check out the other posts for more such bite-sized Orchard tips and let us know if you'd have another question! Orchard Core workshops The contributors of Orchard Core will hold some unique online workshops in the coming months, between May and September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. Lombiq's developers will also give two workshops, on using Orchard from the admin UI and on developing a module. Are you looking to get up to speed with Orchard? Check out the workshops' details on the Orchard Core homepage! Orchard Dojo Newsletter Now we have 139 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! 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!

How to add a favicon under /favicon.ico in Orchard Core - Orchard Core Nuggets

Every website needs a favicon of course and you can easily add one to your Orchard Core site from a theme or module with a link tag in a template. However, there's a catch: Certain browsers will still search for it (as a first attempt) under the path /favicon.ico. This can be a tiny bit detrimental to the client-side performance, and show up as annoying errors in your logs. So what can you do to serve a favicon under that path too? You could do e.g. the following: Add an actual file to your web project's wwwroot folder directly. This will work but you'll most likely have more than one icon for the site, and you'll keep them in a theme. So having two places with icons is less than ideal. Serve the same file that you have in your theme with a middleware or something. Doable but you'd teach the affected browsers that what they're doing is actually acceptable :). Redirect a /favicon.ico request to the actual favicon. This is what we'll do with the code snippet below! Open up your theme's Startup class and add this to its Configure() method (or add the method first if you haven't used it otherwise): public override void Configure(IApplicationBuilder app, IEndpointRouteBuilder routes, IServiceProvider serviceProvider) => app.Map("/favicon.ico", appBuilder => appBuilder.Run(context => { context.Response.Redirect("/My.Theme/favicon.ico", true); return Task.CompletedTask; })); As you can see this simple snippet will listen on the /favicon.ico path and redirect the client to the favicon you have in your theme (in this case we assumed it's in the root of your theme's wwwroot folder but of course it can be in any subfolder). Very simple! Did you like this post? It's part of our Orchard Core Nuggets series where we answer common Orchard questions, be it about user-facing features or developer-level issues. Check out the other posts for more such bite-sized Orchard Core tips and let us know if you have another question!