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

Featured tags

IIS
API
All tags >

Archive Later Feature, Notifications Feature - This week in Orchard (23/09/2022)

Archive Later Feature, extract GetLanguageDirection() and IsRightToLeft() to CultureInfoExtensions, introduce EnabledByDependencyOnly flag for features to allow the feature's state to be auto, and a demo about a feature called Notifications! Check out our post for the details! Orchard Core updates Archive Later Feature Back in 2020, we mentioned the Publish Later Feature which adds the ability to schedule content items to be published at a given future date and time. Now here comes the Archive Later Feature, which provides a way to unpublish content items at a given time. Let's see a simple example of the usage! Open up the admin UI of Orchard Core and head to Configuration -> Features and enable the Archive Later module. If you would like to use this feature with your content type you have to edit its definition by attaching the Archive Later Part to it. Let's attach the Archive Later Part to the Blog Post content type! Now let's edit our predefined blog post! At the bottom of the editor, you will see a new input Tag Helper with the datetime-local input type. If you set the date and the time here and hit the Archive Later button, the status of the current version will automatically change to draft when the time goes by using a background task. We also have a Cancel Archive Later button, so we can cancel the archiving process. And in the SummaryAdmin list, you also had a little message that shows you the date and time when the content item will be archived. Extract GetLanguageDirection() and IsRightToLeft() to CultureInfoExtensions We have some extension methods for CultureInfo to deal with language direction. These extension methods were placed in the LanguageDirection class and now they have their own class called CultureInfoExtensions. So, from now on you can find these extensions here. Small change but nice to have extension methods in a separate class. Introduce EnabledByDependencyOnly flag for features to allow the feature's state to be auto To represent this new change, we will use the features that you can check out in detail in the demo down below regarding the Notifications Feature. So, let's say you are on the Features page and search for the "notifications" word. Here you can find the Notifications module, which is only enabled if you enable one of its dependencies. So, you can't enable it right away. But the Email Notifications module requires it, meaning if you enable the Email Notifications module, the Notifications module will be enabled as well. And if you disable the Email Notification module, the Notifications module will be disabled as well because none of its dependencies are enabled. And it's a flag that is very easy to use! If you open up the Manifest.cs file of the OrchardCore.Notifications module (can be found in this branch), you will see the feature with ID OrchardCore.Nofitications has this property set to true. It means that if we enable one of the dependencies of this feature, this module will be automatically enabled. And if none of the dependencies of this feature are enabled, then this module will be automatically disabled. Demos Notifications Feature The Notifications Feature provides a way to be able to send notifications to notify users. You could implement a push notification to a mobile phone, you could implement a web notification, you can have an email notification, etc. For right now you can see the implementation of the email notification, and the Email Notifications module is the one that provides you with this feature. Let's enable it! After that, we can edit one of the existing users on the site and say that we want to send email notifications to this user. And if you implement a push notification or a web notification, then you will see a flag for those as well and we can set up what kind of notifications we want to send to the given user. But this might feel incomplete without the Notification Templates feature which provides a way to create notification templates. Let's enable this one as well! And this will mean that now we can create new Notification Template content items. Let's create a new one and call it "Welcome email for new users template". We will send this email any time a new user is created. Here you can select the provider that you want to utilize, let's select the New user notification here. And as you can see, you have a subject and a body. There are also username, password, and email arguments, that we automatically create because this provider is aware of them. It means you can inject these into the subject and the body of the email that you want to send. The idea here is if you create a new user as an admin you might want to send their temporary password in an email. Here you can use Shortcodes and Liquid templates as you can see. So, we mentioned that we have a New user notification provider. If you enable the third notifications-related feature, called Notification Templates for Contents, it will give you more providers to use. So, if we create another Notification Template, now we can select the Content based notification provider too. It provides you with more templates (DisplayText, ContentItemId, ContentType, etc.) because it has more awareness. At the bottom, you can control who should be the person who receives this. But here right now you don't have the way to select that I want to send out this notification when someone publishes the Article content type. So, selecting the content type and the event is not here. To do that, you have to edit the content definition of a given content type. If we select the Blog Post one, for example, you can see a new setting, called Notifications. If you select to send a notification, you can define which event you want to use and the given notification template. This feature is a PoC and if you want to check out the implementation or try it out in your solution, you can find the code in this branch. And if you prefer videos, check out this recording on YouTube to see more about this feature! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 350 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

Support multipart content type with email service, UNION and UNION ALL clause support - This week in Orchard (20/07/2021)

A new OrchardCore.Email.Core project, support multipart content type with email service, a brand new Orchard Core site using Stripe.Js and Azure Functions and many more are waiting for you in our upcoming post! Orchard Core updates New OrchardCore.Email.Core project We don't have an OrchardCore.Email.Core project that is something similar to feeds and other functionality. Now the default implementation of the ISmtpService is in its own project, that is the OrchardCore.Email.Core one. Support multipart content type with email service Right now when we send an email as HTML by checking the Does the Body contain HTML checkbox option on the email task it will be sent only in HTML. Some email software will often transfer these emails as plain text so we should provide also a plain-text version of the email for the email software to be able to use. This way, we can provide two different Body versions of the email. The solution could be that when the Does the Body contain HTML checkbox is checked we should have a second Body (plain-text) text field to provide the email as plain text. Check out the following email example below to see that the email now could contain an HTML version of the body and a plain text version of the body too. From: [email protected]: Fri, 25 Jun 2021 17:34:43 -0400Subject: TestMessage-Id: <OUJBALN63EU4.IS3IGSIZUPB3@skrypt>Sender: [email protected]: [email protected]: [email protected]: 1.0Content-Type: multipart/alternative; boundary="=-9nfRnDakF+Ib69kpAIdY3A=="--=-9nfRnDakF+Ib69kpAIdY3A==Content-Type: text/plain; charset=utf-8Test text--=-9nfRnDakF+Ib69kpAIdY3A==Content-Type: text/html; charset=utf-8<p>Test html</p>--=-9nfRnDakF+Ib69kpAIdY3A==-- You can achieve this by creating a new Email task in your workflow, put a tick in these two checkboxes and provide the body texts of the email message. Refactoring SelectPart Vue to make it reusable If you have multiple SelectParts on a page, (e.g. a Form FlowPart with multiple Select widgets), then only the first one will actually have a working editor in the edit page or will render options correctly on the display. It has to do with each of the generated SelectOptionsTable/Modal Vue components relying on the same template ID regardless of which widget content item ID they actually correspond to. And it wasn't a huge deal to reproduce this bug. You just needed to run the Blog recipe and turn on the Forms feature. This allows you to add multiple Select widgets to a form's FlowPart. Now, this issue has been fixed. UNION and UNION ALL clause support Now you have support for UNION and UNION ALL clauses in SQL queries. It's not the first time when we have new SQL contracts in the SQL parser. And the ShouldParseUnionClause test in the SqlParserTests.cs file is just about checking that the dialect is generated the correct UNION and UNION ALL which is common to every dialect we use. Demos Using Stripe.Js + Azure Functions with Orchard Core Real Estate end Development is a site that chooses Orchard Core to implement its web appearance. You can register and have a subscription and can also purchase some magazines. The site uses Azure Functions and Stripe.Js to create customers for example with all the necessary inputs. And the flow continues to create a new subscription to that user and so on. If you would like to see the site in action, check out the following demo on YouTube! News from the community Orchard Core articles on .NET Thailand .NET Thailand houses several articles regarding several topics around .NET. Here you can see nice articles about how can debug your code using Chrome DevTool, Visual Studio, or VS Code, or how you can work Docker. And the site also contains some articles about Orchard Core too! For example, you can read a nice one here about how to create a content type and a content item programmatically or how to create a custom Orchard Core module from scratch. Lombiq Helpful Libraries: ContentVersionNumberService The Lombiq Helpful Libraries consist of several various libraries that can be handy when developing for Orchard Core CMS, to be used from your own Orchard modules. This time we will see some helpful services and extensions regarding content item version numbers. Sometimes you may want to know the latest or the current version number of a given content item. To get the version ID, you need to create a new query and query the content items using the ContentItemIndex table and get the value of the ContentItemVersionId column from there. Using our GetLatestVersionNumberAsync and GetCurrentVersionNumberAsync methods from the default implementation of the IContentVersionNumberService interface, you can easily get the version IDs just by injecting this to your code and provide the ID of a content item. Or use the extension methods where you can get the version ID by providing an IContent. Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 209 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!

Distributed cache, Media crop picker - This week in Orchard (08/11/2020)

This week we will see the new IDocumentStore, which is a cacheable, committable, and cancellable document store allowing to get documents from a shared cache. And don't forget to watch a demo about how you can add an alt text and crop the images of your Media Field! Orchard Core updates Make features actions sticky while scrolling If you navigate to the admin UI of Orchard Core and head to Configuration -> Features, you will see all of the currently available features of Orchard Core. This list is now getting longer and longer, so the idea here is to use a sticky bar on scrolling for very long pages instead of the scroll to top button. The first page that gets this sticky bar is the Features page, which looks like the following now. Edit button for lists in DetailAdmin view This is a feature that was already there in Orchard 1. When you want to edit something in the admin, you can return a route to the controller that will edit an entity. Or that will display it as a list or display it as a detailed object in the admin. And when you have a list, you have two options. Either you want to show all the content of this list or you want to actually edit the list itself. And to do that, when you see a blog and you click the link of the blog in the content items, it will go to the list of blog posts. This is the DetailAdmin view. And if you actually want to edit the blog you need to click on the edit button. This feature is about adding a new button for the list and you are now not confused about clicking the link or click in the properties button. Move feeds to feature There is a new feature now in Orchard Core called Feeds. Don't forget to enable that module if you would like to have feeds capabilities on your site! Generate xml documentation (comments) for nuget packages Whatever documentation we put on the files, they were not available, because if you don't put the GenerateDocumentationFile tag then it's not generated in the XML file that contains all the documentation, it's not embedded into NuGet, and Visual Studio won't load it. You need that to export your API docs. Not even to generate documentation, just to be able to have it in the NuGet package for the IntelliSense. If you don't do the NoWarn, every public member that doesn't have an API doc would fail the build. The <NoWarn>$(NoWarn);CS1591</NoWarn> removes the warning that some public members do not have comments. Now you will have more documentation when they use the NuGet packages to build sites! Distributed cache Whenever you want some cacheable document that is stored in the storage using YesSq for instance you need to inject the IDocumentStore interface. This will use YesSql to load the document and it will be able to cache it. So, for instance, if you would like to get the site settings you can use the IDocumentStore to do that because it's stored as a document and you want to cache it. And then when you load the site settings using IDocumentStore by passing the type, you can say GetOrCreateImmutableAsync or GetOrCreateMutableAsync. Mutable meaning that when you load the site settings just to read it, you want to say I want an immutable object. And when you want to load the site settings to update it, then use the GetOrCreateMutableAsync method. The difference is in the way that it will either cache it or not and also would it take it from the cache or not, or put it back in the cache or not. Or invalidate the entry in the cache. And there is the IFileDocumentStore which has the same methods as the IDocumentStore, but it's a totally different service. This one can be used to store a document on the file system that can be also cached. But it's a different store. We use the IFileDocumentStore to store the content type definitions. Demos Media crop picker and Alt text editor Set up your site using the Blog recipe. That recipe comes with the Blog Post content type that has the Banner Image Media Field by default. Let's check out the predefined blog post content item to see the new features of the Media Field. If you select the post-bg.jpg image and click on the button with the speech bubble icon, you can set the alt text for the image. Another new button is doing a more interesting thing. If you click on the button with the target cross icon, another new modal window will open where you can select the anchor for the selected image. Using the target cross, you can easily specify the crop point of the image. If you open the preview in another window you can easily see the changes of the image in real-time. But how you can enable/disable these options? Navigate to Content -> Content Definition -> Content Types and hit Edit near the Blog Post and edit the Banner Image settings. Here you will find two new options. One is about allowing alt text and one is to allow the center cropping. These are on by default, that's why you could see the mentioned buttons when you edit the media field. And that's not all! If you would like to know more about this feature don't forget to check out this recording on YouTube! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 172 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!

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!

4 ways to display something from your module nested within a page in Orchard Core - Orchard Core Nuggets

A common question during Orchard Core development, something that came up again recently, is how to display something within the context of an Orchard page when that piece of data comes from your module? How can you "inject" something into the Orchard layout when you want to display e.g. a list of products retrieved from an external API? There are a couple of ways to do this depending on what exactly you need. All are fairly straightforward so let's see a quick rundown! Creating a whole page from you module If you want a whole page served by just your module then it's really simple: Create a module, add a controller as you'd do in standard ASP.NET Core MVC, make an action produce a view and that's it! The view will be wrapped into the Orchard layout so the theme you've selected will be visible around it: The basic styling will be there, the header and menu, any widgets you have put onto layers... Our Training Demo module has a simple sample exactly for this, just check it out and you'll see what we're talking about. The above screenshot comes from our Open-Source Orchard Core Extensions solution BTW. Creating a widget Widgets (see official docs) are basically little boxes of content or other functionality that you can put anywhere on the site. For example, an infobox about the site, a search box, a recent articles box, a footer can all be widgets. You can use them in two ways: Add a widget to a content item with Flow Part: Flow Part can be used to build flexible layouts out of various widgets, including nesting them (like putting widgets into a Container Widget). When you set up Orchard with the built-in Agency recipe and theme then you'll get a Page content type that has Flow Part out of the box: You can get the same content type from our Helpful Extensions Orchard Core module too. Another option to use widgets is to put them onto a layer, a sort of container of widgets. There you can place the widget into a global zone, an area of the Orchard layout, like the header, footer, or sidebars. The widgets on a layer will be displayed whenever the layer rule of that layer matches (you can think of it as a logic expression producing a boolean value), like on every page except the home page or on every page but only for authenticated visitors. For more info check out the docs. OK, but how can you create a widget? A widget is just a content item whose content type has its stereotype set as "Widget". You can change this value from the admin from under Content / Content Definitions and also from code. So, basically, the task is to create a content part of yours that'll display the data you want to show from its driver, then create a widget content type where that part is attached. Seems like a lot? It isn't, check out the relevant content part development tutorial again from the Training Demo, including creating a widget. Injecting a shape into the layout This can be a lot easier than developing a widget but also less flexible to use. You can also write your own code in a template (like a cshtml Razor file) and inject that into the Orchard layout directly. You can see an example of injecting a shape in the Training Demo module too. Displaying a shape from a Liquid Widget The Liquid Widget is a widget that can render a piece of Liquid markup. While there is such a widget in the Agency theme and you can throw it together from the admin quickly too the Helpful Libraries module has it built-in as well. With this widget and Orchard's pretty advanced Liquid support you can of course just write Liquid directly. However, for more complex apps maintaining templates editable from the admin quickly becomes an issue so we'd recommend keeping code in your modules and themes. The good news is that once you have a piece of Razor code in a cshtml template (or Liquid in a .liquid template) then you can just display it from a Liquid Widget! For example, if you have a WeatherData.cshtml template fetching some weather information from an external API then you can display it from a Liquid Widget, and thus use it just as any widget with this little piece of code: {% shape "WeatherData" %} There's more to it, check out the docs on the shape Liquid tag. Conclusion Pretty much that's it. There are other ways too but these are the most straightforward and most flexible ones. Do you have another technique you'd like others to know? Add below in the comments! Did you like this post? It's part of our Orchard Core Nuggets series where we answer common Orchard questions, be it about user-facing features or developer-level issues. Check out the other posts for more such bite-sized Orchard Core tips and let us know if you have another question!

Taxonomy and contained content items routing, new options for TitlePart and AliasPart - This week in Orchard (28/02/2020)

New options for TitlePart and AliasPart, adding CodeMirror support for HtmlBodyPart and HtmlField, the Pager shape and demo about the taxonomy and contained content items routing are waiting for you in our upcoming post with many other cool features! And about the news from the community: there is a new Orchard Core website, news about the upcoming Harvest and welcome a new team member in Lombiq Technologies! Orchard Core updates Disable feature confirmation messages When we disable a feature we will get a warning that says that the feature that you would like to disable has dependent features that are enabled. Let's disable the Widgets feature. In this case, we will get the following warning message, because Flows and Layers are built on the Widgets module. New options for TitlePart and AliasPart There is a new setting, called AliasPartOptions. Using this new option you can define that the alias can be editable when editing a content item from the admin UI or make it disabled, which means it will be generated automatically using the defined pattern. And when using the TitlePart, you will also find a new option there, called EditableRequired. This means admins can edit the title of the content item and it needs to have a value because it's required. Html mode for CodeMirror on HtmlField and HtmlBodyPart standard editors CodeMirror is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code and comes with a number of language modes and addons that implement more advanced editing functionality. And now if you set up your site using the Blog recipe and create a new article, the editor of the HtmlBodyPart will come with the CodeMirror support! Furthermore, the Standard editor mode of the HtmlField is also got the CodeMirror support. Moreover, Orchard Core using the latest version of CodeMirror, which is 5.52.0. Pager shape At the bottom of the documentation of OrchardCore.Navigation you will find code examples both for C# and Liquid about how to use the Pager shape in Orchard Core. Add a recipe step to create scope for OpenID Now you can set the connect scope of the OpenID using recipe steps, that you can do in the following way, that could be found in the documentation of OrchardCore.OpenId. There is also a possibility to set the Token Validation Settings with recipe steps. Here you have to provide: Name: unique name of the validation settings. Audience: defines the intended recipient of the token that must be checked. Authority: the address of the remote OpenID Connect server that issued the token. Filter deployment steps There is a new search box on the UI for the deployment steps to filter the list of the available steps. To check out this feature create a new deployment plan under Configuration -> Import/Export -> Deployment Plans then add a new step to it. In this modal window, you will find the textbox with the Filter placeholder text in it. In our case, we typed settings, which means these three steps will be the results of our search. Sitemaps module We wrote about a very cool feature for Orchard Core, which is the Sitemaps support three times now: here, here and here. In every post, we described the features of this module and showed the way how you can use them. And you can also find a recording of this feature on YouTube. The reason why we mentioned that is because this feature is now merged in the dev branch of Orchard Core, thanks to Dean Marcussen! He also added nice documentation about how to create sitemaps, localize sitemaps, cache sitemaps and so on. Setting and Removing HttpContext.Items from Liquid template Now there is a new Liquid filter called httpcontext_add_items, that adds key/value to the HttpContext.Items collection. And you can also remove items from the HttpContext by using the httpcontext_remove_items Liquid filter. You can read more about these two new Liquid filters in the documentation. Do note though that there are possible security implications to this, see the discussion under the pull request. Support most commonly used error pages According to Pingdom research, the top 5 most common errors are 401, 400, 404, 403, 500. So, this is about adding more custom views for error codes that you can change in your themes. Check the content of the DiagnosticsController.cs in the OrchardCore.Diagnostics module. Demos Taxonomy and contained content items routing The main issue is that currently we don't have routing for taxonomies or contained content items. The taxonomy routing is about we would able to route an item inside a taxonomy for a term. The goal is to be able to list all the things that are associated with this term. The issue is that in the case of BagParts or anything that is contained in a content item can't be routed right now, because Autoroute doesn't work on sub-content items. The second thing we looked at was the dynamic routing to be able to define a patterned route in a content item. In this case, multiple URLs would match the same content item and the content item could use these route values to render something differently or do queries. These are two different things, but we are talking about them at the same time. If you are interested in how to do that in Orchard Core check out the following demo on YouTube about this upcoming feature! News from the community A new website using Orchard Core Luxury Card is a global leader in the premium credit card market. From patented metal cards to a 24/7 Concierge service and app, their mission is to shape the industry with innovation, value, and service. With leading airfare and cashback redemption rates along with first-class benefits, they believe your credit card can pay for itself. 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. Freshest news about the next Harvest We have a room booked for the dates June 22-24. This is the reserved interval that we will have for sure now. The maximum people can fit in the room is 50 people. The only concern is that it could be not enough, it would be nice to know how many people are interested in coming to the next Harvest. There will be a questionnaire or something to be able to measure somehow the number of people who could be the possible attendees at the next conference. New team member in Lombiq We have a new team member, Gábor! Turned from English studies to competitive gaming to software development and Orchard Core. Check out his bio on our About us page! Orchard Dojo Newsletter Now we have 119 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

How to use the same version of Orchard Core NuGet packages in every project across my solution? - Orchard Core Nuggets

You have your own ASP.NET Core project that using Orchard Core NuGet packages, but every time when you update them you have to do it one-by-one across the whole solution? Wouldn't it be easier to just update the package versions in one place? Then you may need to have a Directory.Build.targets file to define the versions! MSBuild projects that use the standard build process (importing Microsoft.Common.props and Microsoft.Common.targets) have several extensibility hooks that you can use to customize your build process. Directory.Build.targets is imported from Microsoft.Common.targets after importing .targets files from NuGet packages. So, it can override properties and targets defined in most of the build logic, but sometimes you may need to customize the project file after the final import. Without going into too much detail, Directory.Build.targets can be used to provide customizations to project files located under a certain directory, this means that if you create such a file at the root of your solution, it would normally be able to customize all the .csproj files in your solution as they would exist in the child directories. Let's see a small example! Imagine you have an ASP.NET Core web application with a MyAwesomeWebApp.Web.csproj file. If you referenced Orchard Core in this project, your file contains a similar section: <ItemGroup> <PackageReference Include="OrchardCore.Logging.NLog" Version="1.0.0-rc1-10106" /> <PackageReference Include="OrchardCore.Application.Cms.Targets" Version="1.0.0-rc1-10106" /></ItemGroup> I assume you also have some custom modules and themes in your solution. The .csproj file of your module (MyAwesomeModule.csproj) could contain a section like: <ItemGroup> <PackageReference Include="OrchardCore.ResourceManagement" Version="1.0.0-rc1-10106" /> <PackageReference Include="OrchardCore.DisplayManagement" Version="1.0.0-rc1-10106" /> <PackageReference Include="OrchardCore.Module.Targets" Version="1.0.0-rc1-10106" /></ItemGroup> where the OrchardCore.Module.Targets is mandatory if it is a module. Imagine that your theme (MyAwesomeTheme.csproj of course) has the following: <ItemGroup> <PackageReference Include="OrchardCore.Theme.Targets" Version="1.0.0-rc1-10106" /> <PackageReference Include="OrchardCore.DisplayManagement" Version="1.0.0-rc1-10106" /> <PackageReference Include="OrchardCore.ResourceManagement" Version="1.0.0-rc1-10106" /></ItemGroup> You can see that we referenced OrchardCore.DisplayManagement and OrchardCore.ResourceManagement packages multiple times. If there will be a new release of Orchard Core we have to make sure that we use the same versions of every package across the whole solution. And if we have several projects we have to change the version numbers in every project one by one. To solve this issue add a Directory.Build.targets file at the root of your solution. We set the version in this file and specify how each <PackageReference /> should be updated by MSBuild. Note that here we have to use Update instead of Include. <?xml version="1.0" encoding="utf-8"?><Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <!-- Implicit Package References --> <PackageReference Update="OrchardCore.Application.Cms.Targets" Version="1.0.0-rc1-10106" /> <PackageReference Update="OrchardCore.DisplayManagement" Version="1.0.0-rc1-10106" /> <PackageReference Update="OrchardCore.Logging.NLog" Version="1.0.0-rc1-10106" /> <PackageReference Update="OrchardCore.Module.Targets" Version="1.0.0-rc1-10106" /> <PackageReference Update="OrchardCore.ResourceManagement" Version="1.0.0-rc1-10106" /> <PackageReference Update="OrchardCore.Theme.Targets" Version="1.0.0-rc1-10106" /> </ItemGroup></Project> Now let's rewrite the content of all the .csproj files and see the result of the MyAwesomeTheme.csproj for an example! The Include attribute specifies the package ID and the Version attribute specifies the version of the package to restore. But as you can see here the only change we did is to remove the Version attribute. <ItemGroup> <PackageReference Include="OrchardCore.Theme.Targets" /> <PackageReference Include="OrchardCore.DisplayManagement" /> <PackageReference Include="OrchardCore.ResourceManagement" /></ItemGroup> Now nothing will stop you from easily update the Orchard Core NuGet packages of your ASP.NET Core website! Did you like this post? It's part of our Orchard Core Nuggets series where we answer common Orchard questions, be it about user-facing features or developer-level issues. Check out the other posts for more such bite-sized Orchard Core tips and let us know if you have another question!

Diving into the Orchard API - Dojo Course

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

Content Part development continued - Dojo Course

UPDATE (2017-11-22): Dojo Course 2 is released with new, updated videos! This week on Dojo Course we are giving life to our content part by adding several Orchard-y code pieces to it, though the result is far from being Frankenstein-like. While doing that, we also discover some interesting and useful pieces of the Orchard API. Creating a migration for our Contents feature. Difference between ContentPartRecord and ContentPartVersionRecord: versioning content parts. Making your content part attachable to content types (on the Admin UI). Creating a content type using migrations and attaching parts to it. Creating a handler for our content part to do some plumbing (e.g. StorageFilter). Creating a driver for our content part to cover server-side part of the the user interface interaction. How displaying a shape works, what is DisplayType? Shape templates (also editors) and using Placement. Using InfosetPart to store a part's data in the content item's XML infoset document. This eliminates content part record lazy loading, providing a significant performance gain. The importance of driver shape factories. How to make your content part support importing and exporting? Remember: if you have any questions don't hesitate to ask them by creating a new issue in the Orchard issue tracker with the "discussion" label. Make sure to prefix your thread's title with "Dojo Course - "! We keep an eye on these issues. Also follow us on Twitter to get notified about the latest Dojo Course news, including when a new tutorial is posted. Do you have some feedback about the course? Please send it in. Haven't you enrolled yet? Why not do it some time in the near future like right now?

Data storage and content part development - Dojo Course

UPDATE (2017-11-22): Dojo Course 2 is released with new, updated videos! How to upgrade my table schema? How to store and retrieve records from my tables? How do I upgrade from using a plain set of records to using a content part? This week on Dojo Course we are moving on to uncover the mysteries of content parts. Making modifications to your Migrations classes: how to use the update methods. Quick recap on Dependency Injection and creating a service class to handle our records. Benedek has problems with typing when he knows he's being watched (actually, Zoltán as well) :). Difference between requiring a single and list of dependencies. How to (and how not to) use IRepository<T> to store and retreive records. Based on what we learned about records, we are starting to develop our first content part. Dividing your module into features (subset of functionalities) and declaring dependencies between them. Assigning pieces of code to specific features using the OrchardFeature attribute. Remember: if you have any questions don't hesitate to ask them by creating a new issue in the Orchard issue tracker with the "discussion" label. Make sure to prefix your thread's title with "Dojo Course - "! We keep an eye on these issues. Also follow us on Twitter to get notified about the latest Dojo Course news, including when a new tutorial is posted. Do you have some feedback about the course? Please send it in. Haven't you enrolled yet? Why not do it some time in the near future like right now?