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 >

Click to deploy, Update Content Workflow Task - This week in Orchard (17/04/2020)

This week we come with a demo about an upcoming new feature of Orchard Core called Click to deploy. We also mention the improvements of the workflows and the documentation. Don't forget we published three new Orchard Nuggets post this week! And it's time to release Orchard Core RC 2! Orchard Core updates Tab placement documentation You have the option to place a part in a different tab in the editor of the given content type. To do that, you have to add a custom placement.json file to your module. In that file, you can tell the name of the part that will be moved to another tab and the name of the tab which will be created on the fly. Fixes Workflow Timer There was some issue with the Timer event that would reenter themselves. There is a new parameter called isExclusive: when we invoke a workflow task we can say this task should not be re-entered. If it's true, a new workflow instance is not created if an existing one is already halted on a starting activity related to this event. If you would like to run it and it's already running, don't start it again. It's also fixing some background tasks executed in every minute and runs longer than one minute. Here you can see the TriggerEventAsync method in the WorkflowManager class with the optional isExclusive boolean parameter. And here you could see the TimerBackgroundTask that is responsible to trigger workflow timer events. Here you could see the TriggerEventAsync method call with using the isExclusive parameter. Upgrade documentation to Material 5 Orchard Core documentation is using MkDocs, which is a static site generator that's geared towards building project documentation. You can find several open-source themes for MkDocs, Orchard Core documentation is using the theme called Material Design theme. Material 5 has been released and now Orchard Core documentation is also using the new version. Here you can see the highlights of this new version. You can also find a Samples page with great examples about how to use the different kinds of formattings which come from the extensions provided by the new theme. If you click on the pen icon at the right-top corner of the page you can see the Markdown syntax of this page. Adding Update Content Workflow Task When we create a new workflow, we had three different tasks related to content operations: Create Content Delete Content Retrieve Content Unpublish Content Publish Content From now we have a new task called Update Content. If you create a new workflow and hit the Add Task button, you will find this task in the Content category. Here you can set the content type and the content item ID to update and of course the JSON representation of the content item which will be used to update the content item. Demos Click to Deploy Click to Deploy is about adding a deploy action to the content item list. First of all head to Configuration -> Features and enable the Click to Deploy Content feature. Now go to the content items list by clicking Content -> Content Items. You have a dropdown called Actions for every content item. By clicking on this button you will see a new option, called Deploy. When you click that you will see the Available Targets window where you can choose any of the targets that you have preconfigured. If you choose the File Download option you will get a recipe that contains the particular content item in it. But you can use bulk actions too to deploy multiple content items as well. It's configured by creating a particular deployment plan and it's possible to add just the Click to Deploy Content deployment step to the plan or you can also choose to add a content definition step for example. So, in case of every time if you ship a new file to a remote server you will transfer the content definitions too. There is a little setting that you have to set under Configuration -> Import/Export -> Click to Deploy Content. Here you have to pick the particular plan that contains a Click to Deploy Content deployment plan. And the selected plan will be used when you are hitting the Deploy button in the content items list page. If you are interested in the full demo don't forget to watch the recording on YouTube! Note that this feature is under development and can be found in this branch! News from the community It's time to release Orchard Core RC 2! Orchard Core RC 1 was released on Sep 24, 2019, which was more than a half year from now. In the meantime Orchard Core has several new features and bug fixes, which makes it a more stable CMS, that is now used in several sites in production as well. Just remember the sites in Show Orchard with the Orchard Core category. Another issue is that the RC 1 release is using the .NET Core 3.0 version of the .NET Core framework, which is now at the end of support, that means that release has reached the end of life, meaning it is no longer supported and it is recommended to move to a supported release. If you navigate to the issues page in GitHub, filter for the rc2 milestone. Here you can see only the things that are required for RC 2. The real issue here is to update module manifest URL and version and to prevent custom scripts by default. After that, the community will ship the new release of Orchard Core! New Orchard Nuggets posts Let's imagine you've already created an Orchard Core app and now it's time to show it to the world. How do you publish it, or rather, how do you create its publish package? Build processes of .NET Core apps like Orchard Core are getting quite complex nowadays, and the MSBuild build pipeline also commonly includes steps for building client-side resources or doing a lot of things out of the .NET world. What can you do if something goes off course with all those targets and props files and you're just scratching your head? How to figure out what happens during the build if you can only see that the results are incorrect? In our newest Orchard Nuggets posts, we give you the answers! Read this Nugget for an answer about how to publish an Orchard Core app, the second one about how to debug an MSBuild build process when building Orchard Core and the third one for 4 ways to display something from your module nested within a page in Orchard Core! Don't forget to 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 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 136 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!

Database and Azure blob shells configuration, Orchard Core workshops - This week in Orchard (10/04/2020)

Database and Azure blob shells configuration are added to Orchard Core! To get up to speed with Orchard Core the contributors of Orchard Core will hold some unique online workshops in the coming months, between May and September 2020. Check out the workshops' details on the Orchard Core homepage! Orchard Core updates Account views validation messages Instead of using DataAnnotations, in some ViewModels, we are using custom validation methods by implementing the IValidatableObject interface. The reason for that is the DataAnnotations are not localized correctly yet, but this is just a mitigation of the issue and this will be soon supported in Orchard Core. So, let's see an example of that from the OrchardCore.Users module. Here you could see that the Validate method in RegisterViewModel is about to check the values of the required fields and make sure that the user provided the same password in both cases. If there is a validation error, the method returns different kinds of ValidationResults, that contains the localized error message and the list of member names that have validation errors. Database and Azure blob shells configuration The Azure Shells Configuration and Database Shells Configuration providers allow hosting of shell/tenant tenants.json files and related tenants appsettings.json configuration settings in an environment external to the Orchard Core host. By default, the tenants.json and related appsettings.json for the Default shell and any configured tenants are stored in the App_Data folder. This configuration in the App_Data folder is suitable for most sites, however for advanced configuration of stateless multi-tenancy environments, where multiple hosts require write access to these shared configuration settings, you can choose to use either the Azure Shells Configuration or Database Shells Configuration providers. The primary purpose of the Shell Configuration providers is to provide a shared external environment for multi-tenancy where tenants need to be created, and their settings mutated, during live operation of the stateless hosts. It is not intended to support shared configuration between local development and production environments. Here you can see great documentation about how to set up the Azure Shells Configuration Provider and the Database Shell Configuration Provider! Remove unneeded files in TheAdmin There were unneeded files in the TheAdmin theme: the TheAdmin.css and the TheAdmin.min.css. The goal is to have an admin theme that could be used in mobile devices and provide a great user experience. Deleting unneeded files is another step toward mobile-friendliness. Blog theme: Article with MediaField Setup your site using the Blog recipe and head to the admin UI of Orchard Core. This recipe comes with an Article content type. If you create a new Article or edit the predefined one, you will see a new MediaField with the Banner Image display name. Let's change the Banner Image of the existing one and see what will happen! As you can see, this change is to allow users to specify a background picture for an Article. Update ShellHost registrations Currently, we have the following DI registrations for the ShellHost: services.AddSingleton<ShellHost>();services.AddSingleton<IShellHost>(sp => sp.GetRequiredService<ShellHost>());services.AddSingleton<IShellDescriptorManagerEventHandler>(sp => sp.GetRequiredService<ShellHost>()); So here if someone overrides IShellHost, when we resolve <IShellDescriptorManagerEventHandler> as an IEnumerable the ShellHost implementation is still used. The solution is to modify the IShellHost interface in the following way: public interface IShellHost: IShellDescriptorManagerEventHandler {} And now the registrations will look slightly different: services.AddSingleton<IShellHost, ShellHost>();services.AddSingleton<IShellDescriptorManagerEventHandler>(sp => sp.GetRequiredService<IShellHost>()); Now it forces the one that overrides IShellHost to also implements <IShellDescriptorManagerEventHandler> and when all <IShellDescriptorManagerEventHandler> are resolved as an IEnumerable, the right instance is used. Documentation for missing content fields The first table of the Content Fields page in the Orchard Core documentation is about to show you the available fields and their properties. The MarkdownField, MediaField and TaxonomyField were missing from this list. Apply Bootstrap styles to message based on the notification type You can use the INofitier to manage UI notifications. You can have different types of notifications and the notifications with different types can be displayed differently. Orchard Core uses Bootstrap alerts to display the notifications. To add a custom display for every type of notification the Message.cshtml file is now using the contextual classes from Bootstrap (like .alert-success). Setup screen improvements The setup screen has got several improvements: Removed Bootstrap Jumbotron. Moved function setLocalizationUrl() to setup.js. Moved the code and HTML about the culture list from _Layout.cshtml to Index.cshtml. Used fieldset instead of h6 when displaying the Super User text. Separated hints between database and table prefix. News from the community 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! Here you could see a table that contains more information about the first 5 workshops. The Resources page of the Orchard Core documentation has updated with the details of the workshops too where you can also find the Sign-up sheet. Orchard Dojo Newsletter Now we have 132 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!

Error Log Watcher in Lombiq Orchard Visual Studio Extension, Disable and Enable Tasks - This week in Orchard (03/04/2020)

New tasks when working tenants in your workflows, a best practice about how to validate your ViewModel using a service and a spectacular and fun demo about a nice addition to our Orchard Visual Studio Extension! Read our current post for more! Orchard Core updates Tenant Workflows: Disable and Enable Tasks Now you have workflow tasks to Disable or Enable tenants to support tenant management using with Forms or any external services. With these you have four events to manipulate tenants: Create Tenant Enable Tenant Disable Tenant Setup Tenant From now, you can use the workflows to create, setup and then enable the tenants, because we have tasks to cover the whole process. In our case, we created a workflow called Add tenant and used these activities to fire up a tenant from scratch by the values provided by the users in a form. Search inputs Antoine Griffard updated all the search inputs in admin to use autofocus and type="search". This is a way to let the browser display these inputs with better hints. You can even predefine a list of common search inputs if you want. It's not used here, but we could also extend these to do that or show a list of historical data that you put in that textbox. Validating ViewModels We would like to mention this because by reading this solution you could get a nice best practice about how to validate something with a service if you are in a ViewModel. In this current issue, we would like to validate the value of an email address by using the RegisterExternalLoginViewModel. If you would like to validate an object using a ViewModel, you have to implement the IValidatableObject interface which will give you a Validate method. And in this method, you can use whatever service you want. When you create a new instance of your ViewModel, you can pass your service to it in a parameter by using constructor dependency injection. In this current example, we could see the passing of the IEmailAddressValidator to the RegisterExternalLoginViewModel. And in the RegisterExternalLoginViewModel you can use the service in the Validate method injected using the constructor. But, if you see the changes below, you could notice that by using the ValidationContext, you can get your service from the IServiceProvider by calling validationContext.GetService<T>(). In this case, you don't have to pass anything using the constructor when creating a new instance of your ViewModel, just simply resolve your service using the ValidationContext. A new section in the Orchard Core documentation: Resources Now when you open the documentation of Orchard Core, you will find a new item on the menu, called Resources. The goal of the Resources page is to collect any external resources that are available to teach you how to develop with Orchard Core. Our Orchard Core Training Demo module has been added as the first demo project for this page. And you can also found some lines about our newsletter here and the URL where you can sign up for our newsletter! New favicon for the Orchard Core documentation If you check the previous screen again, you will see that the snip contains the title bar of the window too. That's because when you visit the documentation page of Orchard Core, you will face a new blueish favicon, that looks nicer in a browser that uses a darker theme too. Demos Adding BlinkStick support to Lombiq Orchard Visual Studio Extension Orchard Error Log Watcher feature 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. When you navigate to Tools -> Options -> Lombiq Orchard Visual Studio Extension -> Orchard Log Watcher you can enable or disable this feature. You can also set the log file folder path. The path can be anything, so, you can set custom paths as well. The default path here supports the default path of the log files in the case of an Orchard Core and an Orchard 1.x solution too. And here comes the fun part: you can also set to blink or light up continuously a BlinkStick LED stick when a new entry is detected. BlinkStick brings colorful notifications to your computer and wide range programming language implementations give you the power to control LEDs without the need to program a microcontroller and you can choose from different kinds of products. Furthermore, you can also set the color for the LED by providing a hex value or the name of the color. You can find the list of the supported colors here. You just need to plug this device into your USB port and the extension will recognize it! Here you can download this free, 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. And don't forget to watch the full demo on YouTube! News from the community Training Demo updated: how to add an ASP.NET Core middleware to your Orchard Core application? Orchard Core Training Demo module is a demo Orchard Core module for training purposes guiding you to become an Orchard developer. You can use this module as part of a vanilla Orchard Core source that including the full source code - which is the recommended way. You can use it as part of a solution the uses Orchard Core NuGet packages, however, it's harder to look under the hood of Orchard Core features. The module assumes that you have a good understanding of basic Orchard concepts and that you can get around the Orchard admin area (the official documentation may help you with that). You should also be familiar with how to use Visual Studio and write C#, as well as the concepts of ASP.NET Core MVC. We have just added a new section to our module about how to implement an ASP.NET Core middleware in your Orchard Core application. Take a look at the RequestLoggingMiddleware.cs file! Orchard Dojo Newsletter Now we have 130 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!

Contained item routing options for Autoroute Part, Helpful Libraries and Extensions - This week in Orchard (20/03/2020)

This week we would like to show you a demo about the contained item routing options for Autoroute Part among the latest changes of Orchard Core. Then don't forget to check out our updated Orchard Core Training Demo module and the brand new Helpful Libraries and Helpful Extensions from Lombiq! Orchard Core updates Toggle all widgets in Flow Part It could be hard to use Flow Part with multiple widgets because you always have to expand each widget item individually. Sometimes it's quite annoying and it breaks the editing flow. To fix this issue now there is a little toggle all widgets button in the insert widget hover line. Using this button you can show and hide the content of a given widget. And of course, if you click on this button in the case of the Container Widget, the whole content of it will be hidden. A future improvement could be to add the same behavior for the Bag Part and Widgets List too. ViewComponents should be searched in Views and Pages There was a need to put a ViewComponent in the Shared folder of the Pages folder and not just into the Views. This is supported in Razor Pages, so now the ComponentViewLocationExpanderProvider has been updated to also search for the ViewComponents in the Pages/Shared folder. Select All checkbox should react to selected items In many views, we had the same issue and this has been fixed in the Contents, Lucene, Tenants, Users, Workflows and Workflow types pages. Now when you select some items from a list (but not all of them), then the select all checkbox will show you a minus icon, instead of a tick. The tick will be only shown there if every item is selected from the list. Let's see an example for it in the Tenants page about how it worked before and how it is working now. Update taxonomy docs The Taxonomies page of the Orchard Core documentation has been updated with two new additions. First, you could find a new example there about how to use the QueryCategorizedContentItemsAsync Orchard Helper, that provides a way to query content items that are categorized with specific terms. Secondly, you will find some words about Tags. What is the purpose of tags and how to access the TagNames property using Razor and Liquid? Move Header zone to body There was a misunderstanding about what the Header zone is in Orchard Core. The Header zone is for the content and not for the metadata, which could be confusing. If you check the Footer zone, you will find that it's inside the body HTML tag, but the Header zone is rendered inside the head HTML tag. From now the SafeMode theme renders the Header inside the body HTML Tag and the TheAdmin theme does that too and also defines a new zone called HeadMeta that renders the content in the head of the layout. Deployment cards equal heights There was an issue that the deployment step card heights are not equal. If the description of the deployment step is only one row long, it will take less space than a deployment step, which description is more than one length long. Now, this issue has been fixed. Demos Contained item routing options for Autoroute Part Let's say you created a new content item with the Taxonomy content type (or just used the Blog recipe) and attached the Autoroute Part to it. Now let's see the settings for this attached Autoroute Part first. Here you will see three new checkboxes to use: Allow contained item routing: Check to allow users to enable routing of child content items. Manage contained item routes: Check to allow this part to apply routes to child content items. Allow absolute path: Check to allow users to enable absolute paths for child content items Put a tick to these three and head back to your taxonomy content item to check the editor of it. Here you will see a new checkbox with the label of Route contained items. Put a tick here and now view your categories content item. The term content type itself doesn't have an AutoRoute Part on it so we just automatically generate a route for them based on the content item ID and the display text. If we want to make the routing a little bit nicer then you could also add an AutoRoute Part to the term content types as well. Let's add the Autoroute Part to the Category content type and set the container settings of the Autoroute Part that we have just mentioned before. Then if you head back to your taxonomy (Categories in case if you are using the Blog recipe) and edit the definition of the Travel Category, you will find a box that will let you specify that a child content item will be routed to an absolute path. Put a tick here and save the content item. And now if you navigate to your taxonomy again and select the Travel term, you will see that the URL of it will be: https://localhost:44300/travel If you uncheck the absolute option of the Travel category, the URL would contain the URL of your taxonomy, like https://localhost:44300/categories/travel But we are just scratching the surface here. If you are interested in the full demo, don't hesitate to go to YouTube and view the recording! News from the community Updated Orchard Core Training Demo module to RC1 Orchard Core Training Demo module is a demo Orchard Core module for training purposes guiding you to become an Orchard developer. You can use this module as part of a vanilla Orchard Core source that including the full source code - which is the recommended way. You can use it as part of a solution the uses Orchard Core NuGet packages, however, it's harder to look under the hood of Orchard Core features. The module assumes that you have a good understanding of basic Orchard concepts and that you can get around the Orchard admin area (the official documentation may help you with that). You should also be familiar with how to use Visual Studio and write C#, as well as the concepts of ASP.NET Core MVC. Now, this module is fully compatible with the RC1 version of Orchard Core. Yes, we know the RC1 version is quite old now, but we've done it a long time ago but didn't get to finish it. Bug reports, feature requests, and comments are warmly welcome, please do so via GitHub. Feel free to send pull requests too, no matter which source repository you choose for this purpose. Helpful Libraries and Helpful Extensions for Orchard Core from Lombiq The Helpful Libraries for Orchard Core containing various libraries that can be handy when developing for Orchard Core CMS, to be used from your own Orchard modules. Includes: Contents Libraries DateTime Libraries with TimeZone conversion Dependency Injection Libraries Localization Libraries MVC Libraries Resource Management Libraries with Resource Filter feature Utilities The Helpful Extensions for Orchard Core is an Orchard Core module containing some handy extensions (e.g. filters for Projector). Bug reports, feature requests, and comments are warmly welcome, please do so via GitHub. Feel free to send pull requests too, no matter which source repository you choose for this purpose. A new website using Orchard 1.x The project Metis enables EETT adjust its strategy regarding Quality Indices in modern technologies and practical measurements in order to be able to measure more effectively the quality characteristics of telecommunications networks, harmonized as much as possible on best practices of other regulators and domestic providers, be in line with the newest international standards and recommendations, and take advantage of the improvements offered by modern research measurement practices. If you are interested in more websites using Orchard and Orchard Core, don't forget to visit Show Orchard. Show Orchard is a website for showing representative Orchard CMS (and now Orchard Core) websites all around the internet. It was started by Ryan Drew Burnett, but since he doesn't work with Orchard anymore, as announced earlier it is now maintained by our team at Lombiq Technologies. Orchard Dojo Newsletter Now we have 125 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!

ContentElement.OfType extension method, using Pulumi with Orchard Core - This week in Orchard (06/03/2020)

Proposal for new extension method ContentElement.OfType, improved documentation of Orchard Core, UI changes and a demo about how to use Pulumi to programmatically create cloud resources and deploy your Orchard Core application! And finally, let's see the breaking news about the next Harvest! Orchard Core updates Make alerts dismissable in TheAdmin theme Now you can click on a little x at the right-top corner of the alert to close it. Note that this improvement is for the TheAdmin theme. Proposal for new extension method ContentElement.OfType You can iterate over all the properties (let's say parts) of a content item and if this part matches the type you want, then it will let you know. This is a little helper to find the part in the content item or a field in a content part if you know the type that you want. And if there are many of them you will get all of them. For this, you can use the OfType extension method in the ContentExtensions.cs file of the OrchardCore.ContentManagement.Abstractions library. Let's say you would like to get all of the attached PricePart of a content item. In this case, you could do something like this: foreach (var pricePart in contentItem.OfType<PricePart>()){ // } Upgrade blob storage library Upgrading blob storage to use the Azure.Storage.Blobs REST API Client v12 because the v11 client has been identified as not thread-safe, and advice from the Azure team is to upgrade to the v12 library. DataProtection continues to use the old library as it has not been upgraded yet but references it transitively, so we don't need to keep a reference to it. Behavior with regard to directories changes with the REST API Client, so to find directories we now need to enumerate the IAsyncEnumerable with a prefix to see if files exist in the hierarchy. Add create a custom admin theme guide Orchard Core documentation has a new guide explaining how you can add and enable a custom admin theme that uses the TheAdmin as a base theme. Rename ContentField display driver files to resemble class names and conform to conventions Notice that the naming of the DisplayDriver files in OrchardCore.ContentFields was inconsistent and in most cases did not reflect the name of the class within. For example, the HtmlFieldDriver is renamed to HtmlFieldDisplayDriver and the TextFieldDriver is renamed to TextFieldDisplayDriver. Rename GetContentItemIdByAliasAsync into GetContentItemIdByHandleAsync There are methods called GetContentItemByAliasAsync and GetContentItemIdByAliasAsync and these expect a string that is an alias. It can be an alias, but it can also be a slug, an ID or whatever you want. It's like get something by a little name. Based on the prefix of the little name we can find the item. Now these methods have a new name called GetContentItemByHandleAsync and GetContentItemIdByHandleAsync. And the previous methods are now marked as obsolete, so, if you are using these methods, next time you will get a warning message when you build the source code. Validate LinkField URL The validator in the LinkField didn't allow you to use anchor links within the URL input. Now it has been fixed and it's accepting a URL with an anchor. Head to the LinkFieldDisplayDriver.cs and check the code of the UpdateAsync method! Add missing Sender SMTP field and add Author expression editor for the EmailTask Based on the specs, we should be able to set the From and the Sender fields. Today we only ask for From and actually copy it to the Sender. We were missing the Sender field for the SMTP message that we want to send. The sender is optional, it is useful when the email author is different than the email submitter. From now you can use this field when sending an email. And if you are using the Email Task when building your workflow, now there is the expression editor for the From and Sender properties on the task. If you haven't provided the value of the author (in the From field), the value of the Sender field will be used. Sort dropdown widgets alphabetically When having to insert widgets in the FlowPart content editor, the list of all widgets is displayed according to creation date which gets quite messy with a lot of widgets. An easy solution, for now, would be to simply sort the name of the widgets alphabetically to give it some easy structure. So, from now when we list the widgets in the Forms and the Widgets List UI, it's alphabetically ordered. BagPart documentation There is new documentation explaining how to use BagPart in Orchard Core. Here you can also find samples about how to do templating both with Razor and Liquid and what are the available alternates that you can use when working with BagPart. Demos Using Pulumi with Orchard Core By using Pulumi you can programmatically create cloud resources in Azure, AWS, Google Cloud or Kubernetes. In this video, you could see that how does it work in the context of an Orchard Core application, but of course, it works for any website that you want to deploy. It supports the notion of infrastructure as code, that allows you to define your infrastructure literally as code. This is very powerful, because that allows you to create for example your Azure App Service or even a Kubernetes cluster programmatically, so you don't have to do it manually. If you are interested in this demo, don't forget to watch the YouTube video about it! News from the community Breaking news about the next Harvest Based on the ongoing events the best would be to cancel Harvest. Right now there are so many unknowns about the evolution and the spread of the virus. Maybe London will be blocked, maybe Washington will be blocked, we don't know. And by asking about 50 people from everywhere around the world to meet in a closed basement for three days could not be the best idea for know in terms of health. So, Harvest will be postponed until things are settling down. This is the safest choice right now and also the most secure in terms of organization. Orchard Dojo Newsletter Now we have 121 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!

Users change email feature, register DisplayDrivers with ContentOptions - This week in Orchard (22/02/2020)

Orchard Core has got very useful and great features again! The blog recipe is extended with predefined search settings and permission with banner images. Now users can change their email address and the documentation of Orchard Core is getting better and better! Then we will see a demo about how to use Orchard Core as a Headless CMS with an Angular 9 client app using GraphQL! Orchard Core updates Add search settings and permissions for the blog recipe Now when creating a new tenant with the Blog recipe it will automatically create all the required assets to make the search page work. This means that you will find a SearchIndex called Search in the recipe and the users in the anonymous role have the permission to query this Lucene search index. Add Media to Blog and Blog post When you install your site using the Blog recipe you will get a sample blog theme with some predefined content that could be very helpful to you if you would like to create a blog using Orchard Core. Now the Blog and the Blog Post content types have a new Media field, called Banner Image. With this new field, you can edit the banner image of the blog and of the blog post. The Blog theme and the recipe is also modified to have a default banner image for both content types. Users Change email feature Head to Configuration -> Features where you will find a new feature called Users Change Email. When you enable this feature (and the Email feature too), this allows users to change their email address. After enabling this feature you will find a new menu under Security -> Settings, called Email. On this page you will find a new checkbox: Allow the users to change their email. If you put a tick here you will get a new endpoint that you can provide for your users. If you navigate to ~/ChangeEmail URL, you will see a screen, where the user can provide the value of the new email address. Document missing global methods If you open the documentation of Orchard Core and head to the Scripting page you will find the list of the global methods that you can use to evaluate scripts. The variables(), parameters() and configurations() methods were missing from this table, now the documentation contains these ones as well. Rendering zones before rendering layout When we used to inject the body in the dynamic layout shape template, it would go over every zone in the layout and render them in memory and only after that called the actual shape layout to be rendered. This way all the zones from footer and header will be invoked after every inner zone. If the inner zone is defining some resources, then they would be taken into account once they are injected in the footer and header. There could be some widgets for instance that would try to define some resources, but they would not be taken into account because the header is already rendered. Check the ExecuteAsync method of the ThemeLayout class in the OrchardCore.DisplayManagement module. Layers documentation Orchard Core documentation has got a new page again! When you navigate to the page of the OrchardCore.Layers module you will find the description of the layers, the list of the predefined layer rules and about how to use zones. Register DisplayDrivers with ContentOptions This change allows you to register custom drivers, but instead in the DI, in a custom data structure. If you crate drivers you have to follow the new way to do that. So, for both Display Modes and Editors, you can customize the Display Driver that will be resolved for the particular mode. This allows you to create custom display drivers that might return a different ViewModel to the standard Display Driver. services.AddContentField<TextField>() .ForDisplayMode<TextFieldDisplayDriver>(d => String.IsNullOrEmpty(d)) .ForDisplayMode<MyCustomTextFieldDisplayDriver>(d => d == "MyCustomDisplayMode"); This example will alter the registration for the TextFieldDisplayDriver to resolve for only the Standard (null) display mode, and register MyCustomTextFieldDisplayDriver to resolve for only the custom display mode. You can find more information about how to register drivers with ContentOptions in the updated documentation of the Content Fields module. Menu: Hide Preview button in admin If you go to edit a menu you saw the Preview button. But you can't preview a menu because a menu is injected in a page like a layout, so there is no specific way to view a menu. If you call Preview on the menu it will try to render the menu without any context and that will not work. Either we add a PreviewPart on the menu and then we can say what page we want to see when we preview the menu that could have been a way to do that. Or the easier solution is to define a placement file where you say that the content preview button shape is hidden when the content type is a menu. This placement file is in the OrchardCore.Menu module. Demos Orchard Core Headless CMS with an Angular 9 client app using GraphQL Watch a great video about how to set up a Headless CMS using Orchard Core then make API calls from an Angular 9 client app using GraphQL! You can find the source code of the demo project in this GitHub repository News from the community New websites using Orchard Core RaiseTheGame is designed to inspire meaningful cultural and behavioral change in all game companies, whatever your size and wherever you are in your diversity and inclusion journey. The guys behind Modern Wolf believes the true test of a publishers value is the decision of those it supports, to work with them again. This mantra is the benchmark against which they base all of their operations and decisions. If you are interested in more websites using Orchard and Orchard Core, don't forget to visit Show Orchard. Show Orchard is a website for showing representative Orchard CMS (and now Orchard Core) websites all around the internet. It was started by Ryan Drew Burnett, but since he doesn't work with Orchard anymore, as announced earlier it is now maintained by our team at Lombiq Technologies. Orchard Dojo Newsletter Now we have 118 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!

Display mode options to Parts, Search views for themes - This week in Orchard (14/02/2020)

Display mode options to Content Parts, adding search views for themes, import recipe from a JSON file and many other changes and new features come in our current post. After we will see a real-world example about how to use Orchard Core in production. Then check a new website built with Orchard Core and finally let's talk about the latest news about the Harvest! Orchard Core updates Add revision date in the documentation Now each page of the documentation will display the revision date of the current page. Open any page of the documentation and scroll down to the bottom of it. There you will see the date of the last update. Use ControllerModelUpdater on controller instead of implementing IUpdateModel When you want to Build, Update or Validate your model from controllers, you don't have to implement IUpdateModel, because each of them can be resolved by injecting the IUpdateModelAccessor. Here you can see the NodeController, where we need to build the display for the AdminNode using the TreeThumbnail display type (line 74). Instead of passing this, we can pass the _updateModelAccessor.ModelUpdater. Only show fields in Summary and Detail display types In the past, if you added a field (or a few fields) to a blog it's SummaryAdmin view shows in the list of blog posts. That's because the fields are automatically displayed in SummaryAdmin. Now, this feature prevents to display all the fields automatically in the SummaryAdmin. If you check out a driver of a field, you will see that the values of the Location now changed everywhere in the case of the Initialize method. Add display mode option to parts Now we can have custom display modes for Content Parts too! For example, now you could define which tag would you like for the title and the name of the tag could be the display mode of the TitlePart. Fix themes search views fix Changing all the themes to provide a nice view for the search feature. There was a default version of it, but now each theme has it's own and now it looks great in every built-in theme. If you want to change the look of the search form, you would override the SearchForm template, if you would like to override the search results page, the SearchResults template will be the one you are looking for. But of course, you can override the whole look and feel of the search template just by overriding the Search template. Here you could see the Agency theme with the search form and search results. And you could find really great and detailed documentation about how to implement a website full-text search and everything about the new templates. YesSQL: when to call Session.Save? You can call _session.Save(contentItem) as many times as you want, it's free. It's just marking a content item to be saved once the session will be disposed. There will nothing happen when you call _session.Save(contentItem). If you call it multiple times, the first time it will mark it, the second time it will say: It's already in the dictionary of things to be saved. It will be just a dictionary lookup. Call _session.Save(contentItem) when you think the thing should be saved once the session or the request is done. And if multiple things update a content item and you need to tell the session to save it, they can all call _session.Save(contentItem). Import recipe from a JSON file When you are importing a recipe, you have to upload a ZIP file. The logic then extracted that file and found the JSON file in it. From now you can pass a JSON file when importing a deployment package, not just a ZIP. Recipes documentation And if we are talking about that you can import a recipe from a JSON file, we also need to mention that the documentation of Orchard Core has got a great detailed page about the recipes. Here you could see the format of the recipe, the possible steps of the recipe and see samples about each of the steps (Roles Step, Queries Step, Media Step, Layers Step, etc.). RequireUniqueEmail message Now when you would like to register a new user with an email address, that already exists in the system, you will get an error message says that the email is already used. Demos SaaS and OpenID: a real-world example There is a solution called Trivest Connect (an Enterprise Resource Planning application) that currently includes five different companies. One problem that Trivest solves that everybody sends messages to each other and there is no standardization, that is not so optimal. In the use of Trives Connect with many other features there is a standard document format and with that, it is easier to exchange orders, invoices, VIA, etc. Trivest Connect is based on Orchard Core installed with the Software as a Service recipe that is using the built-in Open ID Server. Here you could see that there are really just a few modules enabled in the admin UI. What customers can do is they can send messages to other customers. This is just an administrator portal because, in reality, this is all done behind the scenes in the ERPs. If you would like to see the whole demo of this real-world example just head to YouTube and watch the recording! News from the community A new website using Orchard Core RA Capital Management is a multi-stage investment manager dedicated to evidence-based investing in public and private healthcare and life science companies developing drugs, medical devices, and diagnostics. And they decided to use Orchard Core to implement their website! 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. Latest news about the Harvest There is a new offer from someone from the UK to host Harvest in their offices. They mention 50 people fit in the office. This office is located in London. The possible date for hold the Harvest is the last full week of June. We have to decide the length of the conference and talk about holding a workshop during Harvest. By the past, we have usually done it at the beginning of the week, because this way you can arrive at the weekend, take your time or get back from jetlag or do some tourism. And then if you want you can extend your stay to the week. So 22-23-24 might be the tentative dates. Usually, 2 days are too short and 3 days are too long, but we will see. What do you think about June 22-23? Feel free to comment on that on Gitter too! Orchard Dojo Newsletter Now we have 116 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!

Cors, user account activation - This week in Orchard (31/01/2020)

This week we would like to show you two new Orchard Core demos: the user account activation and the new CORS module. But before that let's take a quick look at the newest features and improvements of Orchard Core! Finally, let's see what about the next Harvest? Orchard Core updates Add more Resources documentation The Resources page of the Orchard Core documentation has been improved a lot. Now on this page, you can find examples about how to register a named resource by implementing the IResourceManifestProvider interface, how to render your registered resources in the different sections of the page using Liquid or Razor and many more! Update the OpenID YesSql stores to execute a concurrency check on updates We have a new feature in YesSql when saving a session. Check out the following line: _session.Save(application, checkConcurrency: true); In the code snippet above, we would like to save the Open ID application and check that nothing has changed the application between it was loaded in this process and saved with the current changes. And if there is an issue, it will throw an exception when we call await _session.CommitAsync(). Then it will catch the ConcurrencyException saying something else changed the application while you were saving it so, please try it again. Fix issue with layers that can be drag and dropped to zones The targets for the zone dragging were too loose and then you could drag a widget to a layer or a layer to a widget. Now it's fixed. Fix regression for Tag Helpers not working There was an issue that some things were working in development mode and not in release mode. In development, Orchard Core finds the Tag Helpers because views are compiled at run time in the context of the application, while published .Views.dll files have been precompiled in the context of their related module or theme. In production, it will not work, because for example if you would like to use the ContentItemTagHelper, the reference was missing from one module to the OrchardCore.Contents module. Dean Marcussen created a new OrchardCore.Contents.TagHelpers project, that contains the Tag Helpers of the OrchardCore.Contents module. And now whenever we have Tag Helpers, we put them in their *.TagHelpers library. So, when our themes and other modules will need those Tag Helper, we can just reference this library and not the full module. In the _ViewImports.cshtml files where we are using the OrchardCore.Contents assembly to find Tag Helpers we need to look for the assembly named OrchardCore.Contents.TagHelpers. It should not break any websites if you are using Liquid, but if you are not using Liquid, it's possible that the site will be broke after this change, meaning the Tag Helpers won't be found and as we said, you need to change your _ViewImports.cshtml. In the future, we have to do the same for all of the Tag Helpers. Standard display option for each field If you want to add a Display option for a field that does not have a standard one, when you re-edit the settings and save, the new one will be selected as the default even if you don't want it. To solve this issue we added a Standard option for all the fields. Let's see the HtmlField.DisplayOption.cshtml file as an example. Sort Workflow instances Your Workflow could have several Workflow instances and if you have many of them, it could be hard to find the one you want. In the past, you had the option to filter the instances by their status (all, faulted, finished), and now there is a new option to sort these instances. You can sort them by the recently created or the least recently created. Simplify part settings retrieval for ContentPartDisplayDrivers In the ContentPartDisplayDrivers, we need to resolve the ContentDefinitionManager, query the type definition and then find the part that is named the same that we are using, take the first one and get the settings. But in the BuildPartEditorContext and UpdatePartEditorContext we already have the TypePartDefinition of the part that we are currently editing, so we can just get the settings from there. This change made the code simpler and technically faster. Just take a look at the changes in the AutoroutePartDisplay! Demos User Account Activation Currently, Orchard Core supports registration and approval or manual entry. What about having a way to have the option to invite users onto the platform and let them choose their password and then activate their account? Let's see a possible future release for this feature! Install your site and then enable the Users Registration feature. Now head to Security -> Settings -> Registration, where you will find a new option: Administrators can send an activation email to a user. Put a tick in this box and select the AllowRegistration from the select list. Now go to Security -> Users and hit the Add User button. Here you could see a new switch called Send Activation Email?. If you create this user with this switch enabled and hit Save, this user will get an email that email will contain an activation link. If the user clicks on this link, they can choose a password for the account. After they set the password their account is activated and they can log in to the site using the newly created password. To do that, you should disable the account of the user when creating it. But what's behind this feature? Create two new Workflows to send emails. Let's call the first one to UserAccountActivation and add the Account Activation event as the startup event for this Workflow. Then add a Send Email task that will send the email to the user. This email will contain the activation URL of the user. Create another Workflow that will send another email that tells the user that their account is activated. Let's call this Workflow UserAccountActivated. Here you could use the Account Activated event as the startup event and again, add a Send Email task. The feature will be improved in the future because as you can see, the Send Activation Email switch is not really about sending an email, it's just about rising an event, that you can use in your Workflows. Instead of this, we could have for example a user state (Needs Activation) similar to the IsDisabled switch. And that's not all! If you would like to know more about this feature, head to YouTube, where you can find the full demo about the user account activation! Cross-Origin Resource Sharing (CORS) module If you head to Configuration -> Features and enable the Cors Configuration module, you will find a new option under Configuration -> Settings, called Cors. If you navigate here you can add as many policies as you want using the Add a policy button. On this page, you can add the name of the policy, set that as the default policy and configure everything that you will need to enable CORS. If you are interested in the full demo, don't forget to check out the recording on YouTube! News from the community The possible date of the next Harvest We had two possible dates for the next Harvest: one in February and one in April. Now it looks like it won't happen in February, so the only option left is to do a Harvest in April. The possible days could be between 13 and 17 in April. We also have two possible locations, which are Nice and Miami. Stay tuned for more information about the next Harvest! 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 114 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!

Sitemaps, headless recipe, jsonparse Liquid filter - This week in Orchard (24/01/2020)

With many more features and updates, this week we check out the new headless recipe, the new jsonparse Liquid filter and the updates of the Orchard Core documentation. We show you a demo about the Sitemaps feature and write about when to ship version 1.0 of Orchard Core! Orchard Core updates Add Headless recipe Now you can find a new recipe called Headless. This is a new setup recipe that sets up a headless site that consists of CMS modules with GraphQL and OpenID. If you want to build a headless site, you will need to set up your site using this recipe. By the past, we were suggesting users do an empty site using the Blank recipe (empty.recipe.json) and then to enable OpenID and the needed modules. By using this recipe these modules are enabled by default. If you haven't seen it yet: there is a great detailed demo on YouTube about what will you get if you install your site using the Headless recipe. Documentation for recipes and starter themes included with Orchard Core Orchard Core is available for use via two different NuGet meta-packages: OrchardCore.Application.Cms.Core.Targets OrchardCore.Application.Cms.Targets You can also use several built-in themes: The Blog theme The Admin theme The Agency theme The Coming Soon theme The Theme And choose from different kind of recipes: Empty recipe Blog recipe Headless recipe Agency recipe Coming Soon recipe Saas recipe These themes and recipes include different configurations, different range of Content Types, Widgets and so on. There is a new getting started guide that lists what will you get if you install your site with one of the built-in recipes. If you are new to Orchard Core this guide will help you a lot to choose the recipe that fits the best for you. Fix previewing When you preview a content item we create a transient content item in the server-side memory and then we asked it to be rendered. Then we send the rendering to the client. That's how the preview feature works. Every time when you do a keystroke, we fake like it's a real content item, ask the server to create it in memory and to render it in HTML and send us back by the HTML. The issue was when we create it on the server-side it's like a real creation including indexing. Lucene will be like: there is a new content item to index, so let's index it! And then it will appear in the index, but it's just a preview. The idea is to find a way to mark it. A possible solution is to check the ID of the content item and if it's -1 (it's a logical value that we set for the content item to say it's transient), it's not a real content item, so just ignore it. Update "Creating a modular ASP.NET Core application" guide The section called Registering a custom route in the Creating a modular ASP.NET Core application is out of date with code generation templates and implementation since the upgrade to .Net Core 3.0. Generation templates create a Configure() method which accepts an IEndpointRouteBuilder (formerly IRouteBuilder), which does not have a MapAreaRoute() method. MapAreaControllerRoute() is the method to use here. Get draft content item by the alias Before we just indexed the published version of the aliases. If you are following the Creating a new decoupled CMS Website guide it tells you how to get a preview of a content item using an alias in a custom Razor Page. The issue is that it would not work if you were creating a new item and then previewing it, because there would be no published version of the content item, so it would not be able to find the content item by its alias. Now we are indexing the alias for both for the latest and published versions of a content item. The latest version can be the published one if there is no draft. Add jsonparse Liquid filter Let's say you would like to be able to pass a custom JSON using Liquid. Before that, we have to create a string separated by commas and then split it and then you will have an array. And then do it for each property you want, because you wanted to generate tables based on existing values you had. In the documentation, you can see an array of objects captured to a variable named someCollection. Using that, someCollection becomes a string variable that contains that JSON document. By calling the jsonparse using the someCollection you will get a JObject and then it can be iterated on and accessed by the key and value properties. This filter is enabled by default when you do Liquid. When to ship Orchard Core 1.0? We have issues labeled with P0 and P1. These issues should be fixed to ship version 1.0. We can't ship the new version without fixing these issues. The more the community works on these ones, the quicker we can release 1.0. Feel free to grab from these to be able to release sooner! Demos Sitemaps module revisited Let's set up a site using the Blog recipe. Then head to Configuration - > Features and enable the Sitemaps module. To use this module you need to set up the Base URL of your site under Configuration -> Settings -> General. After you have typed a fully qualified base URL of the web site, head to Configuration again, where you will see a new submenu called Sitemaps with two options: Sitemaps and Sitemap Index. Choose the Sitemaps one and click on the Add Sitemap button. Here you can see an Enabled checkbox, that gives you the ability to enable or disable your sitemap. If you uncheck this, you can disable the routing to the sitemap. If you are in the middle of constructing your sitemap or you don't want to publish it for some reason, you can uncheck this box. Give your sitemap a likable name and hit Create. Now you can add sources to your sitemap using the Add Source button. Here you can add Sitemap content types, that are entries for each one of the selected content types. Here you have the possibility to index all content types or just the selected ones. You can also limit the number of content items to provide from this source. Let's say we want to include the first 50000 blog posts to this sitemap source. After you hit Save, you can view your sitemap. To create a sitemap index, select the Sitemap Index option. Here you can set the URL of the sitemap index and the sitemaps this index contains. We have only one sitemap, so, select that one. When you enabled the Sitemaps feature, you could see another related one in the Features list, called Localized Content Items Sitemaps. If you enable this module and have localized content items, you can build localized content items sitemaps. Let's see how a sitemap like this looks like! Here you can see the language of the given content item inside the hreflang elements of the XHTML tags. The content with the primary culture of your site goes first, which is en-US in this case. In the screen below you can see a sitemap that contains one blog post, that has a Hungarian localization too. And that's not all! If you would like to know more about sitemaps, head to YouTube, where you can find the full demo about sitemaps! This feature is still under development, but you can check the PR here. News from the community 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!

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!