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

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

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

Latest tutorials

Featured tags

IIS
API
SMS
SEO
MCP
All tags >

This week in Orchard - 11/08/2019

Orchard Core has a brand new redesigned admin menu to help you find the settings you want easier. The CMS gets a lot of new improvements and fixes from time to time and it's time to start a discussion about releasing version 1.0. And now it's time to organize the next Orchard Harvest! Would like to know more? Then don't hesitate, check out our latest post with this week's news! On Orchard Core Add UI for PageSize You can edit the setting named PageSize that exists for a time ago, but there was no UI for it. This setting should be used when using pagers so that users can define how many items they want to see on the page. Rename Default into Current in Themes It could be quite confusing that the currently active theme is called Default on the admin UI. It's not something that would be enabled by default (since setup recipes decide this) and it's not a fallback in case of no other theme either since that's the Safe Mode Theme. So from now the new name of the Default theme is Current theme. Just head to Design -> Themes to see the changed interface. Adding token expiry for GlobalMethod and documenting scripts There was an issue with the lifetime of the workflow token. Now when you don't specify the lifetime of the workflow token you will get the value of the NoExpiryTokenLifespan variable in days, which is 100 years. Here you can see the updated code using the mentioned NoExpiryTokenLifespan variable. public class TokenMethodProvider : IGlobalMethodProvider{ private readonly GlobalMethod _createWorkflowToken; public TokenMethodProvider() { createWorkflowToken = new GlobalMethod { Name = "createWorkflowToken", Method = serviceProvider => (Func<string, string, int, string>)((workflowTypeId, activityId, days) => { var securityTokenService = serviceProvider.GetRequiredService<ISecurityTokenService>(); var payload = new WorkflowPayload(workflowTypeId, activityId); if (days == 0) { days = HttpWorkflowController.NoExpiryTokenLifespan; } return securityTokenService.CreateToken(payload, TimeSpan.FromDays(days)); }) }; } public IEnumerable<GlobalMethod> GetMethods() { return new[] { _createWorkflowToken }; }} And now you can find documentation for the javascript methods that are available in workflows for instance. When to ship Orchard Core 1.0? If you check the .NET Core Roadmap, you could see that the release of .NET Core 3.1 is scheduled for December 2019. The suggestion is to ship Orchard Core 1.0 with this version of .NET Core because there won't be any update until the .NET 5.0 and this way the community could align the same way as did when released Orchard Core RC. It gives the community one month to polish and merge missing PRs. This way there will be no need to reupdate when 3.1 is released. Starting the discussion about the next Orchard Harvest We will have a 1.0 soon and we already have the RC of Orchard Core. The community decided to organize the next Harvest if Orchard Core reaches a state that we can show at the conference. Now it's time to show the new framework by workshops too to learn the features of the new version. The suggestion is to make it happen in February or April of 2020. Let's do it probably in Europe because the last time it was in the United States. There are some options like Hungary, Italy, Greece, Spain or England. So, let's come back to this topic later and keep up the discussion! Building Workflow Driven .NET Core Applications with Elsa Sipke Schoorstra decided it was about time to take Orchard Core’s workflow engine and philosophies and turn it into a reusable, .NET Standard library, enabling any .NET application to enjoy the power of workflow. In this huge and informative post, he introduces Elsa, an open source suite of .NET Standard libraries and tools that enable developers to implement long-running workflows. The core philosophy of Elsa is to be able to connect small executable units with one another, allowing you to orchestrate real business processes such as document approval, customer on-boarding and order fulfillment processes. Following the guide "Creating a new decoupled CMS Website" live on Twitch Davin Davies a.k.a. copperbeardy decided to follow the guide called Creating a new decoupled CMS Website and broadcasting it using a live stream in Twitch. He tried to follow it once at the end of October, that session was very useful to fix and update the documentation and in some cases the code to be able to follow that with the latest changes of Orchard Core. Check out his second stream about following that guide again to create a decoupled site! Demos New Admin menu Here you can see the admin menu of Orchard Core if you enable every feature. Some of them don't have many sub-items, for example, the Content has only two (Content Items and Assets), and some of them have quite a lot. If you check the Configuration option, there are 13 sub-items. And at the bottom of the screen, you could see that every authentication provider has its own entry instead of grouping them in a section something like Authentication. There was a suggestion to reorganize the admin menu to make it cleaner that could make it easier to find the options you want. That could be a good point for the new structure to use the same setup as we used when updating the documentation. If you open the docs and click on the Key Topics, you could see a menu in the left with the following points: Manage your Content Customize the Display Localize your site Handle the Media Navigate between pages Query and Search data Secure your application Workflows When you update to the dev branch of Orchard Core you will face with the new, redesigned admin menu. Let's see what will you see if you enable every feature that is available right now. As you can see, the Content menu has everything you need to define your content types and manage your content items dynamically. Under Design, you could see everything related to the look and feel of your site. Here you can define templates, change the themes, etc. Widgets is a new option where you can edit the widgets and layers. That option was called Layers in the previous structure. Under Security, you will find the settings of the third-party authentication providers, can manage the users and the roles, and of course the OpenID settings. But that's enough talk for now, check out to the dev branch of Orchard Core and try the new admin menu now! On Lombiq Searching for performance-intensive codes Do you write a performance-intensive code? Then help us build the nerdiest .NET thing! Drop us a line to [email protected] and we'll ask a few questions about the challenges you encounter, and in exchange, we'll show you how to make a chip out of your programs! Orchard Dojo Newsletter Now we have 100 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 - 11/01/2019

Do you remember the Nwazet Commerce module for Orchard 1.x? Orchard Core Commerce will be the Orchard Core port of that module and this week we will see the current state of this module! But first, take a look at the new structure for the documentation and the other improvements of Orchard Core! On Orchard Core The new structure for documentation When you navigate to the Read The Docs site to check the documentation of Orchard Core, you will meet with a brand new structure. All the previous docs are under the Reference menu on the top. Here you can see all the modules and their reference documentation. The Key Topics are just explaining core concepts. Explore the new documentation now! Add culture argument to localization_set filter This adds an argument for culture in the localization_set filter and defaults to current culture if there are no arguments. {{ Model.ContentItem.Content.LocalizationPart.LocalizationSet | localization_set: "en" }} New ContentCard Shape to make Flow Editor extensible Now the ContentCard shapes have been merged to the dev branch of Orchard Core, so you can use this awesome feature! But why ContentCard Shape Needed? Every widget within FlowPart, BagPart, and WidgetsListPart has Bootstrap card with similar UI which can be dragged or deleted. Unfortunately, these parts add hard-coded alternate for widget editor Widget_Edit__Flow, Widget_Edit__Bag, and Widget_Edit__List just before DisplayAsync hence - none of the custom alternate defined in admin theme for the widget is applied i.e. Widget-WeatherWidget.Edit.liquid (Widget_Edit__WeatherWidget). Due to hard-coded alternates, none of the placement customizations on Content_Edit applies to Flow editor. i.e. having AdminTab in Flow editor. All widgets are framed with a <div> tag, with no ability to customize. This limits the usability of the Form module and makes very cumbersome to create complex forms. FlowPart, BagPart, WidgetsListPart has the advantage of the free flow page but did not come even close to the usability of Layout in Orchard 1.x and Layout Template. Orchard DisplayMangement is powerful but FlowPart, BagPart, WidgetsListPart not utilizing it to make it extensible. These parts render cards using a hard-coded widget template in javascript, which doesn't honor shape alternates. How ContentCard Shape Helps? Doesn't add any alternates to Content Editor, hence any edit alternates defined for a widget will be displayed in Flow editor. Because it's using Orchard DisplayMangement, that means all placement details are applied including Admin Tabs within Flow editor. Defines ContentCard_Frame shape and list of alternates that module developers can override in Module or Admin Theme. Ability to disable, move or delete the Widgets to create Orchard 1.x like Layout Template. Ability to control, expand or collapse by a developer in Module/Admin Theme. Rendered 100% from a shape, not using an HTML template inside Javascript. Uses ShapeTableProvider to define alternates. Orchard 1.x layout like UI created with ContentCard shape, using some ContentTypes in BagPart and creating alternates only for ContentCard_Frame shape. Just check out to the dev branch to try out the new editing experience right now! Add configuration section to setup docs You can set up your site by providing the configuration parameters via the appsettings.json file. The documentation has been improved with the correct way you can do that. Default pattern for autoroute and alias When we add an Alias Part or an Autoroute Part, we don't have to go to the Settings, it will now use a standard pattern. public class AliasPartSettings{ [DefaultValue("{{ ContentItem.DisplayText | slugify }}")] public string Pattern { get; set; } = "{{ ContentItem.DisplayText | slugify }}";} Demos Orchard Core Commerce module Orchard Core Commerce will be an Orchard Core port and partial rewrite of the open source Nwazet Commerce module that was built for Orchard 1.x. Nwazet Commerce was initially built in 2012 by Bertrand Le Roy, loosely based on a commerce sample by Sipke Shoorstra. Now let's see the current state of this module because there are features that you can already try out! First, set up your dev environment: Download/clone the module from GitHub. Place it under the src/OrchardCore.Modules folder. Add the existing project to the solution under src/OrchardCore.Modules in the solution explorer if you're using Visual Studio. Add a reference to the module from the OrchardCore.Cms.Web project. If you are ready, build and run the solution. We set up the site using the Agency recipe for this demo. Now head to Configuration/Features in the admin, where you have to see the following modules. Enable both of them! Orchard Core Commerce: Registers the core components used by the Commerce features. Orchard Core Commerce Session Cart Storage: Registers session-based shopping cart persistence. In OrchardCore.Commerce any content type can be a product. It's just the manner of having the Product Part attached to your content type. This part identifies any content item as a product, by its mere presence. It has only an SKU, that describes the most basic product attribute, which can also be used as an alias for the item. You will also find a new Price Part, that just a simple product price that stores the price of the product. There is also the notion of Product Attribute Field, which adds the ability for a product to be modified with a set of attributes, in particular when added to a shopping cart. Examples of attributes can be shirt sizes (S, M, L, XL), dimensions, etc. Now let's try these out! Let's say we would like to sell T-shirts in our shop. Create a new content type called T-shirt and add the Title, Common, HtmlBody, Product and Price parts to it. Every product could have different fields, in our case, we will need a size, a message printed on the T-shirt and the color of the T-shirt. Let's add these fields to our content type using the Text Product Attribute Field type. You can add some predefined values to size and to colors and restrict them. Now let's create a new T-shirt, give it a name and some description and hit Preview. Here you can see that the users can customize their product using our fields. They can set the size, the quantity, the message, and the color. And at the bottom of the screen, you could see an Add to cart button. Let's fill out these fields and click on this button! We selected one black T-shirt with a size L and with a custom message. You can update the quantity here that will update the price if you click on the Update button or remove the product from the cart with the Remove button. So, for now, the following features are done: Product, price, and inventory parts and/or fields (those were a single part in Nwazet) Note: not all products have a price Shopping cart To do: Checkout (probably redesigned around Orchard Workflows) Base infrastructure for payment, plus one implementation (Stripe) Order content type and management screens (including a redesign and refactoring of the order part) Workflow activities On Lombiq Searching for performance-intensive codes Do you write a performance-intensive code? Then help us build the nerdiest .NET thing! Drop us a line to [email protected] and we'll ask a few questions about the challenges you encounter, and in exchange, we'll show you how to make a chip out of your programs! Orchard in Open Academy There will be the free Open Academy in Budapest on 22 November for all life long learning developers with no-BS tech talks, where Zoltán Lehóczky, the Co-founder and managing director of Lombiq Technologies Ltd. will talk about Orchard. Come and join the conference if you will be nearby! This week in Orchard in LinkedIn From now you could find our This week in Orchard series on LinkedIn, under the Lombiq Technologies Ltd. company account! Share and like these posts there too if you are learning something new reading our weekly recaps! Orchard Dojo Newsletter Now we have 101 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 - 10/25/2019

This week we are coming with a cool demo of presenting the newest improvements of an upcoming Orchard Core module that will add sitemaps to your site! But first, don't forget to check the documentation of Orchard Core, we have a lot of additional lines here! On Orchard Core Updating OpenId docs about how to use the certificate on Azure When you would like to enable authentication of external applications using the OpenID Connect/OAuth 2.0 standards, you have to configure the certificates too. You can generate and store your certificate on Windows and/or IIS, but you can also upload the certificate on an Azure hosted site. This little addition to the docs will help you with that. CommitTransactionTask workflow activity When you have two concurrent updates that depend on each other, you need to commit the previous transaction, that you can follow up with the next one and the first one can continue and get another one. So, when you have two nested transactions to each other, you could create a deadlock, that is very specific to SQLite. Now there is a new Task available when you are creating workflows. The CommitTransaction activity is about committing the current transaction by calling the CommitAsync method of the ISession implementation. Add OrchardCore.Email docs We have the OrchardCore.Email module, that allows you to send emails using SMTP. You can configure the settings for this module by using the appsettings.json file. Now you will find documentation about how you need to fill this JSON file and also with some description about the meaning of the values. Add role description Now you can provide a description of a role when you are creating a new one or editing an existing one. It will make your life easier in the future if you have more roles and want to stores what are the current roles used for. Now we have documentation about what are the predefined roles used for and how to configure the roles through a recipe step. Four Orchard Core samples for Orchard Core Dody Gunawinata maintains a repository in GitHub that contains 305 samples for ASP.NET Core with projects about how to use Blazor, foundational ASP.NET Core samples and so on. This repository also contains 4 samples that show the different capabilities of Orchard Core. These are: Routing - MVC: This sample shows how routing works in an Orchard Core Framework app. Routing - Razor Pages: This sample shows how routing works in an Orchard Core Framework app when you are using Razor Pages. Static files: This sample shows how to use static files in the module. Multi tenant: This sample shows how Orchard Core Framework handles multi tenancy and how each tenant has its own configuration file. If you are interested in these samples or other ASP.NET Core samples you should definitely check this great and huge collection to learn something new! Scanning the code of Orchard Core for bugs PVS-Studio performs static code analysis and generates a report that helps a programmer find and fix bugs. PVS-Studio performs a wide range of code checks, and it is also useful in finding misprints and Copy-Paste errors. The authors of this project published an article about reviewing the results of a second check of the Orchard Core with this static analyzer. The current version of Orchard Core is made up of 2,767 .cs files, i.e. it's about one thousand files smaller. The downsizing and renaming of the repository suggest that the developers have isolated the project's core (commit 966), which is 108,287 LOC long. The analyzer issued 153 warnings: 33 first-level and 70 second-level ones. You should definitely check this article, you can learn a lot and write better code! Do you write a performance-intensive code? Then help us build the nerdiest .NET thing! Drop us a line to [email protected] and we'll ask a few questions about the challenges you encounter, and in exchange, we'll show you how to make a chip out of your programs. Demos Sitemaps module A few weeks ago we wrote about an upcoming module for Orchard Core: the Sitemaps module. Since then this feature improved a lot and will be released soon. Let's recap the latest changes of the module! First of all, when you navigate to the Configuration/Features on the admin site, you will see that there are three different Sitemaps modules: Sitemaps: Provides dynamic sitemap generation services. Sitemaps for Decoupled Razor Pages: Provides decoupled razor pages support for dynamic sitemap generation. Localized Content Item Sitemaps: Provides support for localized content item sitemaps. Let's check them one by one with a site that we set up using the Blog recipe. When you enable the Sitemaps module you can head to Configuration/Sitemaps and click on the Add Sitemap button. Here you will see two notions: the Sitemap Content Types, that add sitemap entries for each one of the selected content types and the Sitemap Index, which adds a sitemap index that acts as a container for other sitemaps. You can create a new Sitemap Content Type, that will lead you to a familiar page where you can select which content type you want to include in the index, among with the change frequency, priority and the number of content items to include. The other is called Sitemap Index. In the editor of the Sitemap Index, you can select which sitemap will this index contains. Because for now we have only one (called My Blog Posts) select this one. Hit Save and View this Sitemap Index. You can see that this index contains our only one sitemap with the last modified date of it and the location. By using sitemap indexes, you can provide a collection of sitemaps to search engines. For example, when using Google, all formats limit a single sitemap to 50MB (uncompressed) and 50,000 URLs. If you have more than 50,000 blog posts, you have to create two Sitemap Content Types. The first one will take the first 50,000 one and the second one is the rest. And your Sitemap Index will include these two Sitemap Content Types. Now let's move on and enable the Localized Content Item Sitemaps. To test this, first, attach the Localization Part to our Blog Post content type and create two blog posts, one in Hungarian and one in English. Now head back to the admin of the Sitemaps module and View our My Blog Posts Sitemap Content Type. You see that our sitemap provides more information to search engines. First of all, you can see that both the English and Hungarian versions of our blog post have been included in the sitemap. These come with the hreflang attribute. If you have multiple versions of a page for different languages or regions, tell Google about these different variations using the hreflang attribute. The loc is still used and that points to the version of the content item that was created using the default culture. Finally, enable the Sitemaps for Decoupled Razor Pages feature. For this, we will add a new content type, called DecoupledBlogPost. This content type will not have any parts or fields attached. To be able to provide a sitemap for decoupled Razor pages, first, configure the SitemapsRazorPagesOptions for our content type in the Startup.cs file of our module. services.Configure<SitemapsRazorPagesOptions>(options =>{ options.ConfigureContentType("DecoupledBlogPost", typeOptions => { typeOptions.PageName = "DBlogPost"; typeOptions.RouteValues = (contentItem) => { return new { area = "OrchardCore.Sitemaps", slug = contentItem.ContentItemId }; }; });}); Here you can see that a DBlogPost.cshtml file sits in the Pages folder and we just simply put this into the OrchardCore.Sitemaps module. We will pass the ContentItemId as a slug for our page. Now let's see the content of the Razor page: @page "/blogpost/{slug}"<h1>This is the blog post.</h1><h2>Slug: @Slug</h2>@functions{ [FromRoute] public string Slug { get; set; }} Now head back to the admin and create two new Decoupled Blog Post. After let's create a new Sitemap Content Type, called Decoupled Blog Posts, that will (surprisingly) index the Decoupled Blog Post content types. After you saved this sitemap, hit View! Here we are with the two Decoupled Blog Posts that have the ContentItemId in the URL. We haven't attached the Localization Part to this one, so the hreflang attribute will not be used here. Now open one of those blog posts! And here comes our decoupled blog post that is using The Blog Theme for rendering the content of this item. This feature is still under development and can be found in this branch. Big thanks again to Dean Marcussen for this great contribution! On Lombiq Lombiq Orchard Visual Studio Extension updated The Lombiq Orchard Visual Studion Extension just got some VS 2019 compatibility updates. There was a warning message that said One or more extensions were loaded using deprecated APIs. Check it out if you aren't using it already, you're missing out on quite some productivity boost! Orchard Dojo Newsletter Now we have 100 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 - 10/18/2019

This week we are coming with a cool demo of using Statiq with custom GraphQL and Liquid modules to render static content for Orchard Core as a headless CMS! But before jumping to that don't forget to check out the other news around Orchard Core and another demo about adding the ability to generate DisplayText with a pattern! On Orchard Core Avoid slash in the role name The slash will add another segment that prevents to use from editing or deleting the role. Now we are checking that if the name of the role is containing a slash or not. If yes, you will see an error message. Decoupled CMS guide When you navigate to the Orchard Core Documentation page and hit the Index under the Guides in the left, you will see that we have a new tutorial here, called Building a decoupled website with Razor Pages. By following this step-by-step tutorial you can easily develop your own decoupled CMS site from the scratch. In this tutorial we learn how to: Start a new Orchard Core CMS project Create custom content types Edit content items Create Razor Pages with custom routes to render the content Load content items with different identifiers Render WYSIWYG preview screens while editing the content Add Breadcrumbs zone There is a new zone called Breadcrumbs in the layout of the admin. With that zone, we can inject breadcrumbs. Anywhere, where the breadcrumbs were used they are now using this zone, for example on the workflows page. There is a zone tag, so everything that is inside this zone tag will be injected inside the Breadcrumbs section. And here you can see the RenderSectionAsync call in the Layout.cshtml of TheAdmin theme. Updating themes All the themes that are using Bootstrap now have been updated to use the latest version. The main change is that all the static assets now are included in the themes, which means they can now be served by the Orchard instance and not just the CDN. And now each theme has a ResourceManifest, that defines all the assets that each theme is using, like jQuery, Bootstrap, Bootstrap bundle and so on. The local version and the CDN is also defined here, that allows these themes to reuse the settings that we set in the admin to select which version of the resources we want to use either local or CDN or based on the environment (meaning development will use local, production will use CDN). You can see a vendor- prefix in the names, it is to prevent conflicts with the resource names that we have defined in the OrchardCore.Resources module. Orchard Core Docs new structure The structure of the Orchard Core docs will be reorganizing and come with a new MkDocs theme. Here you can see just the material and here you can see the new structure that coming soon. Demos Add ability to generate DisplayText with a Pattern Let's set up a site using the Blog recipe. Now head to the admin site and edit one of the content types, for example, the Article. Add a new Text Field to it, let's use the Name for the Technical Name. Now edit the Title of the Article. Here you will see an Options drop-down list with the following options: Title is editable: you can edit the title when editing the content item. Title is generated and input is disabled: you can't edit the title and the textbox for the title is disabled. Title is generated and input is hidden: you can't edit the title and the textbox for the title is hidden. And under that, there is the pattern used to render the title of this content type. The pattern gets injected and this gets called when the content item is updated. Now let's edit the existing Article, called About and fill the Name Text Field with some value, for example Name. And change the value of the Subtitle Text Field to Subtitle. After hit Publish. Now if you navigate to Manage Content page you will see that the title of this Article has been generated using the values of the Name and the Subtitle Text Fields. Because at the content definition of the Title we select that the Title is generated and input is disabled, when you try to edit an existing article, you will see the disabled textbox for Title. Generating static sites using Statiq(Wyam) and Orchard Core If you haven't heard about Wyam(Statiq) yet, let's recap the underlying concepts first: Wyam is a simple to use, highly modular, and extremely configurable static content generator that can be used to generate web sites, produce documentation, create ebooks, and much more. Since everything is configured by chaining together flexible modules (that you can even write yourself), the only limits to what it can create are your imagination. Common static sites are using tools like Jekyll/Hugo which are based on content in markdown files, stored in GitHub. Some arguments: This might work for small and technical teams, but when users are more than a handful or don't have technical knowledge it's not possible anymore. When assets management is required, with organizing images or adding metadata. Rights management, such that sections of the site can only be modified by some users. Editing workflow, when content needs to be reviewed and pass different levels of validation. Allow more complex editing scenarios, like editing maps, choosing a color. Managing more than a dozen content items, like e-commerce sites that could span thousands of products. When online B2B communications are required, like export processes, tax data updates, or webhooks. Now let's see how to generate static sites! First, let's set up a site using the Blog recipe. Now head to the Configuration and enable the following OpenID modules: OpenID Authorization Server and OpenID Token Validation. We also need the GraphQL, so enable that module too. The goal is to implement the authentication from a service to the Orchard Core by using Bearer tokens and OpenID. With that, you can use the APIs from another service. After go to the Authorization server settings under OpenID Connect/Settings and allow the Client Credentials Flow. The OpenId Connect Client Credentials grant can be used for machine to machine authentication. In this grant a specific user is not authorized but rather the credentials are verified and a generic access_token is returned. Now create a new application under OpenID Connect/Management. This will be our service that will connect to the Orchard Core instance. Don't forget to allow the Client Credentials Flow here and of course, provide a Client Id and a Client Secret. We will need these soon. Now we have a configured Orchard Core instance to serve content to our application using GraphQL and the Client Credentials flow. For the sake of simplicity, we will create a Console Application. This application has to use the Client Credentials Grant Flow for authentication. curl -XPOST "https://<region>.onelogin.com/oidc/token" \-H "Authorization: Basic <base64 encoded client_id:client_secret>" \-H "Content-Type: application/x-www-form-urlencoded" \-d "grant_type=client_credentials" First, create a request on the /connect/token on the Orchard Core instance. Then create a Basic authentication header with the Client Id and the Client Secret. Remember you provided these data when setting up the OpenID application in Orchard Core. After we send the request and the response will be a JSON document with an access_token property. This property stores the value of the access token that we can use to send any request to the server as a Bearer token. Check this code snippet to receive this token. using (var httpClientHandler = new HttpClientHandler()){ httpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; httpClientHandler.AutomaticDecompression = System.Net.DecompressionMethods.GZip | System.Net.DecompressionMethods.Deflate; using (var httpClient = new HttpClient(httpClientHandler)) { string accessToken; using (var request = new HttpRequestMessage(HttpMethod.Post, new Uri("https://localhost:44300/connect/token"))) { request.Headers.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes("theclientid:theclientsecret"))); request.Content = new StringContent("grant_type=client_credentials"); request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded"); using (var response = await httpClient.SendAsync(request)) { var data = await response.Content.ReadAsStringAsync(); var doc = JsonDocument.Parse(data); accessToken = doc.RootElement.GetProperty("access_token").GetString(); } } }} And the value of the doc JsonDocument will be the following, where you can see the access token. {"token_type":"Bearer","access_token":"CfDJ8IFF_p0sw0lLjSdTpd..........cDRRiQXfpVZsHo","expires_in":3600} In the next step, we are creating a new Bearer token with the access token and we are pointing to the GraphQL endpoint with a query listing all the blog posts. With that, we can get all the blog posts. using (var request = new HttpRequestMessage(HttpMethod.Get, new Uri("https://localhost:44300/api/graphql?query=query%20MyQuery%20%7B%20blogPost%20%7B%20displayText%20markdownBody%20%7B%20html%20%7D%20%7D%20%7D"))){ request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); using (var response = await httpClient.SendAsync(request)) { var data = await response.Content.ReadAsStringAsync(); Console.WriteLine(data); }} You can see that we pass the GraphQL query in the query string in an URL encoded format. Here is the query in a readable way: MyQuery { blogPost { displayText markdownBody { html } }} We use Console.WriteLine to see the data coming from Orchard Core. Because we set up our site using the Blog recipe and haven't added any additional blog posts, our response will be the following: So, this is how you do Client Credentials Flow to authenticate your application against Orchard Core. This is the first step needed to generate a static site. Now let's just refactor our code a little bit. Create a ClientCredentialsAuthenticate method to get the access token. With the ClientCredendialsAuthenticate method, we can do as many calls as we want. You can see the BlogPosts query that we will pass to a custom Statiq module called GraphQLQuery. This module will just take the GraphQL endpoint, the query, and the access token. We will also need to develop another custom module extension using Statiq, called Liquid module to be able to use Liquid. const string BlogPosts = @" MyQuery { blogPost { displayText markdownBody { html } } }";static async Task Main(string[] args){ var token = await GraphQlQuery.ClientCredendialsAuthenticate(new Uri("https://localhost:44300/connect/token"), "theclientid", "theclientsecret"); await Bootstrapper .CreateDefault(args) .BuildPipeline("Posts", builder => builder .WithInputModules(new GraphQLQuery("https://localhost:5001/api/graphql", BlogPosts, token)) .WithProcessModules( new SetDestination(Config.FromDocument(doc => new FilePath(doc.GetString("displayText") + ".html"))), new Liquid("templates/blogpost.liquid")) .WithOutputWriteFiles() ) .RunAsync();} For every blog post, it will apply the transformation, by getting the displayText property of the JSON document and create an HTML file based on that. After apply the Liquid filter based on the blogpost.liquid template, that has the following content: <h1>test</h1><p>{{ displayText }}</p>{{ markdownBody.html | raw }} If you run that application you will get one HTML file in the bin/Debug/netcoreapp3.0/output folder of your application called Man must explore, and this is exploration at its greatest.html. If you open the file you will see the following result. With that, you can go further and generate all the static sites you want based on GraphQL and use Razor or Liquid. On Lombiq Orchard Dojo Newsletter Now we have 98 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 - 10/11/2019

The Preview feature is improving, you can have admin templates and better defaults for the SearchController, and we are just scratching the surface of the new features that coming to Orchard Core. Let's check out those with some other fascinating features! On Orchard Core Validate stereotypes This prevents stereotypes from having non-alphanumeric values because these are used for file template names. Another issue was people assume that they can provide multiple stereotypes by passing a coma, but no, it's not a valid use case. Here's the fix in the UpdateAsync method of the ContentTypeSettingsDisplayDriver by adding the IsAlphaNumericOrEmpty private method. Fix attached media field add button visibility There was a couple of regressions with the media editor and media attached field editor: the delete button doesn't seem to work anymore (permanently disabled) in the media attached field editor, the add button doesn't reappear after deleting an image until you publish and re-edit the page You can see the fixes in the following gif. Adding shape_dump filter Do you remember the Shape Tracing feature in Orchard 1? It's like pressing the F12 button in a Chrome browser, but for shapes. You will see all the shapes that have been rendered and all the alternates and the source code for alternates. It makes easier to template shapes. The first step is towards this feature in Orchard Core is to use this filter to dump a shape. With this filter, you can export the JSON document of the shape. Let's say we have a site installed with the Blog recipe. Use the shape_dump filter in the Content-Article.liquid file by adding this line: {{ Model | shape_dump }}. After if you navigate to an article, you will see the following page with the rendered JSON document. This feature is under development, but you can check the current progress in this branch. Orchard Core Preview feature improvements The idea is to improve the Orchard Core Preview feature. Today when we do a preview it's using the ContentItemController, the one that renders the ContentShape. With that, you can have your own custom templates and it will render that. When you click on the Preview button, there is a new window that opens and this new window will call into a custom preview controller. This controller is in the OrchardCore.ContentPreview module, called PreviewController. What it does is when it's get called on a POST from the second window it gets the content item, which is inside the form post and tries to update the result of the POST, like it was a publish or a save action on the form. And in the end, we get a new content item as if we were about to save the content item form. And from this content item, we just call BuildDisplayAsync and render it using a view. And the Render.cshtml will just render the shape in the current layout of the frontend. The improvement would be to find a way to customize how to render the page in the preview window. This feature is working well when we are using the content shapes with the full CMS mode, but when we are in the decoupled mode to render anything it's not based on the content shape. It's based on the developer's own views and templates and controller actions. There will a new part, called PreviewPart, that contains nothing, but has settings. When you attach the PreviewPart to your content type, you will go to Settings and define the pattern to use to build the path. So, the developer makes their own view and then they can configure this content type to say that for the preview you should use my route that will display my content type. Then when we click on the Preview button, intercepting the Render to invoke the URL that will actually render the content item from the developers perspective instead of trying to render the content item using the content shape. In this case, we won't have any customization. In the end, we will have a working preview feature even in decoupled mode. If you are curious about the current state of this new feature, check out this branch. Demos Admin templates It's like templates, but for the admin. Let's see how it works! We have front end and admin themes. When you want to customize the admin theme, right now there is no other way than creating a new theme and having the theme as a base one and selecting your own admin theme in the dashboard. This feature is kinda same as the templates module and lets you create shape templates from the admin itself for the admin. This way most developers won't have to create a custom admin theme, because it's usually just to change a summary for a blog post or a detailed template for a specific widget to look different. Or maybe you would like to hide something like you want to hide the TitlePart editor in a way to make it different. Set up a site using the Blog recipe. To use this feature head to Configuration -> Features and enable the Admin templates feature. After you will see an Admin Templates option in the Configuration menu. Here click on the Add Template button to add a new admin template. Let's call this template Content_SummaryAdmin__BlogPost to override the summary admin shape of a BlogPost. Give it a likable content and hit save. Now navigate to the Blog option in the admin to see the list of the blog posts. Here you will see the new look of the one blog post that we have. This might also allow us to be able to create custom widgets to place on the landing page of the dashboard and many more. Better defaults for the SearchController The search feature is part of the Lucene module, that could not be the right way to do. Maybe we could have its own module, because there is a custom controller and it's doesn't care about what is indexing anything. By default when you have the Lucene module enabled you have a SearchController under the /search URL. It doesn't have any styling, because there is no customized search page for that in the TheBlogTheme. If you navigate to Configuration -> Settings -> Search you can select which index you want to able to search and the default search fields which are the fields in which we will look for the content you type. If you haven't provided the default search fields, you will get a BadRequest in the front end with a Couldn't execute search. The search index doesn't exist message and also a log entry. But what is Content.ContentItem.FullText? For example, let's check the content type definition of the Article. Here you can see a section called Full-text. Here you can say what should be used to look for the Articles. For instance, by default, we include the display text and the body parts. But you could say I also want to use some more data, like the values of the different fields. You can use Liquid here to provide the values. Future improvements could be to make a custom shape for the search results for the list and for each item. And of course, change the themes to support this page correctly. On Lombiq Orchard Dojo Newsletter Now we have 97 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 - 10/04/2019

The first release of Orchard Core RC shipped last week, but the community has already added several new great features and improvements to the CMS! In our post, we show you two demos about the flow improvements and the new Sitemaps module! On Orchard Core Add helper and block Liquid tags to the Readme The documentation has been updated about how to use the helper and the block Liquid tags. Update asset cache to check Azure Media Storage is enabled Now you will get a warning message if you don't have the correct settings for the cache of Azure Media Storage. It means an updated media cache controller to check if the Azure Media Store is enabled or configured correctly, and shows an error, rather than an exception. Etch.OrchardCore.SEO module This is a module for Orchard Core that provides useful features for SEO. For example: Hostname redirects: define main hostname to redirect all domain variations and force SSL. Redirects: create redirect content items that'll redirect a relative URL to another URL. Robots.txt: manage contents of /robots.txt. If you are building a website and you would like to do the SEO to optimize your website for success, don't hesitate and get this module from NuGet! And if you are in GitHub, don't forget to check out the other modules from Etch, they created several features for Orchard Core. For instance the Etch.OrchardCore.Fields module with a collection of useful content fields and many more! Add WithPosition extension to set Field position There is a new WithPosition extension method on ContentPartFieldDefinitionBuilder, that you can now use instead of needing to use the MergeSettings. You can find this method in the ContentPartFieldSettingsExtensions static class. Document Azure Blob Storage We have updated the documentation about how to configure the Azure Media Storage feature and how to use the Media Cache feature. Demos Flow improvements Let's set up a new site using the Blog recipe. The Page content type here has the FlowPart attached, so let's create a new page. Let's add three new paragraphs to this page with some content. After that set the percentage of every widget to 33%. You can see a different UI at the bottom of every widget. Check out the dropdowns instead of radio buttons when setting the alignment or the percentage of the given widget. When setting the percentage, the editor is now updating with the new value, and in the case of 33%, you will see the three paragraphs next to each other in one row. You can also drag and drop the widgets to easily change the position of them! Now let's add a Container, that is just a container of other widgets. You can also define the width and the alignment of the container too. But here comes the trick! Before that, you cannot move elements outside or inside a container. If you would like to move a widget inside a container, you had to create that widget again in that container, which could be quite frustrating if you decide to move a dozen widgets to a container. Now with a simple drag and drop, you should able to take any widget and put it inside a container! Do you know editors from your company who'd love this feature? Show them these gifs! Sitemaps A sitemap is a file where you provide information about the pages, videos, and other files on your site, and the relationships between them. Search engines like Google read this file to more intelligently crawl your site. A sitemap tells the crawler which files you think are important in your site, and also provides valuable information about these files: for example, for pages, when the page was last updated, how often the page is changed, and any alternate language versions of a page. Let's see how it works in Orchard Core! Set up a new site using the Blog recipe. After go to the admin page and navigate to Configuration -> Features. Here search for the Sitemaps feature and enable it. This module will add a new option under Configuration, called Sitemaps. Here you can add a new Sitemap set by clicking on the Add Sitemap Set button. Give it a likable name and then hit the Edit Nodes button. Here you can choose between two different types of sitemap nodes: Sitemap Content Types: adds a sitemap entry for each one of the selected content types. Sitemap Index Node: adds a sitemap index that acts as a container for other sitemaps. Let's create a Sitemap Content Types node to have a sitemap that contains the Article Content Types of our site! As you can see on the screen we should add a description for the sitemap node first, then the path of our sitemap. And here comes a huge table that contains every available content types of your site. Put a tick near the Article and leave the other settings as-is. Note that when you uncheck the Include all checkbox, you can adjust the number of content items in the sitemap by setting the skip and take values. For now, just put a tick here. Now if you create this node, you will have a green View button next to it. This will show the content of your sitemap. In the URL you can see that path we have set up earlier and the relevant fields of the Article content types. As you can see we previously created one additional article with the my-second-article alias. The module has a great Readme.md file where you can read a lot more about the feature and the different node types. This feature is still under development and can be found in this branch. Big thanks to Dean Marcussen for this great contribution! On Lombiq Orchard Dojo Newsletter Now we have 96 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 - 09/27/2019

The first release candidate of Orchard Core has been shipped! Read our post about the latest improvements of the new release and everything you need to know about where you can download the release and how you can work with an application that uses .NET Core 3.0! On Orchard Core Add contentitem tag helper and liquid tag Now we have a new contentitem tag helper and a Liquid tag. By using this tag helper we can render a content item directly and can also use caching. We still need to use the menu shape, because it has custom alternates that are specific to it, so we can't remove that. But at least now we have a contentitem helper that also do it for anything. Handle standard Startup class Until now if you add the Startup.cs to your module, you need to inherit the Startup class from StartupBase and you need to have to override the ConfigureServices(IServiceCollection services) or the Configure(IApplicationBuilder builder, IRouteBuilder routes, IServiceProvider serviceProvider) method. Now you can define a Startup class and don't have to inherit from anything like in ASP.NET Core. Of course, you can include the ConfigureServices or the Configure method to configure the app's services if you want, but you don't have to override anything. Fallback to Detail display type for bag parts If you create a BagPart and in the settings, if you remove the display type of the content types that you want in the BagPart, then it will be null in BagPart.cshtml and will fallback to Summary. Because they are widgets if you haven't implemented the Summary view of the widget that you are rendering, it will fallback to template Widget__Summary. But this thing doesn't exist. So the result will be a shape not found error. The solution is to fall back to the Detail, which is the default display type that we use for widgets when we render them. Configure ContentParts and ContentFields with IOptions<ContentPartOptions> or IOptions<ContentFieldOptions> We don't inject a ContentPart in the DI directly. We add the type of the ContentPart to an option, which is IOption<ContentOptions>. In this case, we don't have to resolve the ContentPart to get instances of ContentParts to know what are the ContentParts that are available. We do the same for ContentFields. Content items: Bulk actions and Filters UX Here you can see a concept to redesign the content items page for the bulk actions and the other filters: As you may see, Antoine has been mainly inspired by the GitHub issues UX. The new features are: Select all aligned vertically with the other checkboxes. Smaller left and right padding in the items list. All filters and actions on only one line. Dropdown actions with a light background (correctly displayed on a small screen). Even the Culture filter could appear. Display the number of items and the number of selected items when checked. It is just a POC. To make it work completely, we will need to find a way to select and display the state of the different filters like GitHub does it. For example: type:Article status:published sort:created Just to have a big picture of the two different screens, the current UI looks like this: This feature hasn't been available in Orchard Core yet but will be added in the next version of Orchard, because it was too risky to change the content items page before the RC in this huge way. Add translation metapackage to Cms.Targets As expected we added the OrchardCore.Translations.All to the Cms.Targets. If you use the Cms.Core.Targets you won't have it, but if you use the Cms.Targets you will get the themes and all the localization in your solution. But it didn't work, because there were some missing MSBuild Targets. Now it has been fixed. Orchard Core first release candidate has just shipped The community proudly presents the first release candidate of Orchard Core! RC means that the software is almost ready for the final release. No feature development or enhancement of the software is undertaken; tightly scoped bug fixes are the only code you're allowed to write in this phase, and even then only for the most heinous and debilitating of bugs. Let's see the list of changes for this release. As you can see from the list, Orchard Core is now on ASP.NET Core 3.0. That means now if you would like to contribute to Orchard Core you will need to install Visual Studio 2019 16.3. By updating to this version you will automatically get .NET Core 3.0 too because it is included in this version, but from here you can download both the SDK and the Runtime. The NuGet packages in NuGet.org are also updated and have the version number 1.0.0-rc1-10004. Don't forget that from now you can also download the translation packages from NuGet.org. There is an OrchardCore.Translations.All package that contains all the languages, but you can find the packages for every language separately too. Oh, and don't forget the Docker images of Orchard Core! You can also try the new version on Try Orchard Core. So don't hesitate, upgrade your Orchard Core site from Beta 3 to RC now! Building modular, multi-tenant ASP.NET Core apps with Orchard Core framework There was the .NET Conf this week, which was a 3-day virtual developer event co-organized by the .NET community and Microsoft. Sébastien submitted a talk about Orchard Core modularity and multitenancy and he was able to speak! At September 24 at 00:00 (UTC), he made a great talk about building modular, multi-tenant ASP.NET Core apps with Orchard Core framework. If you haven't seen his section yet, you can watch the recording in Twitch. On Lombiq Silent improvements in the background in DotNest As you may now DotNest is a SaaS provider that gives hosted Orchard CMS web applications hosted by Lombiq Technologies. We are thrilled to develop and maintain a provider like that and improved our services for time to time to make a better DotNest for you! Now we have just added some infrastructure improvements and making payments safer with PSD 2. Orchard Dojo Newsletter Now we have 94 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 - 09/20/2019

Now we are in the finish line of releasing the RC version of Orchard Core! Read our post for the most important things you should now about the new release and for a quick demo about the Cypress e2e testing suite for Orchard Core! On Orchard Core Some performance tweaks Marko Lahma, the author of Quartz.NET made a lot of performance tweaks to make Orchard Core much faster. Let's see some of those! In the RunningShellTable.cs use host.IndexOf(':') != -1 instead of host.Contains(':'). And a same performance tweak here: instead of extensions.Contains(Path.GetExtensions(content.Name)) use Array.IndexOf(extensions, Path.GetExtension(content.Name)) != 1). Also, do not use dynamic typing when it's not necessary. Instead of context.AmbientValues.TryGetValue("LiquidPage", out dynamic page)) use context.AmbientValues.TryGetValue("LiquidPage", out var page));. He also created a project called OrchardCore.Benchmarks, where you can run some microbenchmark. Migrate all Content Type / Part / Field Settings to Settings<T> There were some places in the recipe where settings were not under the Settings property. Check the blog recipe for an example. Here you can see that everything is in its namespace. You can find a Settings property and inside that, there is a ContentTypeSettings property. By organizing all the settings in their correct path we get a cleaner recipe file. Add default paging to GraphQL queries We have three different new properties: DefaultNumberOfResults: if you don't say first or last in your queries, we will limit the results to 100. MaxNumberOfResults: if you define first of last (give me the last 2000 content items) we will block you and limit to 1000. If you didn't provide a first or last, and if you have so many results, it will slow down your system considerably. You should always page your queries, otherwise, you could load everything on the memory of the server and if you have multiple clients you will get out of memory or the performance will be slow. MaxNumberOfResultsValiadtionMode: specify the validation behavior if the max number of results is exceeded in a pager parameter.* Default: in production info will be logged and only the max number of results will be returned. In development, a GraphQL validation error will be raised.* Enabled: a GraphQL validation error will be raised.* Disabled: info will be logged and only the max number of results will be returned. Migration to .NET Core 3.0 RC Now Orchard Core using .NET Core 3.0 RC, which means you need to install the new SDK (v3.0.100-rc1) to work with Orchard from here. Sebastien pinned the 1.0.0-beta3-72452 version on MyGet, so it won't be deleted, and it is the last one targeting .NET Core 2.2. Don't forget: to work with Orchard Core, you will need Visual Studio 2019! Orchard Core RC release The plan is to ship Orchard Core RC next Monday, maybe on Tuesday, after .NET 3.0 is released, so we can update the dependencies and build the things. It will be on NuGet.org as well. This release will be followed with the 1.0 (RTM) version. The number of the new package will have the following convention: OrchardCore 1.0.0-rc1-10000. The build number will be reset to 10000 and will be increased by one with every build of the dev branch. We need to update the documentation and the ASP.NET package references. There will be blog announcements: they could be in the Asp.net site right after the .NET Conf. Try Orchard Core will be updated to use the new version too. Demos Cypress e2e testing suite for Orchard Core Cypress is a next-generation front end testing tool built for the modern web. Cypress is most often compared to Selenium; however, Cypress is both fundamentally and architecturally different. Cypress is not constrained by the same restrictions as Selenium. This enables you to write faster, easier and more reliable tests. To use Cypress in Orchard Core first you have to run npm install in the test/cypress folder. Then followed by npm run test to build and host Orchard and run Cypress test on it. This will execute the content of the test.js file. First builds the solution, starts the application and starts the different Cypress tests. The test cases are in the integration folder, where now you can find three different cases: Setup SaaS Blog Agency Let's check the content of the Blog one. You can find a file called 01-setup-blog-tenant.js. Here you can find different test methods, like cy.login(), or cy.gotoTenantSetup(blog). These functions are defined in the commands.js file within the support folder. Let's check quickly what are these methods for! As you can see, using some predefined command, you can easily navigate to a given URL using visit. You can target the different HTML elements using get and submit a form easily as you can see in the screen above. The Cypress testing suite for Orchard Core is in its early stage, but you can find the current state and follow the development in this branch. On Lombiq Orchard Dojo Newsletter Now we have 90 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 - 09/13/2019

Lots of PRs merged to Orchard Core this week again coming with new fixes, and features. You could also read about the new way how you could use the localization packages in Orchard Core soon. Check out our current post for more! On Orchard Core Editor direction should respect the Localization Part culture Everything that is editable (like TextField, TitlePart, etc.) will now be configured whatever the content item's culture is. There is a new helper method, called GetContentCultureAsync that gets the CultureAspect of a content item, that will provide the CultureInfo of the content item. If you have the Localization module enabled, it will set it using the LocalizationPart of the content item (otherwise it will use the default culture of the site). Add Properties Dictionary to IShape interface We decided to provide a Properties bag on the IShape interface where you can put anything on a shape. You can do it in Orchard 1.x and in Orchard Core too, but only if the shape is a dynamic object. The readme file is updated about how can you do that using Liquid. Clean double encoding Use the tag helper instead of the ActionLink when working with localized strings. Every time when you have an ActionLink with a localized string it will be double encoded because the ActionLink only accepts a string. OrchardCore.Translations Repository In this repository, you can see a Localization folder that contains the localization for each culture for each module. Crowdin sends pull request to this repository whenever is a new translation is available. It creates new commits with every change and then AppVeyor will build the changes and this will build NuGet packages for every language. Each NuGet package will only contain the localization files for the given language. We publish the NuGet packages to MyGet prefixed with beta3. Once the dev will be merged to master it will move to nuget.org. There is also a meta-package called OrchardCore.Translations.All, that contains all the other languages. If you just point this package, you can translate your admin in any language automatically. Of course, you need to add the given language as a supported one. .NET Conf 2019 There will be the .NET Conf soon, which is a 3-day virtual developer event co-organized by the .NET community and Microsoft. Sébastien submitted a talk about Orchard Core modularity and multitenancy and he is able to speak! At September 24 at 00:00 (UTC) he will be speaking about building modular, multi-tenant ASP.NET Core apps with Orchard Core framework. Don't forget to join! Starting a new project with Orchard Core Garry Woodfine, an experienced full-stack developer has just started to work with Orchard Core. In this blog post, he writes about how you can build new Web Applications with Orchard Core, install Orchard CLI and start your CMS Website. On Lombiq Orchard Dojo Newsletter Now we have 90 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 - 09/06/2019

Lots of PRs merged to Orchard Core this week that adds new improvements, fixes, and features. You could also read a demo about the Content Fields Indexing, that is a very useful feature for the developers: they can now query content items based on the value of the fields! Oh, and we will have a meetup soon in Budapest, where Lombiq will giving a talk on Orchard. Get ready for a longer post about these amazing features! We promise: you won't regret reading it! On Orchard Core Add ORCHARD_APP_DATA Environment Variable section If you want to change where the App_Data folder is, you can define an environment variable called ORCHARD_APP_DATA. Paths can be relative to the application path (./App_Data), absolute (/path/from/root), or fully qualified (D:\Path\To\App_Data). If the folder does not exist the application will attempt to create it. Localization files publishing When we deploy the app it will also publish the Localization folder, which is where the localization files go. Instead of the App_Data/Localization, they go into the Localization folder of the content root. Content Culture Picker improvements There is a new Liquid helper called switch_culture_url, that is responsible to return the URL of the Action that switches cultures. The ContentCulturePickerContainer is the template of the culture picker, that you can add in your front end themes to display a customized drop-down or a list of options to change the culture of the website. There was no example about how to override this using Liquid, now the documentation has an example using the new switch_culture_url helper. Workflows Internationalization Now every Task and Event have a LocalizedString property called DisplayText. With this change, you can localize the title of every activity. Make setting the page title format accessible to site administrators When you navigate to the general settings page you can find a new option called Page title format. Here you can now provide a Liquid expression to customize the way how you would like to render the title of your page. In the screen, you can see that we set the Page title format to {% page_title Site.SiteName, position: "before", separator: " -.-.-.- " %} By providing before as the position, we will show the name of the site first, then the title of the page with a custom separator. Check the second tab in the screenshot above to see the result of the expression. Handle UnauthorizedResult When trying to access an unauthorized ContentItem in the front end, the ItemController returns an UnauthorizedResult. Until there, it's correct. However, UnauthorizedResult is treated like any other error and an error message is returned: "An error occurred while executing this request." leaving us thinking there is a bug. The solution is we need to return the Forbid or Challange results, not just Unauthorized. If you are authenticated, we can just return Forbid to say you don't have access to this page. If you are not authenticated, we return a challenge, that will be redirecting you to the login page to give you a chance to authenticate yourself. In the future in most of the controllers, we should use this logic. Add documentation to health check The HealthChecks module is just enabling the middleware and the new documentation now mentions that the default endpoint is 'health/live'. Add support for typed shape tag helper properties There is a shape tag helper with the following syntax: <shape type="Foo" /> This will render the shape typed Foo. The Razor syntax to do the same is: @await DisplayAsync(await New.Foo()); You can pass parameters inside your page: @await DisplayAsync(await New.Foo(Age: 18, Color: "Green")); You can do the same using the shape tag helper: <shape type="Foo" age="18" color="Green" /> Let's say you create a file Foo.cshtm, that is the default template for the Foo shape. Inside that you can do the following: @Model.Age. What happens here is that you don't have IntelliSense for Age, because it's not typed. When you write the following in your template, what you get for the @age is the string 18. @{ var age = 18;}<shape type="Foo" age="@age" color="Green" /> In Razor, if the property doesn't exist on the type (which is the case here, because it's dynamic) it will be assigned as a string. It will evaluate that doing a .ToHtmlString(). If you really want to get integers, you have a new option in Razor tag helpers to bind a custom property with a prefix. <shape type="Foo" prop-age="@age" prop-color="Green" /> Using the prop- prefix the value will be converted to a property on the shape with the type of the variable that is passed. The @age will be the variable itself, in this case, it will keep the type of that we passed here directly to the property age, which is assigned to the shape. So the shape will keep the properties with the variable type instead of converting them to IHtmlContent. With this new improvement, you can pass complex objects to your shape types. For example, you can pass your object directly to a shape without needing a ViewModel. Demos Content fields indexing Now we have a new module which is Content Fields Indexing (SQL), that adds database indexing for content fields. You can also find documentation about the available tables for the database indexing and the usage of these index tables from a class, from a Razor template and from Liquid too. First, enable the Content Fields Indexing (SQL) module from the admin. If you are using the Blog recipe, you will have a Blog Post content type, thas has a Subtitle Text Field. Let's create some new Blog Posts. Let's create two published and one draft posts. Now head to the database, where you will see the new tables, like DateFieldIndex, BooleanFieldIndex, TextFieldIndex, etc. Because the Subtitle is a Text Field, let's check the content of that table. You can see the three blog posts here, where you can also notice that one of them hasn't published yet. If you enable the SQL Queries module, you can add a new SQL query to list the Blog Posts from the TextFieldIndex table. Hit Save and then Run the query. At the bottom of the screen, you will get the result of the query: the three BlogPost content types. Do you know developers from your company who'd love this feature? Show them that now they can query content items based on the value of the content fields! On Lombiq Talentera.Net meetup This one is for our friends in Budapest: we've partnered with the agile carrier building agency Talentera to bring you .Net meetups! The first one will be in three weeks, us giving a talk on Orchard. Join if you're in the city! Orchard Dojo Newsletter Now we have 91 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!