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 >

User Impersonation, Export Content To Deployment Target - This week in Orchard (07/08/2020)

This week we are gonna show you three brand new features that are recently added to Orchard Core: the Add Content To Deployment Plan, the Export Content To Deployment Target, and View Or Download Content As JSON features. After we see a demo about user impersonation and finally we solve the mystery about what is GitHub Arctic Code Vault? Orchard Core updates Add Content To Deployment Plan, Export Content To Deployment Target, and View Or Download Content As JSON features Set up your site using the Blog recipe. Now you can head to Configuration -> Features and enable the Add Content To Deployment Plan, Export Content To Deployment Target, and View Or Download Content As JSON features. This will bring you several new stuff that you can use when you are managing the content items. If you click on the Actions button 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 Download 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 Download 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. And don't forget that you can find two demos on YouTube about this feature. Click here for the Click to deploy demo and here to see the second part of the demo! Add authentication checks to some ISite drivers We had some drivers in Orchard Core where we hadn't check that the user has the appropriate permissions to modify the changes of given settings because the controllers won't do that for us. For example, if the user would like to change the settings of the reCAPTCHA, then we have to make sure that the user has the ManageReCaptchaSettings permission to do that. Now, these missings checks are added to the code. Fixing Linux setup by making sure a directory created before creating a file Let's say you would like to host your Orchard Core site in a Linux environment. But unfortunately, the setup failed on installation from Docker-Linux container. The strange issue was a directory needed to be created before file creation. Navigate to the SaveContentDefinitionAsync method of the FileContentDefinitionStore to see the check for the directory. Document HTML Sanitizer and Markdown Pipeline Options An HTML Sanitizer is available as part of the Orchard Core Infrastructure. The Sanitizer cleans user input that could lead to XSS attacks. From now you will find a new page in the Orchard Core Documentation about how to use the Sanitizer in your Razor view, how to configure the Sanitizer in the Startup classes, and much more. Markdown output is also sanitized during the rendering of content with Display Management. This page contains new sections about how to enable/disable or configure the Markdown Sanitization using the MarkdownPipelineOptions. Demos User impersonation Open GitHub in your browser and navigate to the OrchardCoreContrib.Modules repository. This repository contains a set of modules for Orchard Core CMS driven by the community members who love Orchard Core. Here we will focus on the one called Impersonation. That feature allows administrators to sign in with other user identities. To try this out, let's clone or download this repository then set up your site using a chosen recipe. After, navigate to Configuration -> Features and enable the Impersonation feature. To try out the impersonation, we need to have multiple users in the system. Go to Security -> Users and click on the Add User button to add a new one. In this case, we created a new user with the Author role with the author user name. In the users list, you will find a new green button called Impersonate. Here the Impersonate button is disabled for the admin user because we have already signed in with that user. So, click on that button near the user named author and see what will happen! You could notice a slightly changed admin UI in this case. The reason for that is quite simple: users with the Author role have access to the admin UI with some content and media library-related permissions. So in that case you can do and you can see what this exact user can see and can do in that site. It's a good way to for example test the permissions and the rights for that user. If you would like to end the impersonation and return your work using your account, you can just simply have to navigate to Security -> End Impersonation, that will do the trick for you. If you are interested in the full demo, head to YouTube for the recording! News from the community Orchard Core on GitHub Arctic Code Vault The GitHub Arctic Code Vault is a data repository preserved in the Arctic World Archive (AWA), a very-long-term archival facility 250 meters deep in the permafrost of an Arctic mountain. The archive is located in a decommissioned coal mine in the Svalbard archipelago, closer to the North Pole than the Arctic Circle. GitHub captured a snapshot of every active public repository on 02/02/2020 and preserved that data in the Arctic Code Vault. And why it is important? Because Orchard Core also sits in this Code Vault! If you have contributed a repository that is in the Code Vault you will see that in your GitHub profile! Check out this exciting video about the GitHub Arctic Code Vault! Lombiq Offline event Sometimes it's not just about work but doing something just for fun. These events are specifically for this: we get together, do something cool like breaking out of an escape room, going for a go-kart ride, or playing paintball. A few days ago we went hiking then we went back to Budapest in a boat. Check out this new picture of our team, shot at our Lombiq Offline event! While here in Hungary there are no restrictions on events like this anymore, we played it safe with a fully outdoor program. You can find this new picture on our About us page too! Orchard Core workshops The contributors of Orchard Core will hold some unique online workshops in September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. 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 156 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!

Shortcodes, Audit Trail - This week in Orchard (31/07/2020)

This week we show you two demos of the brand new upcoming features of Orchard Core! The first one is the Shortcodes feature, that allows text content editors to inject specialized content blocks using custom arguments, like images, twitter embeds, youtube videos, only with simple blocks like [video 123]. The Audit Trail module provides log records for creation, deletion of any Content Type, and events like user events, as you may see it Orchard 1.x. Heads up for a post full of demos! Orchard Core updates Add user deleted event In the OrchardCore.Users.Handlers.IUserEventHandler there was no contract for the user deleted event. From now there is the new DeletedAsync method that is invoked if a user has been deleted. Check out the code in the UserStore.cs file, where you can see the invoking of the new method. This new event is also accessible from your workflow type. If you create a new workflow type and click on the Add Event button, you will find the User Deleted event in the User category. Admin CSS/Bootstrap regressions Back in Bootstrap 3, col-lg means nothing, so we had some special CSS in the admin theme to make it mean something. In Bootstrap 4, the col-* now means something, because here you have auto-sizing columns. It's still not exactly ideal because there is a lot of variation for the sizes. You can see the new names here to make them more meaningful. These are the new classes in the TheAdmin.scss file. Demos Shortcodes Sébastien Ros created a new open-source project called Shortcodes. This is a .NET library to parse and evaluate shortcodes. It allows text content editors to inject specialized content blocks using custom arguments, like images, twitter embeds, youtube videos, only with simple blocks like [video 123]. Shortcodes are essential to WordPress, and for the Orchard Core, we wanted a similar feature. The parser was written by hand as the syntax is simple and it needs to be efficient. Thanks to Dean Marcussen, this library will be integrated into Orchard Core soon. In this demo, we will see what we can do in Orchard Core using that library! Let's say you installed your site using the Blog recipe. Make sure that the Shortcodes feature is enabled. When you are editing a content item with a WYSIWYG HTML editor (for example the HtmlBody Part of the Article content type or a content type with a MarkdownBody Part) you can get a little pop-up if you are clicking on the Insert Shortcode button near the Link button by default. The pop-up will contain a list of the available shortcodes. Let's try the one called bold now. As you may guess, this shortcode is about to make your text bold. Select it from the list and provide the text that you would like to appear as bold. Note that here we used the [bold "bold text"] syntax when made the text bold. That works, because if you check the definition of the bold shortcode, you could see that we get the value of the text using the args.NamedOrDefault method. If we don't use the text named argument to pass the value of the content that we want to make bold, then it will just simply use the default one, meaning that it will use the content without any argument. So, if you are using the syntax [bold text="bold text"] you will get the same result. But the bold shortcode is also supporting content arguments. It means shortcodes using opening and closing tags can access their inner content. If you would like to use content arguments you can do something like [bold]bold text[/bold]. It will work because if the value of the text is null we will just use the value of the content variable that is the text between the opening and closing tags. Now let's see something else! If you navigate to Design in the admin UI, you will find a new option called Shortcode Templates! Let's see what a Shortcode Template is! Here you have the ability to actually write shortcodes in Liquid. Create a new one and call it Primary! This is about checking if your shortcode has something in the argument called text. If yes, we use the value of the text argument, if not, we are about to work with the content argument. The shortcode wraps the text in a span and adds the text-primary class to it. In this case, you can use this shortcode as you could see in the case of the shortcode called bold. But you also have the option to override the shortcodes that are implemented from code. In that case, you just need to call your shortcode template bold, and that will replace the existing one that has been written in code. If you would like to know more about shortcodes, don't forget to check out the demo on YouTube! Audit Trail Let's install your site using the Blog recipe. Then head to Configuration -> Features and enable the Audit Trail module. After you will see a new option in the menu of the admin UI called Audit Trail. The Audit Trail module provides log records for creation, deletion of any content type, and events like user events. So, let's do some content modification to see how you can use the Audit Trail feature! Navigate to New -> Article and publish a new Article content item with some data. Now edit some data in your newly created article and hit Publish again! Now navigate to the Audit Trail option on the menu and see the new records in the table. The audit trail table provides you with filtering and with pagination to be able to easily find the audit trail event that you are looking for. You can filter by a given date range, categories (All categories, Content Item, User), the user name of the user who caused the event to occur. Every record of the table can have a view in the Summary column. A record with the Content Item category shows you the version of the content item at the moment of recording. If you click on the Version X link you can see the read-only editor of the content item filled with the values that the content item has at that version. If you click on the display text of the content item you can edit the content item. Here you will see four recorded events regarding the changes that we have just made in the case of our article. The first one is about showing you the fact that we created the first version of the Article content type with the display text My new article. The second is about telling you that you clicked on the Publish button, that means you published that article. After you will see a Saved event. If you publish a new version of the article, Orchard Core first saves a new version of it (it also creates a new draft version), then publishes it. You can also see that now we have two different kinds of versions of this article. Now let's see what we have just changed in that article. To do that, click on the Details link of the Saved event. Here you can get more information about the given event. When you are checking the Detail view of a Content Item event you can see a table that contains the differences between the current version of the content item and the previous version of the content item in the Diff column. The values of the current content item will be shown in green, and the values of the previous content item will be shown here in red. You can show/hide this column using the Show diff switch. If you turn the Show before/after switch on, you will see two new columns: Before and After. These are about to show you the values of the properties of the previous version of the content item and the values of the properties of the current version of the content item. Here you can see we changed the Subtitle Text Field and the Html value of the HtmlBody Part of the article. If you navigate back to the audit trail table and check out the first Published event of the article content item, you will also see a new link here called Restore. If you click on this link, Orchard Core will create a new draft instance of the selected content item version. You can also restore the removed content items too. You can attach the AuditTrailPart content part to your content type that allows content editors to enter a comment to be saved into the audit trail event when saving a content item. This comment will be shown in the Comment column of the audit trail table. If you navigate to Configuration -> Settings -> Audit Trail you will find a list that contains every event that can you record using the Audit Trail module. Here you can enable or disable the recording of the given events. You can also enable client IP address logging. When you enable that, the client IP address will be recorded in audit trail event records. If you click on the Set blacklisted content types button you will see a new modal window with all of the defined content types in your system. Here you can select the content types that you don't want to log using the Audit Trail. For example, if you don't want to log the changes of the Article content items, then you may put a tick of the checkbox of the Article content type. The Trimming Settings is about to say how long you would like to keep the audit trail logs in the database. You can disable trimming if you would like to keep the records. And that's not the whole demo! If you are interested in the upcoming Audit Trail feature of Orchard Core, head to YouTube and check out the recording! News from the community A new website using Orchard Core Singapore is the third international country outside North America to introduce Starbucks to its discerning customers who readily embrace the Starbucks Experience. And they used Orchard Core to build the website for Starbucks Singapore! 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 workshops The contributors of Orchard Core will hold some unique online workshops in September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. 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 154 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!

Export contents as setup recipe, Shape Debug Mode to dynamic cache - This week in Orchard (24/07/2020)

Export contents as setup recipe and import recipe from JSON are about to make it easier to manipulate data and setup your Orchard Core site. Edit cached shapes using the Shape Debug mode to see your changes right away. We think if you are an Orchard Core developer, you will find these features very useful. These are the bigger topics for this week! Orchard Core updates Export Contents As Setup recipe This is a new feature that allows you to use a checkbox when you want to export some content and remove any information that would reuse properties like the content item ID, author, owner. Let's see an example for this and create a deployment plant that contains only that All content deployment step and see the JSON schema of the Blog content item that you can get if you install your site using the Blog recipe. So, if you leave this checkbox unchecked, you will see the following content. Nothing special here, you see the same content as you saw before. The content item has an ID, a version ID, and the dates when this content item was published and modified. But let's see what will happen if we put a tick in that checkbox! In this case, all the IDs are regenerated (for now it's not the case for the contained content items) and the values for the owner and the author are coming from the AdminUsername parameter. But be aware of the note that you can read under the checkbox: If checked, you will have to manually declare variables for the Content Picker fields, Taxonomy fields, Tags fields, and List item ids and replace them where needed in the recipe. Any reference to these content items will be lost. And the logic in the ContentDeploymentSource is about checking the value of the ExportAsSetupRecipe boolean property. If you want to export contents as a setup recipe, then the related properties of the objectData will be changed as you can see in the recipe file. We have to mention one new thing here. If you add the All features deployment step to your plan that exports the state of all features, you can say to ignore the disabled features. In that case, your recipe will only contain the enabled features and not the disabled ones. Import Recipe from JSON If you navigate to Configuration -> Import/Export in the admin UI, you will see a new option called JSON Import. This new feature will let you type some JSON and then run it, so you can execute some custom recipe steps from this UI. This new edition comes with the Deployment feature and it's using permission which is the Import permission. Let's say you want to change the site theme of your site for the default one. To do that you can use the following JSON. You can see you can do it in the same way as you would do it in a recipe file. Fix modules referencing other modules You may notice how many modules are referencing other modules for no need. Mostly this is just because they are doing so to get transitive references. The solution was to take direct references on the required abstractions/core projects instead of transitively depending on other modules to provide those references. Dean Marcussen also reviewed other references, removed superfluous references, and ordered them all. Migrate the OpenID module to OpenIddict 3.0 OpenIddict 3.0 has matured enough to envision using it in Orchard Core 1.0 RTM for both the server and validation features. As part of this migration, a few properties will be added to OpenIdServerSettings and OpenIdValidationSettings and others will be renamed for clarity. Due to this change, existing deployments will have to be updated to use the revamped settings. No exception should be thrown and the migration should be limited to re-configuring the server/validation options using the UI and/or updating custom recipes to use the new names. An important aspect of this migration is that the validation feature will now internally use the OpenIddict validation handler instead of the Microsoft JWT bearer handler, even with external OAuth 2.0 authorization servers. Unlike the MSFT JWT handler, the OpenIddict validation handler uses the new Microsoft.IdentityModel.JsonWebTokens stack and comes with JWT token type validation enforced by default, which is required by the not-yet-standardized JWT access token specification. This change will break existing deployments targeting OAuth 2.0 authorization servers that don't issue "typ": "at+jwt" access tokens. At least the following implementations are known to be impacted: Azure AD/B2C. IdentityServer3.IdentityServer4, except its latest 4.0 version (unless 4.0 is configured to use a different typ header) OpenIddict-based deployments are not impacted, as the validation handler includes special logic to deal with the tokens produced by OpenIddict 1.0 and 2.0, whose JWT tokens always include a special token_usage claim to prevent token substitution attacks, which has the same purpose as the "typ": "at+jwt" header. To ensure the validation feature can still be used with servers that don't issue "typ": "at+jwt" access tokens, an opt-in option was added to the validation configuration UI. This option can only be enabled when configuring a remote OAuth 2.0 server and is not shown when using a local OpenID server or a server located in another tenant, as OpenIddict 3.0 always issue "typ": "at+jwt" access tokens. Demos Shape Debug Mode to Dynamic Cache If you have a lot of menu shapes in your site and if you want to edit the templates you can't do that easily because the items are cached. The solution here is to provide an easy way to disable the cache, so in that case, the menus will not be cached. To set the cache mode, head to Configuration -> Settings -> General, where you will find a new tab called Cache. The settings here are very similar to the resource settings, the default is that the cache would be enabled in production and disabled otherwise. You can say I want to enable or disable it all the time. And there is a very useful option called Enabled with cache debug mode. Let's select this one and see what will happen! Now navigate to the homepage of your site and view the page source. Everywhere where is a cached block you will get a little piece of information about the given block. It shows you the cache ID, the dependencies that it's using, how long it's cached for, and any of the variations that are present. You will also see where is the end of the block. Let's see how it works! You will find a CacheStatement class that is about to check the value of the cacheOptions.DebugMode and if it's true, then it will add the additional content to the source of the page. If you are interested in more details about the cache settings, head to YouTube, and see the recording of the demo! News from the community Orchard Core workshops The contributors of Orchard Core will hold some unique online workshops in September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. 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 154 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!

Generic Site Settings Deployment Step, Extensible filters for contents admin list - This week in Orchard (17/07/2020)

The community has just released RC 2 a few weeks ago, but ever since Orchard Core has got several new features. This week among others we are going to see the extensible filters for contents admin list and the generic site settings deployment step. Orchard Core updates New column to the media library table view Enter the dashboard of your Orchard Core site and navigate to Content -> Media Library. Here you can view the uploaded files in a list view and in a grid view. You can switch between them using the little icons on the left side of the Filter textbox. If you view the files using the list view you will see a new column called LastModify. You can also sort the items by clicking on the header of the LastModify column. Extensible filters for contents admin list You can extend what filters are available in the contents admin list and each module can provide their own filters. Let's see this feature closely! First, install your site using the Blog recipe. Now, head to Configuration -> Features and enable the Taxonomies Contents List Filters and the Content Localization modules. The Content Localization is about to provide a part that allows localizing content items. The Taxonomies Contents List Filters feature is adding a new option under Configuration -> Settings -> Taxonomy Filters where you can select the taxonomies to filters in the contents list. As you can see, the Blog recipe comes with two predefined taxonomies: Tags and Categories. Let's select both ones. Now, head to Content -> Content Items, where you could see three new drop-downs. Categories and Tags can be used to filter by the values of the Category and the Tag Term content type. Just for the sake of demonstration make the Blog Post content type listable to see the Blog Post content items in the content items list. After if you select to filter for the content items that have the Earth tag, you will see the default one, because that post has each of these three existing posts. And you can easily add your own filters for the content items list! Without going into the details you have to add a new driver by implementing the DisplayDriver<ContentOptionsViewModel> abstract class and implement the IContentsAdminListFilter interface where you can provide the logic for filtering - modify the query (IQuery<ContentItem>) - content items. Check the TaxonomyContentsAdminListDisplayDriver.cs and the TaxonomyContentsAdminListFilter.cs files to see good examples about how to create your own filters. There was a demo about the new content filters and in the case, if you haven't seen it yet, you can watch the recording here. Demo videos in docs From time to time, the members of the community will do demos to show the latest features and improvements of the CMS. These videos are very helpful if you would like to learn a given topic (for example how to create Custom Settings using the admin UI) and you prefer videos. Now every topic in the documentation of Orchard Core containing the recording that is about showing you how to use the given feature. If we stay at the same example we will see the video at the bottom of the Custom Settings page. Add and implement IsJson() string extension method We are sure that you will meet some code in the future that is using JSON in their editor templates and you want to/need to validate that the text supplied in the editor is valid JSON. Now you can find a string extension method called IsJson() in the OrchardCore.Mvc.Utilities classes to do this. Demos Generic Site Settings Deployment Step When you navigate to the GitHub page of Orchard Core and list the open issues you will find one that is about listing the missing deployment steps, which means some settings do not have a deployment step to import and export them. The goal here is to be able to import/export every setting. For that, we have to get familiar with the notion of Generic Site Settings Deployment Step. You will find a new class library called OrchardCore.Settings.Core, where is a folder named Deployment that is containing logic to add site settings to a DeploymentPlanResult, a generic display driver that is responsible for the UI of the deployment plan and many more. Feel free to discover the content of this project! Now let's jump to the OrchardCore.Admin module. If you want to handle the custom settings via the OrchardCore.Settings.Core library, don't forget to reference it in your project. If you do that you can easily import/export the settings in your deployment plan. There is a class called AdminSettings in the OrchardCore.Admin module that contains one DisplayMenuFilter boolean property. Let's make it importable/exportable! Head to the Startup.cs file of the module and check out the DeploymentStartup class of it. Here you can see how you can use the provided generic business logic from the OrchardCore.Settings.Core project. You can see that we created a new deployment plan with the name: Admin settings and the description: Exports the admin settings by just passing these localized strings to the SiteSettingsPropertyDeploymentStepDriver. That's an easy and generic way to implement a deployment plan for your settings in your module! If you would like to know more about the generic site settings deployment step, head to YouTube! News from the community Intensive Orchard Core training for the In Motion team We had the opportunity to provide a five-day intensive Orchard Core training for the In Motion team! Read our post to know more details about the training! Orchard Core workshops The contributors of Orchard Core will hold some unique online workshops in September 2020. So even with Orchard Harvest postponed due to the coronavirus pandemic we'll get some new learning events. 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 152 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!

Tabs, Cards, and Columns for the Admin, RenderTitle option - This week in Orchard (03/07/2020)

Heads up, several improvements coming this week! Editor shapes now support grouping placement, which allows you to group editor shapes, to create a variety of content editor layouts. The Title Part now has a Render Title option to show or hide the value of the Title. And last week we did an Orchard Core workshop about module development. Check out our current post for more! Orchard Core updates TitlePart with RenderTitle option and Placement for Form, Label Let's say you set up your site using the Blog recipe and want to edit the content definition of the Blog Post. If you edit the definition of the attached Title Part, you will find a new option that you can use called Render Title. With this option, you can enable or disable rendering the value of the Title Part in Detail and Summary display types. The Blog recipe using the TheBlogTheme by default where we override the content of the Blog Post (Content-BlogPost.liquid) and displaying the DisplayText of the content item whether the Render Title option is on or off. So, to see this in action we should use a theme where there is no override for the Blog Post content items. Let's navigate to Design -> Themes and make the Default Theme as the current for now. After that, you will be able to see the differences. The upper window here is about to render the title, but under that, you can see the default blog post without displaying the value of the title. We have some content types where is no need to display the title by default. These types are the Form and the Label. If you check the migration of the Label for example you will see how you can use the TitlePartSettings to hide the title by default. Fix jsonparse Liquid filter to supports arrays The jsonparse Liquid filter converts a JSON string to a JObject. This can be useful to build collections and iterate over the values in Liquid. Now, this filter is about to support arrays. To do that the community had to use the JToken.Parse method instead of the JObject.Parse one as you can see in the JsonParseFilter class. Add menu display text (differentiator) classes to menu shapes When using multiple menus on a site it is possible to do a lot of the styling with CSS, which can avoid having many, many templates. Now Orchard Core will add the menu differentiator (which is calculated from the display text) as an additional class on the menu. So out of the box, you will get: class="menu menu-main-menu". Demos Tabs, Cards, and Columns for the Admin We are able to use placement to move some of the fields/parts into a tab in the admin area. The new thing is now you can use Bootsrap Collape to organize your content into cards. And now you can also move fields into columns, in that case, you can have a Media Field near to the HTML Body Part for example. But after this intro let's go deeper and see some examples of placement. Modifier for tabs remains #, but now supports ; before as a position modifier for the tab grouping. Modifier for cards is %, also supports ; as a position modifier. Modifier for columns is |, supports ;, and _ as a column modifier, _9 will be applied as col-md-9 automatically, or _lg-9 which will be applied as col-lg-9. _9 should be sufficient for most, as it will by default break at md. ; must be immediately after , whereas : is the shape placement, and applies anywhere in the placement string. So, in nutshell the normal tab modifier is a #, the card modifier is a %, and the column modifier is a |. The column has a name and another modifier that allows you to say how big you want the column to be. Now try out these in your Orchard Core site! We will use the Orchard Core source to set up a site and we will modify the content of the placement.json file in the OrchardCore.Contents module. In the following example we place the MediaField_Edit shape in a tab called Media, and position the Media tab first, and the Content tab second. The Html Field goes first in the Content tab and the rest goes under the Html Field. Let's play with this a little bit more! Now we place the MediaField_Edit shape in a card called Media, and position the Media card first, and the Content card second. And lastly, we are playing a little bit with the columns. In the following example we place the MediaField_Edit shape in a column called Media, and position the Media column first, and the Content column second. We also specify that the Content column will take 9 columns, of the default 12 column grid. By default, the columns will break responsively at the md breakpoint, and a modifier will be parsed to col-md-9. If you want to change the breakpoint, you could also specify Content_lg-9, which is parsed to col-lg-9. If you want to know more check out the official documentation and don't forget to watch the video about the new features of the placement! News from the community Orchard Core RC 2 on ASP.NET Blog You can find a new blog post in the ASP.NET Blog that telling you the Orchard Core Release Candidate 2 now available! In this post you will learn how to create an Orchard CMS website using the templates, you will see the notable improvements and you can check out the development plan of Orchard Core! Module Development - Orchard Core Workshop 4 We had some great crowd at the Orchard Core module development workshop on Saturday, thanks all for coming! Would you like to attend a workshop too? Other community members will hold ones soon: https://orchardcore.net/workshops. Are you interested in something else? Leave a comment below! Orchard Dojo Newsletter Now we have 151 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! There will be no This week in Orchard post next week because of vacation, so see you in two weeks!

CodeMirror improvements, 100th This week in Orchard - This week in Orchard (26/06/2020)

The 100th This week in Orchard is here! In this post you could see a great demo about the CodeMirror improvements, we mention the updated Send Email activity, the new sample in our Orchard Core Training demo module about how to do unit testing, and many more! Thanks for joining us for the 100th time! Orchard Core updates Add Reply-To Header to Workflow EmailTask activity When you send an email to a subscriber and they click Reply, the reply message is typically sent to the email address listed in the From: header. A Reply-To address is identified by inserting the Reply-To header in your email. It is the email address that the reply message is sent when you want the reply to go to an email address that is different than the From: address. If you want to configure the Reply-To header in your EmailTask activity now you can do it! Just add the Send Email task to your workflow and use the updated editor of the activity! Allows ZoneShapes to be overridden If you were trying to override the ContentZone implementation in ZoneShapes.cs to get some different behavior for some tabbed shapes, it won't work, because it was not attributed with [Feature(Application.DefaultFeatureId)]. Just a note here: the [Application.DefaultFeatureId] attribute is used to allow core shapes to be overridden. Demos CodeMirror improvements CodeMirror in Orchard Core was a little bit outdated because it was not updated from quite a long time ago. All the views in Orchard Core have been changed that is using CodeMirror and now there is a new style called codemirror that is registered in the ResourceManifest.cs of the OrchardCore.Resources module. And that's not all, here you can see several other add-ons that are included by default. Here you can see the content of the TextField-CodeMirror.Edit.cshtml file. But let's see in action what can you do with these add-ons! When you are using HTML, you will have auto-close for the tags. If your text is too long, it will wrap the lines and the currently active line is being highlighted. And these features are provided by the newly added CodeMirror plugins. In this GIF you can see a Text Field and an HTML Field. We set the editor option to Code Mirror for the Text Field and Standard for the HTML Field. And as you could saw in the code above, you can turn on or off these features just by setting the values of the editor. If you don't want to have an auto-close tags feature, just simply say autoCloseTags: false. If you want to know more about the CodeMirror improvements, don't forget to check this recording on YouTube! News from the community Unit Testing in the Lombiq Training Demo for Orchard Core We added a new service and tests to it to learn a bit of unit testing! First, we'll create a service that we'll then later test in a test project. This service won't be used anywhere else, it's just an example to be tested. Why a service? Services are where usually most of the complex logic of an Orchard-based web app goes. You can test anything as long as you've written it in a testable way (by, for example, not utilizing hidden dependencies but injecting them all), you can write tests for controllers, drivers, background tasks, you name it. However, we think that unless you're aiming for 100% test coverage it's best to focus your unit and integration testing efforts on services. Then, the rest of the app can further automatically be tested via e.g. UI tests. Check out the service that will be tested here and here come the tests for it! This week in Orchard for the 100th time! We started our This week in Orchard series to inform our readers with the latest news and improvements around Orchard 1.x and Orchard Core. In this series we try to cover the most important features of the CMS and of course from time to time we are looking under the hood and show you the different code changes. But this series is not just for developers. We also want to target the super users of Orchard Core to know and be able to use every feature of it by learning the usage of the admin UI. Last year we started to upload Orchard Core demos in separate videos from the weekly podcasts to be able to find the given feature that you are really interested in as quickly as possible. We have also created a playlist for it on YouTube that contains more than 30 videos for now! And don't forget our Orchard Nuggets series that we have started in December last year! In that series, we answer common Orchard questions, be it about user-facing features or developer-level issues. Check out these posts for bite-sized Orchard tips and let us know if you'd have any questions! We hope that you like our series and find it useful! Thanks for reading us! 4000 stars on GitHub In GitHub, you can star repositories and topics to keep track of projects you find interesting and discover related content in your news feed. Starring a repository also shows appreciation to the repository maintainer for their work. Many of GitHub's repository rankings depend on the number of stars a repository has. And we are proud to present that on June 22, the Orchard Core repository reached 4000 stars and it's still growing! Congratulations on the community! Using the admin UI of Orchard Core - Orchard Core Workshop 3 Last Saturday we did a workshop with 11 attendees about how to use the admin UI of Orchard Core! This Saturday we are gonna show you how to develop 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 151 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!

Orchard Core RC 2 release, Visual Studio code snippets - This week in Orchard (20/06/2020)

We are thrilled to announce that Orchard Core RC 2 is now available! Check out this post to know everything about the latest release of Orchard Core. This week we will also show you a great demo about the brand new code snippets for Visual Studio, which will make your Orchard Core development more efficient! Orchard Core updates User menu as a shape There is a user menu at the top-right corner of the admin theme. In this menu, you could see the name of the logged-in user, and here is a button that you can use to log off. In the past, if you would like to change the look and feel of this menu, you had to override the whole Layout.cshtml file of the theme, because this was the file where we rendered the menu. From now there is a new shape called UserMenu, which is just about containing that piece of content that is responsible to display the user menu. So, if you would like to override that menu, just create a new Razor file in your admin theme called Usermenu.cshtml. Reviewing encoders usages There was a bug when you are sending an email, where your chars might be JSON-encoded. Let's say that you were using workflows to send a bunch of emails and in this case, Liquid is used to construct the body of the emails. You can have input data like "Country": "België" that you are rendering with {{order.UserProfile.Country}}<br />. However, workflow Liquid evaluator is using JavaScriptEncoder rather than HtmlEncoder. This results in an email with Belgi\u00EB in the body. By default when ASP.Net Core injects it's HTML helpers, it will encode all the Unicode chars. If you have any Unicode char, it will be encoded, which means you will not see the actual characters even if the browser supports Unicode characters. To prevent that you can configure the WebEncoderOptions in your web application to say that the TextEncoderSettings will accept all Unicode ranges. That means it will don't encode anything that is based on Unicode ranges. It will still encode HTML, but any char that is a Unicode char will still be returned as a Unicode char and not as an HTML entity or a URL entity or a JSON entity and so on. It's better to just opt-in for the ranges you want, but in this case, it's just a sample code to show you how you can do that. If you look at your source code when you use such chars, you will see you will have lots of HTML entities instead of the chars you wrote. Once you do that, it could be the actual chars. And also, when you are using an encoder, just resolve it in the constructor, because the encoders are registered in the DI using the mentioned arguments. If you don't want to use the arguments (TextEncoderSettings) for a custom piece of code, then don't resolve the encoder, use HtmlEncoder.Default. For more information, check out the documentation! Demos Orchard Core code snippets for Visual Studio Orchard Dojo Library is a portable package of coding and training guidelines, development utilities. These are also part of the best practices and guidelines we use at Lombiq. This library contains Visual Studio code snippets to quickly generate code in some common scenarios during the Orchard Core module and theme development. To effectively use this collection of VS snippets just point the Snippets Manager to where you cloned or downloaded this folder. To do this go under Tools → Code Snippets Manager → select the C# language → Add and Add the whole folder. For Razor snippets to also work select the HTML Language and do the same. Do note that Razor snippets will only be suggested when you hit Ctrl + space first. You can download the snippets from this GitHub repository. For example, if you type oc, the IntelliSense in Visual Studio will show you the suggestions. In the screen below you could see the code that is generated if you are using the ocmigrations snippet. That is about generating a class that implements the DataMigration abstract class and you will also get a Create method, that is the minimum requirement if you would like to add a migration. But that's not all! Check out this recording to see more snippets in action! News from the community Orchard Core RC 2 released We are thrilled to announce that Orchard Core RC 2 is now available! There is a new blog post in Orchard Core Blog that shows you the new features of the latest release. Here you could find the content localization support, and pre-configured localized Setup experience, the improved block content management experience, sitemaps management, and Azure support improvements. The NuGet packages are also updated on nuget.org. It's still prerelease of Orchard Core (the last one), so if you would like to update the packages in your solution, don't forget to put a tick in the Include prerelease checkbox if you are using Visual Studio. And don't forget the Roadmap! Here you could see a list of the fully or partially implemented features and the plans for the future releases! Upgrade your solution to RC 2 now! Feel free to drop on the dedicated Gitter chat and ask questions! Lombiq Utility Scripts Our Utility Scripts project is now open source! Many scripts for Orchard Core, Orchard CMS, Azure, SqlServer development. E.g. quick Orchard Core solution init, reset/reinstall. Head to the GitHub repository to see all the included scripts! Lombiq's Open-Source Orchard Core Extensions is now updated to RC 2 Looking for some useful Orchard Core extensions? Here's a bundle solution of all of Lombiq's open-source Orchard Core extensions (modules and themes). This repository contains the Helpful Libraries for Orchard Core that includes DateTime Libraries with TimeZone conversion, Localization Libraries and many more! But it also contains the Vue.js module for Orchard Core, the Training Demo module and that's not all of it! A new blog post about Orchard Core Nuno Cancelo is a software Engineer, eager to learn, and even more to share knowledge. Last week he published a great post about the basics of Orchard Core and he planned to publish 3 more parts where he will write about how you can create a module, a recipe, and a theme. Don't hesitate and start this journey now! 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 148 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!

OpenAPI, Swagger, Taxonomy Localization - This week in Orchard (12/06/2020)

This week we prepared with two new demos: the Taxonomy Localization and the Orchard Core OpenAPI Code Generation Tools based on NSwag! But before doing that, let's see the latest changes that will be added to the RC2 release of Orchard Core that is now really just a few days ahead! Orchard Core updates Refactor Blog recipe to have fewer required fields You may found that creating blog posts in Orchard Core using the Blog recipe could be not very user friendly. When you create a new blog post, you have to provide tags and select the category for the posts, however, you will also need to add a banner image for it. These are all required fields, without these, you cannot publish your post. But from now these fields are optional and the Markdown editor is just below the Title and the Permalink, so you don't need to scroll down to start typing your new exciting post! Add ConfirmationEmailSubject to RegisterUserTask When you are dealing with workflows you can find a task called Register User. This is about register a user from a form field, meaning that the activity is getting the request body as a form to get an IFormCollection and try to get the UserName and Email values from that. If everything goes fine, the task will register the user and if you edit the activity, you will find some more stuff to set up! Here you can say to send a confirmation email to the user with a given subject and you can also use a template for the confirmation email if you want! How to contribute to the Orchard Core documentation? Have you ever thought about contributing to the Orchard Core documentation, but you cannot find a line about how to do that? Well, here comes the good news! From now, you will find a new guide in the documentation that tells you everything that you need to know to add your great getting started guides, tutorials, and everything to the documentation! Thank you for doing that! Change content API permissions You want anonymous users to be able to view your site, view your page/content item and it would just show what the layout is or the view is. But you might not want anonymous users to retrieve the full content item JSON payload, because it might shows some properties and metadata that you don't want to expose. For that, you could use the custom permission called GetApiContent that you can assign to specific roles and this is not assigned to anonymous users by default. Now, this permission was renamed to AccessContentApi and protects all /api/content methods. If you don't want a user to see all the fields, just don't grant access to the APIs at all, hence the GetApiContent permission is not required as a separate one. This will also protect POST that currently returns the full content. And one more thing: the GetApiContent was already added to the Authenticated role. Now it's removed from that role as being authenticated should not grant access to all fields. Prevent array duplication when merging existing content When you do Merge using JSON.Net it will just merge the different arrays. In some cases, it's not what you want. If you want an array to be replaced (for example an array of tags) then it will just add a new tag to that array and not replacing the array with a new array. On the POST operation of the API, you just want to replace the value and the PATCH operation should be the one that merges different arrays in this case. So, the Content ApiController needs to use ArrayHandling.Replace when updating existing content, or array values are duplicated. Here you can see the changed code and here comes the UpdateJsonMergeSettings: private static readonly JsonMergeSettings UpdateJsonMergeSettings = new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Replace }; Demos Taxonomy Localization Have you ever wondered how to localize your taxonomy terms in Orchard Core? Well, it could be hard to do it for the first time, but if you are watching the following recording you can get some tips and tricks to reach your goal faster! Orchard Core OpenAPI Code Generation Tools based on NSwag Head to GitHub and clone the master branch of the ThisNetWorks.OrchardCore.OpenApi repository. Make sure that the ThisNetWorks.OrchardCore.OpenApi.Sample project is your starting project then just simply build and run the solution. When setting up your site don't forget to use the Open API Sample recipe to enable the needed modules and theme. If you navigate to https://localhost:44300/swagger, you will see the endpoints that are available in Orchard Core and a sample controller named Foo that comes from the ThisNetWorks.OrchardCore.OpenApi.SampleModule module. Here you can make queries on them and now we will also get schemas that are generated using the NSwag toolchain! Let's check for example the BlogPostItemDto! Now we can use those! The samples folder contains a console client that you can use to try the endpoints. You can simply open the solution with Visual Studio (ThisNetWorks.OrchardCore.OpenApi.ConsoleClient.sln) and fire up the ThisNetWorks.OrchardCore.OpenApi.ConsoleClient project. This is about calling the endpoints by using a static HttpClient. Open the Program.cs file and check the first few lines of the Main method here. You could see that we are getting a content item by the 4qnhdhv3z54xk4fg4tdfke76c9 and we get the content of the content item in the FooTextItemDto object. The content item with the mentioned ID is a content item of the Foo text content type, which has got one Text Field attached, named Foo Field. Our client modifies the text of this field and making a POST request to send the updated data to Orchard Core. Now if you read back from the API you will get the updated content item with the new text in the Foo Field. But there is a lot more than that! You can see that you can get the RecentBlogPosts Lucene query and use the response data, or do other Lucene queries (like give me all the blog posts) and so on. If you are interested in it, there is also a TypeScript client (tsClient.ts) which has the same kind of classes and can be used directly from TypeScript. Of course, before doing that, you have to do the authentication, get the token, and so on. For that, you have to enable the OpenID module and configure it. It also comes with the recipe by default. The back-end, the Swagger is using Authorization Code Flow, and the console client is using Client Credentials Flow. The client app has a specific API role because it's relevant to just give very limited and specific access to the system. And that's not all of it! If you need more details about the project, don't forget to check the recording on YouTube! News from the community Orchard Nuggets: How to access services from another tenant in Orchard Core? Do you run a multi-tenant Orchard Core site? Have you ever wondered how you can cross tenant boundaries? We show you the code! Check out our latest Orchard Nugget post for more! Check out the other posts for more such bite-sized Orchard tips and let us know if you'd have another question! Updated Dojo library We've updated the famous Dojo Library to Orchard Core! Orchard Dojo is a portable package of coding and training guidelines, development utilities. Check out our updated library and start learning today! 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 146 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!

Custom Settings, Short Codes - This week in Orchard (05/06/2020)

This week we are going to see some code and code samples that could be good to know when developing your Orchard Core application. But we are not just doing that! We will also show you a nice demo about how to create custom settings in Orchard Core just using the admin UI without typing a line of code! Let's start our journey! Orchard Core updates Adding branding assess to docs You can find a new page in the documentation called Orchard Core Branding where you can find graphics assets for Orchard Core's branding. Allow classes by default with the HTML sanitizer Last week we saw the new HtmlSanitizerService in Orchard Core that is responsible for sanitizing the HTML code. Now when you are adding Orchard CMS to your application by calling the AddOrchardCms extension method, it will call the AddHtmlSanitizer extension method that will set up the HtmlSanitizerOptions. And it will add the class as an allowed HTML attribute to the sanitizer. Change [media] short code to Add IServiceProvider to shape Creating Created contexts The ShapeCreatedContext didn't have a ServiceProvider as the ShapeDisplayContext do. This means services resolved through an IShapeTableProvider with OnCreated either need to be resolved through the constructor, which causes disposed exceptions, and scope capturing, or by directly accessing the ShellScope.Services. But what does it mean in practice? Let's say you inherit from the ShapeFactoryEvents abstract class that implements the IShapeFactoryEvents interface and you want to add some additional logic after your shape has been created. In our case, we would like to show a new notification when a shape has been created. For that somehow we need to resolve the INotifier and the IHtmlLocalizer. To achieve our goal we can just simply get the ServiceProvider from the ShapeCreatedContext and implement the business logic. Update Fluid and YesSql dependencies Now you can track objects that have been saved and then modified again after a flush in YesSql. In Fluid everything is a decimal now and not a double because when you do 10 - 0.9 you want to see 9.1 and not 9.000009. Demos Custom Settings You may know that you can create custom settings on Orchard Core by writing some code: implement the class to store the properties, add a SectionDisplayDriver to it, then pass your class using a ViewModel to a Razor page. You may also need to implement the INavigationProvider interface to be able to reach your setting in the admin UI from a new option on the menu. But you can also create custom settings without the need of writing any line of code in a very easy way. Do you want to know how? First, we set up the site using the Blog recipe, but you can choose any of the built-in ones, you just make sure that the Custom Settings feature is enabled. Now, navigate to the admin UI of Orchard Core and select Content -> Content Definition -> Content Types and create a new content type. Let's call it Company Brand. This setting is about storing some related information about a company. The company will have a name and a logo. For that, we will attach a Text Field and a Media Field to our content type. You have to do two things to make this content type a custom setting: Disable Creatable, Listable, Draftable and Securable metadata as they don't apply. Set the stereotype of the content type to CustomSettings. And that's all! Congratulations, you created a custom setting in Orchard Core without writing any code! If you don't believe that, head to Configuration -> Settings where now you can already see a new option called Company Brand. If you click on it, the CMS will show you the editor of your content type just as you set it up when you defined the content definition of your type. Now you can work with this custom setting as you would work with the ones that you create using code. Don't forget, the documentation of Orchard Core contains a great section about custom settings. If you prefer videos, you can also check out how to create custom settings just using the admin UI on YouTube! News from the community Check your language in the Setup screen of Orchard Core With the next public release so close, please check that your language looks perfect in the Setup screen. Some culture files are only missing a few strings: Greek (1) Japanese (3) Persian (1) Polish (3) Russian (3) Spanish (1) Turkish (8) If you speak one of the listed languages, just fire up a new Orchard Core site and select your language using the picker in the top-right corner of the screen. If you find any incorrect translation or some weird string, just leave a comment below! 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 146 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!

Lombiq Helpful Extensions, HTML script sanitizer - This week in Orchard (30/05/2020)

Have you ever had a hard time implementing the migration files of your content types that you have constructed using the admin UI? Let us show you the Code Generation Helpful Extensions that generate the C# code for you in a click from the admin UI! This week we are also showing you a new and useful feature of Orchard Core about how to sanitize your HTML in an easy way! Orchard Core updates HTML script sanitizer By default, every content part should prevent input from rendering <script> tags. This should be opt-in on a per-type part level. This means that even if a part editor permits it, the rendering would filter these out. We can provide a reusable service as many parts will need it. And here we go! The name of the service is HtmlSanitizerService that is responsible for sanitizing the HTML code. To do that we are using a new open-source NuGet that can be found in GitHub called HtmlSanitizer. HtmlSanitizer is a .NET library for cleaning HTML fragments and documents from constructs that can lead to XSS attacks. It uses AngleSharp to parse, manipulate, and render HTML and CSS. As you can see in the code, there is a new class called HtmlSanitizerOptions that you can use to configure the sanitizer. If you checked the Usage section of the README.md file on the GitHub page of HtmlSanitizer you could see several lists that contain the tags allowed by default, the attributes allowed by default, CSS properties allowed by default, and so on. If you navigate to the HtmlSanitizerTests file and check the ShouldConfigureSanitizer method, you could see how to use the HtmlSanitizerOptions to set up your sanitizer by for example adding additional allowed attributes to it. In the 34th line, we are adding the class as an allowed attribute. And the Sanitize method of this service (you will never guess!) is responsible for sanitizing the HTML. OK, that's cool but where and how can I use this feature in my Orchard Core site? If you have a HtmlBody Part, an HTML Field, or a Markdown Field you will find a new option in the editor of the field or the part with a new checkbox: Sanitize Html. This checkbox is enabled everywhere by default, but of course, you have the availability to disable this feature. Let's say you have a site installed with the Blog recipe and you would like to create a new Article and do some evil stuff in the HtmlBody Part. You view the HTML source and enter the line there <a href=\"javascript: alert('xss')\">Click me</a> Then hit Publish and view the HTML source again. You will notice that the code changed to <a>Click me</a>. Preview feed moved to Cloudsmith For Orchard Core, the community has switched the preview feed package repository to Cloudsmith due to much nicer retention and bandwidth policies for open source projects. It means now you can use a different feed when using the nightly build packages of Orchard Core. If you open the documentation and select the Configure Preview package source in the Getting started section you will find the new feed URL and the way about how to set it up using Visual Studio or using the NuGet.config file. Templates content items If you remember, we had the Layout Template in Orchard 1, where you could define a layout page and save it as a template to start new pages out of this template. The idea would be to make it for any content item that you could store as a template and then create items that are just clones of that. In GitHub there is a feature called issue templates: when you create a new issue, you have templates for different types of issues. To see a good example of this idea navigate to the GitHub repository of ASP.NET Core and start to fill a new issue. Here GitHub will ask you what kind of issue you would like to create. These are the issue templates. What about creating a content item and saving it as a template? The same way you have a Publish or Save as draft, you can say: Save as a template. And then it would be a content item of the specific type that might appear in the menu somewhere or might appear in the New button when you create a new content item based on the given type. When you create a new of this thing, it will just clone it and you start with a new content item that is based on that. If you have like articles with the specific background or specific text that you want to reuse you can do that. Same thing for a content type with a Flow Part attached. In this case, you can reuse the widgets too! What do you think about this idea? Do you like it? Or do you have any other thoughts about this feature? Leave your reply in the comments section below and let us know! Demos Code Generation Helpful Extensions in Lombiq Helpful Extensions for Orchard Core If you navigate to the GitHub page of the Lombiq Helpful Extensions for Orchard Core, you will find a module that contains some handy extensions that you can use in your Orchard Core solution. Note that if you are using the nightly builds of Orchard Core, you should checkout to the orchard-core-preview branch, otherwise clone the dev branch of the repository. To use this module place the content of it to your solution and if you are using Visual Studio use the Solution Explorer and add this module as an existing project to your solution. Don't forget to add this as a project reference to your ASP.NET Core Web Application. This is the way how you could add any external module or theme to your Orchard Core solution. Now if everything goes well, you can build your solution and install your Orchard Core site! Note that if you are using the nightly builds, you may need to add the preview package source as described here. Set up your application using the Agency recipe. Go to Configuration -> Features and enable the Code Generation Helpful Extensions - Lombiq Helpful Extensions module. Now head to the content definition of the Landing Page (Content -> Content Definition -> Content Types -> Landing Page) and hit the Toggle showing generated migration code button. Here you could see the power of this extension. This module is about generating migration code from content definitions. You can use this to create (or edit) a content type on the admin and then move its creation to a migration class. Generated migration code is displayed under the content types' editors. If you are interested in the full demo, don't forget to check out the recording on YouTube! News from the community New websites using Orchard Core https://saintsrow.com is the website where you can get information and order the different Saints Row games. And if you visit https://chorusthegame.com, you will find everything about an upcoming game called Chorus. 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 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!