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

Featured tags

IIS
API
All tags >

Azure Email Communication Services feature, Shortcode for cache busting - This week in Orchard (08/12/2023)

Shortcode for cache busing, update the Admin Dashboard documentation, and a demo about the upcoming Azure Email Communication Services feature! Let's get started! Orchard Core updates Update the Admin Dashboard documentation The documentation page for the Admin Dashboard has been updated with details about how to create custom widgets that you can add to the Admin Dashboard. You can also read about the customizable settings of these widgets and the options that you can use if you wish to modify the look of your widgets. Shortcode for cache busting There was no option to add a Shortcode for cache busting. For reference, you can add cache busting in a cshtml file like this: @Orchard.AssetUrl(assetPath: path, appendVersion: true). So, if somebody used an image in (for example) an HTML Body part, there was no way to add cache busting with a Shortcode. The goal of this improvement was to add a Shortcode that allows cache busting. The Shortcodes page of the documentation lists the available Shortcodes in Orchard Core. This contains the Demos Azure Email Communication Services feature Azure now has a new set of resources under the Communication Services (ACS) umbrella, Email Communication Services being one of them. This is a cheaper, Azure-native alternative to SendGrid. The primary way to use it is not through traditional SMTP-server configuration, but a connection string (of two components, endpoint, and access key) provided by the ACS resource, which allows access to the specific communication service resources attached to it (for example, an Email Communication Services instance). This requires a custom implementation to send emails using the corresponding SDK. OrchardCore.Email doesn't seem to support this scenario at its current state and needs a bit of refactoring (can take inspiration from the structure in O1 for better extensibility). Now let's see the current state of this feature that you can also check out in this PR! First, we need to enable the Azure Email Communication Services feature that configures email settings and a default email service based on (ACS) under the Configuration -> Features option from the admin UI. After that, you will find a new option under Configuration -> Settings -> Email, called Azure Email Settings. Here, you can see the Default Sender and the Connection String values. The Default Sender can be set up under the Email Settings menu item or use the appsettings.json file. The Connection String can be set up using the appsettings.json file. And if you are interested in how to use this feature from code, you can see a unit test for this in the AzureEmailServiceTests class. As always, if you would like to know more about this upcoming feature, head to YouTube for a recording! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 487 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Lombiq Privacy for Orchard Core, Target .NET 6 by default - This week in Orchard (19/11/2021)

New guide to the document, new asset_url Shortcode, targeting .NET 6 by default, and demo about the Lombiq Privacy module for Orchard Core. Do you want to know more? Then don't forget to check out our current post! Orchard Core updates Add [asset_url] shortcode The new asset_url Shortcode can be used to render the image URL only. Let's see a short example for this one. We have a site set up with the Blog recipe, and we decided to create a new blog post. The blog post content type has a MarkDownPart attached that supports using Shortcodes. You can type the [asset_url][/asset_url] by yourself, or just easily click on the Insert Shortcode icon and find the asset_url one in the Media category. Make sure you have some content in your Media Library and enter the file name of the asset. We have an Orchard Core logo at the root of the Media Library with the file name orchard-core-symbol-logo-color.png, so let's use that one.As you can see, if we provide the file name, the asset_url returns the relative URL from the site's media library. You can see we have a tenant here with the name blog1 and the file is in the root folder of the media library. If you would like to know more, head to this page of the Orchard Core documentation, where you can read about the parameters that you can use with this Shortcode. New how-to guide: creating the pieces needed to query content based on assigned taxonomies If you head to this page on the Orchard Core documentation, you will find a new guide for creating a query that allows searching across multiple assigned taxonomies. At the end of the guide, you will have the pieces needed to search through blogs to find only the ones with specific tags assigned. Target .NET 6 by default .NET 6 was released on the 8th of November and the community already updated Orchard Core to use .NET 6 by default. So, the main branch targets .NET 6 by default which means if you clone that branch, you will need to have the .NET 6 SDK. If you go to dotnet.microsoft.com, you can easily download the latest SDK. Orchard Core now also builds and runs the tests using .NET 6. The targets are defined in the CommonTargetFrameworks of the Dependencies.AspNetCore.props file, where you will see .NET 6, .NET 5 and .NET Core 3.1. By default, if you open Visual Studio, it will target .NET 6, but when you build on the command line, you can define which target you want. So, if you want to publish a self-contained, you can do --framework and provide the framework you want or change the value of the DefaultTargetFramework property. The same applies to the Docker deployments. And one reminder: if you are using Visual Studio and want to use .NET 6, you will need to download Visual Studio 2022 because Visual Studio 2019 has no support for .NET 6. Demos Lombiq Privacy for Orchard Core The Lombiq Privacy for Orchard Core is an Orchard Core module containing features related to data protection/privacy and the EU law on it, the General Data Protection Regulation (GDPR). In this demo, we will go with the quicker way and use our Open-Source Orchard Core Extensions full Orchard Core solution that contains that module. If you clone that repository and set up your site using any setup recipe, let's just navigate to the admin UI of Orchard Core, and under Configuration -> Features, enable the following features: Lombiq Privacy - Consent banner that adds the ability to show a privacy consent banner. Lombiq Privacy - Form consent that provides the Privacy Consent Checkbox widget that can be used on any form. Lombiq Privacy - Registration consent that adds a privacy consent checkbox to the registration form. Now, if you navigate to Configuration -> Settings, you will find three new options there: Privacy Consent Banner Settings, Privacy Consent Checkbox Settings, and Privacy Registration Consent Settings. If you click on the Privacy Consent Banner Settings, you will find a simple editor with Liquid support, where you can set the content of the consent banner. By using the consent banner feature, users can accept the privacy policy. If the user is unauthenticated, they can use the banner to accept or reject the privacy statement, their decision will be stored in a cookie by the browser. If the user is authenticated, their only option is to accept the privacy policy via the banner. This is so because it is assumed that during registration, they already accepted a suitable privacy policy, it's just that the Lombiq Privacy module or something similar wasn't used at the time. Another new option here is the Privacy Registration Consent Checkbox Settings. The Registration Consent Feature shows a privacy consent checkbox on the registration form that needs to be checked by the users to be able to register. After registration, the user's consent is stored in the PrivacyConsent section of the user's properties. Here you can define the label of the checkbox. And the last one is the Form Consent Feature which adds a new Privacy Consent Checkbox widget content type that can be added to forms with the Forms module. In this case, users must accept the privacy policy before they can post content to the site. You can validate the consent with the Validate Privacy Consent Checkbox workflow activity. The way of how to do it can be seen in this Contact Form submitted workflow. When we get an incoming POST request, we check the validity of the Privacy Consent Checkbox, and based on the result, we redirect the user to different URLs. And if you check out the editor of the Page content type which has a Flow Part attached, you can see we added a Form widget there, and inside the Form, we placed our Privacy Consent Checkbox widget. And as usual, if you would like to know more about this new module, head to YouTube for a recording! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 231 subscribers! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

Placements module, Admin UI improvements - This week in Orchard (17/01/2021)

This time we would like to show you the new features of the Placements module, drop a few lines about the 1.0 version of the Shortcodes module and give a recap about the latest improvements of the admin UI. Check out our post for more! Orchard Core updates Placements module V2 We can do quite everything without creating any module or theme, but it's not possible to override default placement. It could be helpful to have a UI where you can easily define placement rules. Either we can add this to Part/Field settings or add a distinct UI (like the "Templates" one) where we can define a list of placement rules. The Placements module adds an optional feature that lets the user define custom placements rules in the admin UI. This V2 of the module is a rewrite of the original one, it uses IShapePlacementProvider to provide placements at runtime. The IShapePlacementProvider interface allows to asynchronously (useful if it relies on an async placement store) build an IPlacementInfoResolver for each IBuildShapeContext. The IPlacementInfoResolver implementation keeps placement rules for the current IBuildShapeContext to be able to quickly resolve shape placements synchronously. But don't go into too many technical details right now, lets's see how you can use this feature! Set up your site using the Blank site recipe then head to Configuration -> Features to enable the Placements module. Now you will find a new option under Design, called Placement. But don't go that far! We set up our site using the Blank site recipe so we don't really have much content on our site. To test out that feature we will need to define at least one content type. Let's do it quickly! We have just created a new Page content type, added a Link Field to it, and some Parts: the Title Part, the Flow Part, and the HtmlBody Part. Let's create a new Page content item and preview it! You should see something like that: the title of the page content item, the link field, the widgets in the Flow Part, and the content of the HtmlBody Part. Now it's time to go back to our Placements module. Let's say we would like to hide the LinkField of our page. To do that, navigate to Design -> Placements and add a new placement. Call it LinkField because we would like to modify that field right now. And the Placement rules text is prepopulated with null values. To hide the Link Field, just simply modify the place value to "-". Note that this will hide every Link Field of the site! But sometimes it's not obvious how to write the placement rules correctly for the first time. You have to know some words about the content templates, shape differentiators, content part and field differentiators, and so on. And here comes another great feature of the Placements module! Let's say we would like to hide the editor of the link field. Navigate to Content -> Content Definition -> Content Types and select the Page. Hit Edit and Edit again near the Link Field. Here you will find a new Edit placements button that contains some predefined placements for our Link Field (named Source). If you click some of those, a new placement will be created. Let's select Placement in admin editor for the Source field in a Page. This will generate the following placement: As you can see here, the type of shape is LinkField_Edit and the differentiator has the Page-Source value. That means to target the editor of the Link Field called Source of the Page content type. If you say "-" for the place, it will hide the editor of the Link Field when creating or editing Page content items. New IsImageFile Orchard helper Instead of using a RegEx or something like that, there is now a new IsImageFile Orchard helper that uses a static HashSet that contains the possible allowed file extensions that an image file could have. Just use this helper to determine if a path is an image file. Shortcodes 1.0.0 is here There is a Shortcodes module in GitHub created by Sébastien Ros that is a shortcodes processor for .NET with a focus on performance and simplicity. 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]. It has several features, like supporting async shortcode to execute database queries and async operations more efficiently under load or supporting named and positioned arguments. And this is the library that is integrated into Orchard Core to be able to work with shortcodes. We mentioned the Shortcodes feature of the CMS several times in This week in Orchard, for example here, now let's focus on the latest changes of the module. The big news is now this module was come out from the beta version! Let's mention the biggest change of this new version. David Hayden was trying to write a blog post with some C# code inside and in the C# code there were some attributes and there were some Shortcodes in the attributes. When you evaluate a Shortcode using this library it just outputs to nothing if it's unknown. This means all the attributes from the code were removed. From now if there is an unknown Shortcode or it can't be parsed, the module will just output it as is. AutoroutesEntries Atomicity and Size This allows for synchronization between multiple nodes of a cluster, specifically for AutoRoutes. If you are on one node and you create a new AutoRoute, then the other nodes will update their AutoRoute mapping for the new AutoRoute. It's not just about data to load, it's also updating the resolution list: a dictionary that maps content items to routes. There is an AutoRoutePartIndex that is used to detect what had changed since the synchronization of the last element. Every YesSql index is updating things with an incremental identifier so, if there is a change on one AutoRoutePart it's not updating the previous indexes, it's just adding new indexes and removing the previous one. Now, this index is used to just sync every node to the new state. It's like a synchronous pattern, the index just shows the new things that happened on the AutoRouteParts, and then it's applied directly to the AutoroutesEntries structure. Check out the AutoroutePartIndexProvider class in the dev branch! Demos Admin UI improvements The admin UI of Orchard Core got several improvements lately. In the demo of our current post, we will check out the updated UI. Let's start! When you navigate to the admin UI of your site you can see the Orchard logo and the name of your site on the left side of the top bar. From now if you click on it, it will navigate to the home page of the admin theme. But don't worry, you can still easily navigate to your site, just use the little arrow at the right of the top bar. Oh, and one more thing: if you click on that little user icon on the right, you can see the user name of the currently logged-in user. If you have the Tenants feature enabled you can add tenants to your site. The list of the tenants is now a little bit different. You can see the name of the database preset, the description, the used recipe, and the state of the tenant. Now let's navigate to the content items list to check out the new design there too. You can see that every line start with the display text of the content item, followed by the content type, the status of the content item, the date of the latest modification, and the author of the content item. You can see that the About article has a draft and a published version too. And lastly, go to the Design -> Widgets page and check out the design there. You could see we have two widgets right now, the one with the display text My widget is a content type of Container that has two versions and associated with the Homepage layer. The other one is placed on the Always layer. And that's not all of the improvements and more are just on the way! Check out this recording on YouTube to know more! News from the community Work with us! You've completed the Dojo Course, congratulations! You’re now officially an Orchard Core developer. Would you like to work on a variety of challenging Orchard Core projects with the biggest Orchard team in the world? Work with us! Just send us an e-mail to crew at lombiq.com. Please include what you’re most interested in professionally and attach around 100 lines of any kind of code that you’re especially proud of or just link to the favorite open-source project of your own on GitHub or else. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 184 subscribers! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

Shortcodes improvements, Lombiq Training Demo updates - This week in Orchard (14/08/2020)

This week we see the latest improvements of the Shortcodes module and the new pages of the Orchard Core documentation! Don't forget about our Traning Demo module, which has now got a new RESTful web API sample! Check out our current post for more! Orchard Core updates Highlight invalid fields When you have a driver for your content part or for your content field, the UpdateAsync method will be called when you are about to save and persist the new values of it. Let's say you have a TextField and you want to set it to be required. In the UpdateAsync method of the TextFieldDisplayDriver, we get the TextFieldSettings and if the value of the Required property is true and the Text property of the TextField has no value, then it's time to show an error for the user. Notice the second parameter of the AddModelError method. This is about passing a key to the ModelStateDictionary. The key would be the value of the Text property of the TextField and the Prefix would be the BlogPost.Subtitle string. But why is it important right now? Because there was an issue in Orchard Core about the different highlightings. If there is a validation error, it would be great to highlight the input editor, not just showing the validation summary at the top of the form. So, imagine you have a site installed with the Blog recipe and you set the Subtitle TextField of the Blog Post content type to be required. If you would like to save the existing blog post without providing a subtitle, the driver will pass the BlogPost.Subtitle as the Prefix and the name of the field.Text will be null. It's a small, but a good to know tip to provide a better user experience when editing values. Document Link Tag Helper There is a Tag Helper and a Liquid Helper in Orchard Core called Link that you can use to define the relationship between the current document and an external resource such as a favicon or stylesheet. This helper is available for a while, but there were no words in the documentation about it. Now you can find some lines in the documentation about how to use these helpers in your Orchard Core site. Add user updated event Two weeks ago we wrote about the new user deleted event, which is about to add a new DeletedAsync method to the IUserEventHandler. Now there is another new event for user events, that is about to occur when a user is updated. You can find the new UpdatedAsync method in the IUserEventHandler. And a 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 Updated event in the User category. Password configuration documentation The password restrictions are set with the settings configured in ASP.NET Identity. Those options are used to define the required password strength when a user password is set. You can configure these requirements in order to specify properties like the minimal password length or if the process is expecting digits, uppercase, or non-alphanumeric characters. Check out the new how-to guide in the Orchard Core documentation to see how to change these settings and how to read configuration from an external config file! Demos Shortcodes improvements Two weeks ago we wrote about the upcoming Shortcodes feature for Orchard Core. 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. Check out that post if you haven't read that yet and don't forget to watch the recording on YouTube about that too! Now, let's continue from where we left off and see the newest improvements in that module! Set up your site using the Blog recipe, then head to Configuration -> Features to enable these features: Shortcode Templates: The Shortcode Templates feature provides a way to write custom shortcode templates from the admin. Shortcodes: The Shortcodes feature adds shortcode capabilities. Now head to Design and notice that the Shortcode Templates options is renamed to Shortcodes. Click here and add a new Shortcode! Here you will meet with a slightly changed editor. The first thing that you will notice is when you are starting to fill out the Name, the Hint, and the Usage inputs you will get a live preview in the right about how the card of the Shortcode will look like. You can ask what card do we mean, but let's not move so fast! The Categories selector is now working the same when you add tags to your blog post. You can type to search for the existing categories or add a new category right here from the editor. The Content will be about having the logic of the Shortcode. Here we create a Shortcode called safeimage, it means we sanitize the input from the user before rendering the content. We also created another Shortcode called unsafeimage. That would be the same, the only difference is we didn't call the sanitize Liquid helper. Now edit the Article content item named About. The HTML editor here has the Insert Shortcode button on the toolbar. Click on it and now you will see the cards we have just mentioned a few lines ago! Here you can filter by the name of the Shortcode and can filter by categories. Now let's try out the unsafeimage and the safeimage Shortcodes! After editing the code we have the following lines in the HTML body: unsafeimage: [unsafeimage]media/samoyed.jpg" onload=alert('xss')[/unsafeimage]unsafeimage: [unsafeimage]media/samoyed.jpg[/unsafeimage]safeimage: [safeimage]media/samoyed.jpg[/safeimage] Notice the script in the first line! Because we added this inside an unsafeimage Shortcode, it will render the alert when the user views this page. If we would put this little hack inside a safeimage Shortcode, then it would prevent the alert to appear. But that's not all about Shortcodes! If you would like to see more, don't forget to check out this recording on YouTube! News from the community RESTful web API sample in the Lombiq Training Demo for Orchard Core The Lombiq Training Demo for Orchard Core is a demo Orchard Core CMS module for training purposes guiding you to become an Orchard developer. You can use this module as part of a vanilla Orchard Core source that includes the full source code - which is the recommended way. You can also use it as part of a solution that uses Orchard Core NuGet packages, however, it's harder to look under the hood of Orchard Core features. And the module just got a new little RESTful web API sample! Check it out if you're learning Orchard and want to develop web APIs! 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 157 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!