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

Featured tags

IIS
API
SMS
SEO
All tags >

Distributed cache, YesSql improvements - This week in Orchard (09/10/2020)

Get ready for the upcoming additions of Orchard Core! This week you can see demos about adding distributed cache to Orchard Core and the latest improvements of YesSql! Orchard Core updates Restrict Content Types Admin Node to only create the specified content type Let's say you have a site set up with the Blog recipe and your goal is to add a new admin menu that is about to list all the existing Article content items. To do that you have to navigate to Configuration -> Admin Menu and click on the Add Node button. Here you will need to select the Content Types Admin Node because you would like to add a link for each one of the selected content types from the list. And yes, you will only select the Article content type in the next screen. And that's it, you have created a new admin menu that lists all of the Article content items from the system. If you click on that you will see the list of the Article content items. Note that from now you will not see a filter here to filter by content types because that really doesn't make much sense. You created this Content Types Admin Node to list only the Article content items. If you would like to filter by content type, use the filter in the Content -> Content Items page as you would do it before. Remove ManageOwnMedia permission The ManageOwnMedia permission isn't handled today and we can replace it with the ManageMedia permission. So, now there is no separate permission to manage their own media or manage the media. It will be added back to the system again if the authorization logic is to be able to separate the user's media and the media uploaded by others. Right now, if you head to Security -> Roles and hit the Edit button near one of the Roles, you will see the missing Manage Own Media permission. Use a dropdown menu on the admin top navbar for the user menu The user menu on the admin theme is just about listing the user name of the currently logged-in user with a little icon near it. And there was a Log off link at the right side of the user name. It was just a piece of HTML code in the Layout.cshtml file of the default admin theme. From now the whole user menu gets its own shape, called UserMenu.cshtml. If you would like to override the user menu, you don't need to create a Layout.cshtml file in your admin theme, you just need to override the UserMenu.cshtml file. And if you check out this GIF, you will see that now the content of the user menu is placed in a dropdown instead of having it's content inline. Document release procedure Orchard Core is open-source that means you can check out and request changes to the source code, tell your opinion about it, and update the relevant documentation for that piece of code. Now there is a new page in the Orchard Core Documentation about how to publish a new Orchard Core release. These notes are primarily for Orchard's core contributors to guide them on how to prepare a new release, but if you just take a look at these you can now see what are the steps that need to be done to be able to ship a new release of Orchard Core. Add option to allow Lucene query syntax in the search There is a setting in the Lucene module that you can turn on and whatever you type in the search box won't be parsed as 'these are the words that I need to search on', but parsed as this is a Lucene query. You can use the Lucene query syntax in search forms, like the quotes, plus signs and things like this. But by default, it will still be like today, which is type words and it looks for these words. If you type stuff that has weird characters, they would be ignored. But how can I turn on that feature? Just navigate to the admin UI of Orchard Core, then find the settings in Search -> Settings -> Search (make sure you have enabled the Lucene module). Demos YesSql: Adding support for multi filters on the same table index There is a new method on .IQuery called .Or(), which starts a filter on a distinct table. This can be used for instance when the same index needs to be queried for multiple sets. It will actually add many filters on the same record of the index. With .Or() you can do now filters on different inner joins of the same index. Which means it will do unions of result with the filters. Let's check out the following unit test. [Fact]public async Task ShouldQueryMultipleIndexes(){ // We should be able to query documents on multiple rows in an index. // This mean the same Index table needs to be JOINed. _store.RegisterIndexes<PersonIdentitiesIndexProvider>(); using (var session = _store.CreateSession()) { var hanselman = new Person { Firstname = "Scott", Lastname = "Hanselman" }; var guthrie = new Person { Firstname = "Scott", Lastname = "Guthrie" }; session.Save(hanselman); session.Save(guthrie); } using (var session = _store.CreateSession()) { Assert.Equal(2, await session.Query<Person>() .With<PersonIdentity>(x => x.Identity == "Hanselman") .Or() .With<PersonIdentity>(x => x.Identity == "Guthrie")) .CountAsync()); }} This PersonIdentitiesIndexProvider will just map the first name and the last name of each person. We created two persons here that means the provider will be creating four PersonIdentity records. Two to store the first name and last name for Scott Hanselman and two to store the first name and the last name of Scott Guthrie. If without using the .Or() it will issue a query where the Identity == "Hanselman" AND Identity == "Guthrie", which will return nothing. With the .Or(), it will do an inner join on PersonIdentity with a filter on Identity == "Hanselman" and another inner join on PersonIdentity with a filter on Identity == "Guthrie". In this case, we will get both the two persons. It's like give me any person who's PersonIdentity has a record like Hanselman OR where the PersonIdentity equals Guthrie. Let's see another example! // Creating articles.using (var session = store.CreateSession()){ session.Save(new Article { Content = "This is a green fox" }); session.Save(new Article { Content = "This is a yellow cat" }); session.Save(new Article { Content = "This is a pink elephant" }); session.Save(new Article { Content = "This is a green tiger" });}using (var session = store.CreateSession()){ Console.WriteLine("Boolean query: 'pink or tiger'"); var boolQuery = await session.Query<Article>() .Where(x => x.Word.IsIn(new[] { "pink" })) .Or() .Where(x => x.Word.IsIn(new[] { "tiger" })) .ListAsync();} This is a full-text sample where in this case we can query documents by their content, by their words. If we have the documents as you could see in the code, we are creating an index for all the words pointing to the document, like green and fox points to the first Article. Now the query is about to give me all the documents that have pink in it OR all the documents that have tiger in it. The goal is to get the last two articles in this case. Let's check out this query: var boolQuery = await session.Query<Article, ArticleByWord>().Where(a => a.Word.IsIn(new[] { "white", "fox", "pink" })).ListAsync(); This query will return all the articles that have white AND fox AND pink in it and there is none in this case. You can find the recording of this improvement on YouTube! But wait a minute! Could this syntax be better? When you have a query, you can say .Any() and every predicate will be done in a different table. .Any() being an OR, and .All() being an AND. In this case, we're querying on the same index (ArticleByWord) but each of the calls on .With() will be a different projection, a different inner join in this case. Here we are looking for an article that has the word pink OR the words green AND fox. await session.Query<Article>() .Any( x => x.With<ArticleByWord>(a => a.Word == "pink"), x => x.All( x => x.With<ArticleByWord>(a => a.Word == "green"), x => x.With<ArticleByWord>(a => a.Word == "fox"))).ListAsync(); SELECT DISTINCT Document.* FROM DocumentINNER JOIN ArticleByWord_Document AS [ArticleByWord_Document_a1] ON ArticleByWord_Document_a1.DocumentId = Document.IdINNER JOIN ArticleByWord AS [ArticleByWord_a1] ON [ArticleByWord_a1].Id = ArticleByWord_Document_a1.ArticleByWordIdINNER JOIN ArticleByWord_Document AS [ArticleByWord_Document_a2] ON ArticleByWord_Document_a2.DocumentId = Document.IdINNER JOIN ArticleByWord AS [ArticleByWord_a2] ON [ArticleByWord_a2].Id = ArticleByWord_Document_a2.ArticleByWordIdINNER JOIN ArticleByWord_Document AS [ArticleByWord_Document_a3] ON ArticleByWord_Document_a3.DocumentId = Document.IdINNER JOIN ArticleByWord AS [ArticleByWord_a3] ON [ArticleByWord_a3].Id = ArticleByWord_Document_a3.ArticleByWordIdWHERE ArticleByWord_a1.Word = 'pink' OR ( ArticleByWord_a2.Word = 'green' AND ArticleByWord_a3.Word = 'fox') Here you can also see how does the query look like. That's the current syntax right now. And it's not breaking change because if you had .query.With().With(), it will still behave the same as before. It will be a single projection with two .With(). If you project on the same table it will be an AND on the same table, the same projection.If you would like to know more about the current syntax and the latest features, this is the YouTube video that you are looking for! Distributed Redis Cache There is a huge PR with a great addition to Orchard Core about having Distributed Cache in Orchard Core. In fact, this PR is related to all modules services using cached data that need to be in sync with a shared database, e.g. site settings and other admin settings, templates, queries, layers, and so on. Currently, in the dev branch, this is already the case for most of them but by using local memory cache entries that are invalidated through a distributed signal. This PR has changed this pattern by using a multi-level cache including a distributed cache. And Jean-Thierry Kéchichian made more services to be distributed aware, there are remaining things but could be done in other PRs. And recently he added the ability through a separate feature to also keep in sync tenant states, when you enable/disable/create/setup a tenant. To summarize: All services that were using the memory cache are now using a multi-level cache including a distributed cache, this cache is kept in sync with the database without using a message bus but document identifiers. We have concrete implementations of distributed services based on Redis, Redis cache, Redis data protection, Redis message bus, and Redis lock. In the current code, we never use a message bus/distributed lock. When enabling a concrete distributed cache in the default tenant, we automatically keep all tenants in sync through a hosted service, here also without using a message bus but identifiers. Here a stateless configuration is needed. There is a separate feature (DefaultTenantOnly) to keep tenants in sync. Don't forget to head to YouTube and watch the recording of this upcoming feature! News from the community Orchard Dojo Newsletter Lombiq's Orchard Dojo Newsletter has 160 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!

Shape Components, new Anchor Tag Helper - This week in Orchard (11/09/2020)

We prepared with an interesting topic for this week about how could you use shapes like reusable Angular components? But before that, we checked the latest updates of Orchard Core, like the new updates around Tag Helpers. Orchard Core updates Add UI permissions based on the user role This is about hiding some buttons based on the permissions, instead of returning the 401 page when clicking on those. What do we mean? Well, let's say we have a permission that doesn't contain a role to publish or unpublish pages. That means users with that permission can't see the Publish button at the bottom of the editor in a case of a Page content item. Meeting information in the documentation When you open the Orchard Core documentation page and navigate to Resources, you will find a new link in the Resources column at the left called Meeting. If you click on that you will see a brand new page where you can find every relevant information about the steering committee and the triage meetings. Support for dropping a password from a password manager during setup Some password managers let you drag and drop a password to a textbox. During setup, if we do this rather than focus then type or paste, the tick appears in the input, but the strength indicator doesn't update and clicking Finish setup just does nothing with no indication. The fix was to update the strength.js file to check for the drop event. Add missing Tag Helper references The root of this issue was the Tag Helpers are found during development because of the runtime compilation. But when you change the environment from development to production, it stops working if you don't have a direct reference on the ResourceManagement project. The compilation doesn't find the issue, because it's a runtime resolution. Yes, you can use the a tag it will compile, but in runtime, it has a different behavior based on the projects you reference and you don't get the behavior you expect. The only thing you can do is to have a functional test to be sure that it would work. Tag Helper for the anchor tag with asset-href attribute Added an HtmlTargetElement to the Anchor Tag Helper to also address anchor tags with asset-href attributes. Added needed const and property and changed the Process logic to require non-null asset-href for anchor tags. So, if you use the asset-href in the anchor tag, it will convert the URL of a media URL to a public URL. Demos Shape Components What makes it hard to build a new site using Orchard Core? The ultimate solution would be to remove the templating in Orchard and just use decoupled. So, you don't have to know about shapes at all. And then you just write your pages, your controllers, you have lot's of APIs to get your content, you can reuse ASP.NET caching and do your decoupled site like this. It would be a decoupled site. Let's just forget about shapes and rendering everything from modules. Just let people render their own things and provide tools to render the site. It might be slower at first to build the site, but they will never be blocked by 'I don't know what a shape is.' or 'I don't understand how shapes work.', 'What is placement?' and so on. We have themes and recipes today that build some predefined solutions, like a blog or an agency site and they can be extended to anything. For that, you still have to understand all the shape- and display mechanisms to build these elements. A new solution would be to still create recipes, but recipes that would contain Razor Pages and controllers and anything that would build a blog even if we didn't have shapes and placement and everything. Like build a decoupled site that is a blog and this is the recipe. When you install it you have the same blog, the same theme working and if you want to change it, you don't have to learn shapes. You just look at the page that renders the blog, the blog post and you just change it. Or you create a new one and change the code directly. This would be just ASP.NET, there is nothing new to learn out of ASP.NET. That would be a solution to have. But let's say the issue is not about the shapes, because shapes are great. The issue is zones and placement. And these are harder to learn. Shapes in the end, if you just take shapes by themself, they are just dynamic ViewModels that have alternates and that can be rendered using templates. It's like a view component in ASP.NET. But it's like a view component with more features like it can have an ID, CSS classes, attributes, it can have dynamic behavior, it can have a caching, it has alternates. So, it has a dynamic resolution of templates, which the view component doesn't have. Let's think about a shape like a reusable component, like a view component in ASP.NET, but like an Orchard shape component, that can be reused. Were we able to pique your curiosity? Then just navigate to YouTube and see this exciting demo about shape components! News from the community Orchard Dojo Newsletter Now we have 160 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!

Shape Tracing Helpful Extensions, Alt and Class attributes for the Image Shortcode - This week in Orchard (28/08/2020)

New guides in the Orchard Core documentation to learn how to build a blog that allows users to login with their AzureAD account and gets assigned roles based on the Security Groups they belong to, and how to create a Deployment Plan to migrate from the File Content Definition feature. After we will show you our new Shape Tracing Helpful Extensions feature! Orchard Core updates Content definition stores guide Now you can find a new small guide in the Orchard Core documentation that explains what the File Content Definition feature is, and how to create a Deployment Plan to migrate from the File Content Definition feature. Implement class and alt attributes for ImageShortCode Shortcodes are small pieces of code wrapped into [brackets] that can add some behavior to content editors, like embedding media files. The Image Shortcode can be used to display an image from the media library in your WYSIWYG editors. The simplest way to use that Shortcode is the following: You can also provide several attributes, like the width, height, and mode. And now you can also pass the alt attribute that specifies an alternate text for an image if the image cannot be displayed. And you can pass your custom classes too! In the following line we used the Image Shortcode with multiple parameters: Users with Manage Users permission can't delete themselves or change their roles If you try to delete the admin account and you are currently the admin what you could do is actually block everyone from being able to edit the site if the admin is the only user. The idea here is that you can't delete yourself. If you navigate to Security -> Users and edit the admin user, you will see that the editor of the roles and the Is enabled? checkbox are disabled. Don't Detach a document already loaded for update This is about how documents are loaded from cache stores. If you use the ASP.NET caching abstractions you can store in the IMemoryCache or in the IDistributedCache. The main difference between these two is that in the IDistributedCache you would put stuff that has to be and can be serialized. In IMemoryCache you can put stuff that is not serialized. It's a live object that can be changed and updated. There is a new method for documents in the ISessionHelper called GetForCachingAsync that gets a single document (or create a new one) for caching and that should not be updated, and a bool indicating if it can be cached, not if it has been already loaded for an update. Note that for full isolation, it needs to be used in pairs with the LoadForUpdateAsync method that loads a single document (or create a new one) for updating and that should not be cached. When you call the GetForCachingAsync method you say that the object that you want to load from the database will be cached, which means you should not change it. You should not be able to update it, it's for caching. When you get a document from the database from this layer it will tell you if you are allowed to change it or not. This way you know you can put it in a durable cache or a live cache. Use Azure AD as an external identity provider guide In order to authenticate users with AzureAD, you must enable and configure the OrchardCore.MicrosoftAuthentication.AzureAD (you can learn more about here) and the OrchardCore.Users.Registration features. There is a new guide in the documentation where you will learn to build a blog that allows users to login with their AzureAD account and gets assigned roles based on the Security Groups they belong to. Demos Shape Tracing Helpful Extensions Lombiq Shape Tracing Helpful Extensions adds a dump of metadata to the output about every shape. This will help you understand how a shape is displayed and how you can override it. But let' see how you can use it in your solution! Imagine you have a NuGet-based Orchard Core solution and you would like to use the Shape Tracing Helpful Extensions. For that, you have to clone or download the orchard-core-preview branch of the Helpful Extensions repository that is targeting a recent nightly build of Orchard Core and you will only find the Shape Tracing Helpful Extensions in that branch. Now head to the GitHub repository of the Helpful Libraries module (same branch) and clone or download that too. You will need this library to use the Helpful Extensions. Now add these as an existing project to your solution and don't forget to check the project reference between these two! Reference the Lombiq.HelpfulExtensions module in your Web project and now you are ready to go! Set up a site using the Blog recipe then navigate to Configuration -> Features and search for the word helpful. Here you can find all of the following independent extensions of the module. If you are interested in the other ones too, check out the Readme.MD file of the repository for more! Now we will enable the Shape Tracing Helpful Extensions - Lombiq Helpful Extension feature. After you will get a dump about shapes in the HTML output. Just view the page source where you will see several comments in the code. These are generated when the shape is displayed that gives you some basic debug data. You can use these to actually override the shape. If you navigate to the detail view of the built-in blog post, you will see every relevant data that could be important for you to override the given shape, check the display type, the position, the differentiator, the wrappers of the shape and many more! But that's not all about Shape Tracing Helpful Extensions! If you would like to see more, don't forget to check out this recording on YouTube! News from the community Orchard Nuggets: How to debug a NuGet-based Orchard Core solution? How can you debug Orchard Core code when you're working with a solution that loads Orchard packages from NuGet? Easily! In our newest Orchard Nuggets post, we give you the answer! Check out the other posts for more such bite-sized Orchard tips and let us know if you'd have another question! Orchard Core workshops The contributors of Orchard Core will hold some unique online workshops in 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 160 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!

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!

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!

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

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

Sortable lists, IScopedDistributedCache - This week in Orchard (17/01/2020)

Get ready for a deep dive! In our post, we will introduce the IScopedDitributedCache service and show how to use it in the RoleStore. And we are going to solve the mystery about do you need the Model prefix to access different kinds of properties of a model in Liquid and in Razor too? Orchard Core updates Document recipes new Lucene settings There is new documentation on the updated Lucene index settings. Now to create an index from a recipe, it's not just about passing the name of the analyzer. You have to provide the following: AnalyzerName: the name of the analyzer, that you want to use. IndexLatest: a boolean value that indicates that if you want to index the latest or just the published versions. IndexedContentTypes: the list of types you want to index. Re-use in some places the ContentItem Liquid property There was a change in the Liquid TemplateContext, that broke some properties, that are available in the templates. If your AliasPart, AutoroutePart or Workflows patterns don't work anymore, it's because of the previous change. Now, this issue has been fixed. For example in an Autoroute pattern that used to render the custom URL of the content type you could do something like: {{ ContentItem.DisplayText | slugify }} That will generate a nice text for your routes. But in some cases, you have to write {{ Model.ContentItem.DisplayText | slugify }}. Maybe using the Model prefix is collateral damage, but maybe it has a purpose. Anytime we have a Liquid template for a shape we do Model.ContentItem to get the ContentItem. In Razor everything is Model.Something. It has to be because in Razor we are doing C# and the current context is the page and the page is a class that doesn't have our properties like @ContentItem. So the only thing we could get is the @Model that is typed to the generic type of the RazorPage and Model will provide all the properties like the ContentItem. Because we do too much Razor, it could be possible that we reused this approach into some Liquid patterns. In Liquid it's not necessary to have the Model prefix. But it appears that there is already a way in Fluid to use a first-level model without a custom prefix (so we don't need a Model prefix), by setting the TemplateContext.Model property. In conclusion: in Liquid that is easier to write {{ ContentItem.DisplayText }}, you don't need the Model prefix. But in Razor, you have to use the Model prefix. Constraint admin controllers to mapped routes Since we can change the prefix of the admin route, we have to ensure that every admin controller's actions have the correct prefix to use. There is an implementation of the IActionConstraint, called AdminActionConstraint, that checks if we are in the admin and the route doesn't start with the admin URL prefix (_adminUrlPrefix), then it will create a warning log entry. So, the AdminActionConstraint applies a convention that restraints all AdminControllers or [Admin] controllers to use the mapped route only, and not the default route applied by MVC. Fix the recipes not found bug in the documentation We have a guide about how to create a new decoupled CMS Website using Orchard Core. It told you to add the OrchardCore.Application.Cms.Core.Targets NuGet package to your new ASP.NET Core project, because this package won't contain the themes. And when you do a decoupled CMS site you will don't need the themes, because you want to create your own front end. The issue is with this package on the master branch is that the setup doesn't contain any recipe in the RC1 version. The community fixed that bug for now, but it's just in the dev branch yet. So, if you follow the guide and you using the RC1 version of that package, when you arrive at the setup screen you will not be able to set up the site because there will be no recipe to choose from. Mitigation is to use the OrchardCore.Application.Cms.Targets package, that contains all the themes and recipes. Of course, in this case, you will get several unwanted themes, but you will not be blocked to continue following the guide. So, it's not the perfect solution, but when there will be a new version of Orchard Core, we can rewrite this back to use the OrchardCore.Application.Cms.Core.Targets NuGet. There is also a hint about if you are using the nightly builds of Orchard Core then you should use the Core package instead. Creating IScopedDitributedCache The main goal is to increase the performance of Orchard Core and try to make it faster from time to time. To measure that, check the blog posts Liquid template page and start to remove everything from there. Just to see how fast could be the performance if we didn't render anything. Then start to remove stuff from the controller that displays content. For example, let's take a look at the ItemController. This is the controller, that renders content items by default. Take a closer look at the Display method of this controller! It first loads the content item. If it's not there, we return a 404. Then we check the ViewContent permission for this content item for the current user. We return Forbid if they authenticated but don't have the proper permission, or return Challange if the user is anonymous. Now let's build the display! That will build a shape containing all the part shapes and everything for this content item. So, it will render the display of this content item and we send this shape to a view that will just call Display of the shape. That's what we do in this method. The thing that made it slow actually is that one which checks the permissions, the _authorizationService.AuthorizeAsync. The user is anonymous and checking that the anonymous users could see something was the bottleneck of the performance. For each display of the site, there would be a database query just to authorize the anonymous user to be able to see something. This is actually a regression. Once you remove this code the controller will be much faster. An authenticated user would have added Claims cached in the User object. But in the case of an anonymous user, nothing was cached. Each request for an anonymous user would ask the permission for the anonymous user from the RoleStore. The RoleStore would do a query all the time. There is a new service, called ScopedDistributedCache. The idea is to use a distributed cache, such that we would store the Roles document in memory if we have a single node or in a store that is shared across every node if you have multiple nodes. Scoped means if you do multiple queries on the same cache entry for the same request, then we will load it from the DistributedCache only once. That will be much faster if you have multiple queries. You can see the usage of the ScopedDistributedCache in the RoleStore. Instead of injecting the IMemoryCache (that puts everything in the memory that shared by all the request) here comes the IScopedDitributedCache. The code is much simpler with that: you just pass it an object. Check the GetRolesAsync and the UpdateRolesAsync methods of the RoleStore. Demos Make lists sortable with ordering setting Let's say you have a site that you set up using the Blog recipe. In that recipe you can find a Blog content type, that is used as a container of the Blog Post content items. To behave the Blog content type this way, you need to add the ListPart to it, which will add the list behavior. Here you could see a new option before the Contained Content Types list, called Enable Ordering. If you check this option you will enable the manual ordering of the items. Let's put a tick here! Now head to the Content -> Content Items page and select the one named Blog (or just simply hit Blog from the menu). Here you can see the list of the blog posts contained in this blog content item. Let's add more posts to it to see the power of this new feature! By using a simple drag and drop, you can set the order of the different items and save it on the fly. Check out the following GIF to see how the reordering works! This feature is under development, but you can find the code in this pull request. And don't forget to watch the recording about this demo, where you can also hear an informative discussion about some interesting questions to solve, for example, what about reordering content items that have a published and a draft version too? News from the community New Orchard Core site: Buzz Interactive Buzz believes that great digital products are built on intelligent strategy and outstanding technical abilities. They partner with vibrant clients and help them create future-proof platforms for web, app, and VR. And they use Orchard Core for their site! 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. Tell us about your .NET performance challenges! - Hastlayer developer survey Help us build the nerdiest .NET thing, Hastlayer: It turns performance-critical sections of .NET programs into computer chips! If you fill out our short questionnaire you can win a cool compute accelerator board worth $265! Check it out here: https://forms.office.com/Pages/ResponsePage.aspx?id=Wt6elek45kStyIVVO-uCIMkFNjqW2E1Pm4v3YMcflMNUOVlDNUE3MlpDS044VDI1OEFSMUgxUkxSTC4u The reason we're asking this is that we're building a .NET hardware accelerator, Hastlayer (https://github.com/Lombiq/Hastlayer-SDK it turns your program into a chip!) and want to better understand what other developers do. Thank you in advance! Orchard Dojo Newsletter Now we have 113 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!

This week in Orchard - 12/27/2019

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

This week in Orchard - 12/20/2019

Custom parameters support in recipes, new Retrieve Content task, improved Roles UI, a new post about Orchard Core, demos about the Open Tags and the headless recipe for Orchard Core! Should I continue? Many news is waiting for you in our current post and for closing, we would like to show you some nice pics about our Christmas event! On Orchard Core Custom parameters support in recipes From now you can set custom parameters in the appsettings.json file that can be passed and used in a recipe. As you can see in the documentation, you can access a parameter value like [js: configuration('CustomParameterKey')]. For this, there is a new ConfigurationMethodProvider that receives the ShellSettings and retrieve the value to replace by ShellSettings.ShellConfiguration["CustomPropertyKey"]. Add version and target framework variables in .props Hisham Bin Ateya refactored the Dependencies.AspNetCore.props file and created a new variable named AspNetCoreTargetFramework, which contains netcoreapp3.0. Now when there will be updates on ASP.NET Core we just only need to pick this up more easily. This will simplify the process when we need to update the AspNetCore version. Here is a snippet from the Dependencies.AspNetCore.props file: <Project> <PropertyGroup> <AspNetCoreVersion>3.0.0</AspNetCoreVersion> <AspNetCoreTargetFramework>netcoreapp3.0</AspNetCoreTargetFramework> </PropertyGroup> <ItemGroup> <PackageManagement Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Version="$(AspNetCoreVersion)" /> <PackageManagement Include="Microsoft.AspNetCore.Authentication.Facebook" Version="$(AspNetCoreVersion)" /> <PackageManagement Include="Microsoft.AspNetCore.Authentication.Google" Version="$(AspNetCoreVersion)" /> ... </ItemGroup></Project> And here is a snippet from one of the modules where we use the AspNetCoreTargetFramework variable: <Project Sdk="Microsoft.NET.Sdk.Razor"> <PropertyGroup> <TargetFramework>$(AspNetCoreTargetFramework)</TargetFramework> <AddRazorSupportForMvc>true</AddRazorSupportForMvc> </PropertyGroup> ...</Project> New Retrieve Content workflow task There is a new task called Retrieve Content that tries and evaluates a content item ID from a JavaScript expression if provided. Let's see a sample workflow that has this new task in it. Here we have an HTTP Request Event as a start activity that creates a blog post that has a DisplayText: My blog post using the Create Content Task when someone invokes the URL with a GET method. The Create Content Task sets the WorkflowExecutionContext.CorrelationId (the correlation ID can be used to resume workflows that are associated with specific objects, such as content items) with the newly created content item's ID. As we mentioned, the Retrieve Content Task accepts a JavaScript expression, so here we used the correlationId() method to get the ID. The Retrieve Content Task returns the content item by it's ID and sets the WorkflowExecutionContext.LastResult with the retrieved content item. Now by adding a Notify Task, we can use a Liquid expression to display the DisplayText property of the newly created blog post content item. Finally, make a redirect to the admin page using an HTTP Redirect Task to see the displayed notification. Using custom admin URLs There is a new AdminOptions defined in the OrchardCore.Admin.Abstractions module. It tries to configure the prefix of the admin URL from the configuration and then it's creating a property called AdminUrlPrefix that is by default admin. You can change the prefix for all the admin pages. All you need to do is to add the following section to appsettings.json inside the section called OrchardCore: "OrchardCore.Admin": { "AdminUrlPrefix": "dashboard"} When you are creating a route to your AdminController, don't forget to change the route template of your controller to use this prefix like in the following snippet, which code can be found in the OrchardCore.AdminMenu module. public override void Configure(IApplicationBuilder builder, IEndpointRouteBuilder routes, IServiceProvider serviceProvider){ // Menu var menuControllerName = typeof(MenuController).ControllerName(); routes.MapAreaControllerRoute( name: "AdminMenuList", areaName: "OrchardCore.AdminMenu", pattern: _adminOptions.AdminUrlPrefix + "/AdminMenu/List", defaults: new { controller = menuControllerName, action = nameof(MenuController.List) } ); ...} Roles UI and default description We have role descriptions, but the default roles don't have any descriptions. This opens a great opportunity to improve the UI of the index and the edit pages of the Roles. In the index page, you can find the description of every role under its name and the Search box with a new UI. When you add a new role you can set its name and description. And when you edit an existing one, you can also edit its description. Here you can also find some hints about what is the difference between the Allow and Effective permissions. New post: Lucene, GraphQL and Orchard Core Sipke Schoorstra has published a nice article again in medium.com to guide people on how to implement Search using Orchard Core, Lucene and GraphQL. Read his interesting and easy to follow article about how to enable Lucene, set up a Lucene Query and consume the available APIs from Postman using Lucene and GraphQL, allowing us to use a consistent API from our applications. Demos Orchard Core headless recipe The idea of the headless recipe is to provide a recipe that sets up GraphQL, queries, and everything that has an API interface and restrict the interface down a little bit. The recipe has no home page, so when you set up your site using the recipe, you will see the login page first. And in the admin page, you will see only those options in the menu, that are related to the API interfaces. You can also watch a great detailed demo on YouTube about what will you get if you install your site using the headless recipe! Orchard Core Open Tags Last month you could see a great demo about how to work with tags using taxonomies in Orchard Core. Here we mentioned that when you add a taxonomy field to a content type with a Tags editor type and you type something in the field, you can't create a new tag that should be added to the list of tags, because that feature was under development that time. Now thanks to Dean Marcussen this is not an issue anymore. Let's see how he solved this problem! We have a site with the Blog recipe installed. Add a taxonomy field called Tags to the Blog Post content type using a Tags taxonomy with a Tag content type that has just a simple Title Part. Here use the Tags editor type with the Tags display mode. And here you could notice a new checkbox, called Open. As the hint says, if you put a tick here, you can create tags inline when editing or creating blog posts. Put a tick here and let's edit the predefined blog post! When typing something in the Tags editor and hit enter (or just click on it), you can add new tags to the Tags taxonomy and to this blog post as well. If you edit the Tags taxonomy using the dashboard you will see that the new tag has been created and the title of that tag is the value that we have just entered when editing the given blog post. If you checked the editor of the blog post well you could see that there is a section called Category with two radio buttons. But what are these for? The Category is also a taxonomy field added to the blog post with the standard editor and display mode. It uses the Categories taxonomy with the Category content type as the term. But this time the content type that is used as a term is not just about having a Title Part, but it also has a Text Field with an Icon picker editor. This means when you add Category term content types to the Categories taxonomy you can also set an icon for this term. And if you override this shape using a Liquid template or a Razor view, you can display the Font Awesome icon near the name of the term! You can also watch a nice demo on YouTube about the Open Tags for Orchard Core! On Lombiq Orchard Nuggets: How to use the same version of Orchard Core NuGet packages in every project across my solution? 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? In our second Orchard Nuggets post, we show you a way how to update the packages easily! Check out the other posts for more such bite-sized Orchard tips and let us know if you'd have another question! Christmas in Lombiq Sometimes we do stuff. Together. Not (just) in front of computer screens. These are some usual events in Lombiq that are all announced and arranged in advance. We periodically have an event called RnDay: this is a few hours long event where we share with each other what we recently worked on and what we plan to do. E.g. if we recently finished a project then the project's team members demo what they've done. Last week we had our last RnDay for this year in the Loffice Budapest, which is a coworking office with an event space where we held this event. And at the end of the day, we visited a nearby restaurant to have dinner together. We would like to thank you all for reading our posts and making the Orchard community stronger together with us! We hope that we could give you valuable news and demos about the happenings around Orchard and Orchard Core from time to time by reading our posts and of course the This week in Orchard newsletter. We would like to wish everyone a Merry Christmas with some photos of our latest event! Orchard Dojo Newsletter Now we have 109 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!