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 >

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

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

Named style and script Tag Helpers, This is Lombiq! - This week in Orchard (09/05/2020)

Have you ever developed a great feature for Orchard Core that you wanted to add to the source code, but you were not sure about how to contribute the code and submit a pull request? And do you want to know the team behind all that we do at Lombiq Technologies? Here are all the faces, the whole Lombiq team. This is Lombiq! Don't hesitate and check our current post for more! Orchard Core updates Make Login, Logout and ChangePassword paths configurable Now you can change the endpoints for the login URLs. These can't be changed by using code, that's why they had to be in the appsettings.json. You can find the correct way about setting these values in the documentation. How to contribute? Since now there weren't any pages where you can find details about how you can contribute your source code back to Orchard Core. Now if you checkout to the dev branch of Orchard Core you will find a CONTRIBUTING.md file in the root of the repository which tells you everything about how to contribute code and content, submit pull requests and so on. Allow registering named style and script resources with inline content You have Liquid and Razor tags for custom styling/custom scripts and the ability to say where you want your style/script to be rendered. And if you inject a custom script/styling you can set the dependency of your custom script/style. Let's see some Razor example for these additions! Imagine that you would like to add a custom script for your page and use the ID selector from jQuery to select a single element with the given ID attribute. For that, you will need to include jQuery for your page. To do that you have 2 options:Register your script using the IResourceManifestProvider, set the dependencies of your script (for example jQuery), and just simply use the script Tag Helper to inject that to your Razor page. <script name="myVeryCustomScript" asp-src="~/areallycustomscript.js" at="Foot"></script> But you can also set the dependency here by using the depends-on attribute. The second way is to add a custom script and say that you are using jQuery functions, so you will need jQuery to be able to run your script. <script at="Foot" depends-on="jQuery"> $('#myDiv').css('border', '3px solid red');</script> In both cases, you inject your script in the wanted location (foot or head) and set the dependencies of the page. That's great, but imagine that this script is in the template of a widget. And of course, a page can contain several instances of your widget. In that case, your script will be injected multiple times. In some cases, that's what you want, but if not, it's unnecessary to have that script on the page multiple times. You have several workarounds to check if the script/styling is already injected to the page or not, but now you have an easier solution for that. Let's see the following code: <script name="MyScript" at="Foot" depends-on="jQuery"> $('#myDiv').css('border', '3px solid red');</script> The only difference here is the name attribute and this makes this block a named script. Named scripts will only be injected once and can optionally specify dependencies. You can use the style Tag Helper in the same ways: <style name="my-style" depends-on="the-theme"> .my-class { /* some style */ }</style> Adding option to enable MiniProfiler on the admin too The MiniProfiler module can only display its little widget on the frontend currently. Now you have an option to enable it for the admin too. To see it in action set the option, which can be done in OrchardCore.Cms.Web's Startup class with this snippet: public void ConfigureServices(IServiceCollection services){ services.AddOrchardCms(builder => builder.ConfigureServices(services => services.PostConfigure<MiniProfilerOptions>(options => { options.AllowOnAdmin = true; })));} Or you can use the AllowMiniProfilerOnAdmin() extension method in the same method: public void ConfigureServices(IServiceCollection services){ services.AddOrchardCms(builder => builder.AllowMiniProfilerOnAdmin());} For more information about the Mini Profiler head to the documentation, where you can also find a link to the updated Configuration page. Fix RSS items description The issue in the screen below was that if the bodyAspect was not null, we are reused the bodyAspect. The bodyAspect was cached during a request, but if you are rendering many different content items, then we would reuse the same bodyAspect for all of them. In an RSS feed when we build the body of the content items, all the RSS items would have the same body. Now we are also caching the content item ID. If we don't match the exact content item ID we don't restore the cached version of the body. Check the diff in the HtmlBodyPartHandler! Here you could see the related code changes where we also cache the content item ID. Demos Kast Group Finder: an Orchard Core site Kast is an Australian company and one of their primary goals is to implement the Kast platform with the Kast Group Finder component. We worked together with Seth Cleaver (Co-founder and Director of Kast) on this tool to be able to create an intuitive self-service process that enables people within a church to easily find a suitable group to attend, simplify the administrative processes required for getting people into groups, and provide information to the group co-ordinators that might assist in planning and measuring effectiveness. Check out this YouTube video about what can you achieve by using Orchard Core and how you can use the Group Finder and let us know if you have any questions! News from the community RC2 branch If you navigate to the GitHub page of Orchard Core and check the issues, you will find one with the name RC2 Validation. There is a list that contains all the things that are needed to be done to ship RC2. Here you can find a branch that contains the list of to-dos to work on. In this checklist, you can find the items that needed to do when publishing a release. You can check this issue from time to time to monitor the current state of the RC2 release. New Orchard Nuggets posts A breadcrumb menu is a simple but effective navigation aid that shows the user where they are in the site's content structure and which path they can take back. It's also part of the web accessibility guidelines. However, there's no feature built into Orchard Core for this. Nevertheless, how to create a breadcrumb menu? It's actually really easy, just copy a piece of code from this brand new Orchard Nuggets post! Let's suppose you're building your shiny new Orchard Core website. In there you're also building a shiny new page, with Flow Part obviously. You throw together a lot of widgets to get all the bells and whistles on the page, then you save it and BAM! Internal Server Error: "InvalidDataException: Form value count limit 1024 exceeded." What's this, did I break Orchard? Is Orchard trying to break me? Let's find out how to fix this in the second Orchard Nuggets post of the week! This is Lombiq! Do you want to know the team behind all that we do at Lombiq Technologies? Here are all the faces, the whole Lombiq team. All the Orchard developers, leaders, office managers, hardware and software engineers, accountants, advisors! This is Lombiq. The two projects of ours mentioned in the video are DotNest, the Orchard SaaS (https://dotnest.com/), and Hastlayer, the .NET hardware accelerator (https://hastlayer.com/). Note that while we published this video during the coronavirus pandemic it was actually recorded during our 2019 RnDay event, in December 2019. Everyone was safe :). 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 142 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!

Click to deploy improvements, autoroute container routing - This week in Orchard (24/04/2020)

This week we continue the journey with the new upcoming feature of Orchard Core called Click to deploy. But before that, we will check out the new Liquid helpers, the contributors' page, and many more! Finally, don't forget to take a look at our newest Orchard Nuggets post and the improvements in our Orchard Core Training Demo module! Orchard Core updates Themes standardization It can be hard sometimes to keep all the themes updated with the latest changes and improvements of Orchard Core. Now in every theme, you can add a custom template for the title or can use the features of the built-in one. If you check the code of the PageTitle shape in the PageTitleShapes.cs file, you will see the usage of the LiquidTemplateManager that helps you to customize the way how you would like to render the title of your page. We wrote about how to customize the title in Liquid here: https://orcharddojo.net/blog/this-week-in-orchard-09-06-2019. And in some themes, the HeadMeta zone hasn't been used in the layout. Now you have the possibility to show the content of this zone in every theme and rendering this at the end of the head tag. In this case, you can add your custom CSS in this section and have the ability to override the styling of the theme that you are using. Let's check the layout.liquid file of the Coming Soon Theme for these changes. Contributors Orchard Core has more than 150 contributors! The repository of Orchard Core now contains a Contributors.md file, where you can find the profiles of the contributors. They can have different badges, based on the type of work. There are badges for answering questions, doing code reviews, writing blog posts, and so on. Autoroute container routing A few weeks ago we wrote about the new settings of the Autoroute part: 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 If you prefer videos you can also find a demo about this feature on YouTube. And now the huge PR that contains this feature is merged in the dev branch of Orchard Core! Would you like to try this out yourself? Use the latest changes of dev branch now by adding this OrchardCore-preview MyGet URL to your NuGet sources: https://www.myget.org/F/orchardcore-preview/api/v3/index.json as it described here. Thanks for this great feature for Dean Marcussen! Add support for DictionaryAttributePrefix and ModelExplorer property in Liquid You can find an OrchardCore.Demo module in the source of Orchard Core. The goal of this project is to show you the different features of Orchard Core by providing great sample codes. This project has been updated with the latest Liquid helpers. If you open the TodoController.cs in the module, you will find the endpoints of a simple To-do app. But that's not the interesting part. There are 4 related Liquid files in the module. Two in the Todo folder in the Views called Edit.liquid and Index.liquid and two in the root of the Views folder called Todo.Edit.liquid and Todo.liquid. Here comes the content of the Index.liquid file. Here you can see a simple table contains the to-do items. But after the table, there is a button that navigates the users to a page where they can create new to-do items. You can see the block Liquid helper here and the way about how to set the route values for the button. So, if you click on that button you will be navigated to the Create action of the TodoController, that is about to render the Todo.Edit.liquid shape. Here you can also find several new helpers. The form helper is about to render a form and the helper Liquid helper is invoke the input tag helper of ASP.NET Core and binds Text of the Model. If you check the rendered page of the Todo.Edit.liquid file you will see the form that is used to create new to-do items. Every new Liquid helper (form, input, label, validation_summary, validation_for, span) can be found in the Orchard Core documentation. Add icons to Configuration Settings menus When you navigate to the admin UI of Orchard Core and check the root menu items in the navigation bar, you could see that these items have icons. From now, some submenu items are just about to show you some icons too. Head to Configuration -> Settings or Security to see the new ones. Demos Click to deploy improvements If you haven't seen the demo about the upcoming feature called Click to deploy yet, head to YouTube to watch the recording or check out the previous This week in Orchard post because this will be the continuation of the Click to deploy feature. First, navigate to Configuration -> Features and enable the three new features: Add Content to Deployment PLan Click to Deploy Content View or Export Content as JSON Now head to the content items list (Content -> Content Items) and hit the Actions button to open the dropdown. You can see that the context menu is now getting a lot more items. The Export to Deployment Target is about to automatically create a custom recipe file that can be downloaded locally or send it to a remote instance. You can use the Available Targets modal to select the destination. The Add to Deployment Plan is about to add a new content item step using this content item to an existing deployment plan. In this case, a new modal window will open again that lets you choose from the available deployment plans. The Export as JSON is about to directly download the recipe to your computer locally and the View as JSON is a very helpful feature because as you could see in the screen below it shows you the JSON representation of the content item. The same JSON will go to the content step of the recipe when you are hitting the Export as JSON button. Here you have the availability to copy the JSON structure by clicking on the copy icon at the top-right corner of the page. 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 Orchard Core Training Demo module: creating a widget from code We have just added some lines to our Orchard Core Training Demo module to show you the way about creating a new widget from code. In the PersonMigration.cs file we defined a PersonPart, an index table for this part, a Person content type, and from now a PersonWidget. 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. 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. Orchard Nuggets: How to add a favicon under /favicon.ico in Orchard Core Every website needs a favicon of course and you can easily add one to your Orchard Core site from a theme or module with a link tag in a template. However, there's a catch: Certain browsers will still search for it (as a first attempt) under the path /favicon.ico. This can be a tiny bit detrimental to the client-side performance, and show up as annoying errors in your logs. So what can you do to serve a favicon under that path too? In our newest Orchard Nuggets post, we give you the answers! 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 139 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!

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!

Scoped Liquid TemplateContext, Template Azure Blob with Liquid - This week in Orchard (10/01/2020)

Updated Trumbowyg plugin, configure your Azure Blob and Data Protection with Liquid and many more improvements are waiting for you in our upcoming post. Did we forget to mention that Orchard Core is now on the Area 51 site of Stack Exchange? Orchard Core updates Upgrade to ASP.NET 3.1.0 Orchard Core now using the v3.1.0 of the ASP.NET Core framework. This version is included in Visual Studio 16.4.0, so if you are using at least this version, you can build your own solution using Orchard Core. Here you can read a great article about the new features of this release. Validate Site Settings BaseUrl property You can set up the BaseUrl of your site under the Configuration -> Settings -> General on the dashboard. If you enter a URL, which is a not fully qualified URL, you will get a validation error. So, here you need to enter an absolute URL. Template Azure Blob and Data Protection blob configuration with Liquid You can customize the base path of the Blob Storage for media, for data protection and also for the container that you want to use. These can use a template in Liquid. If you have some custom rules to name your container or the base path, then you can define it this way. You can have access to the ShellSettings and the ContainerName properties. This will give you all the flexibility you need for instance to use the same container for all your tenants and then use a custom folder for each tenant. Or a custom container for every tenant and then the same path. You can also ask for the container to be created and it will be done when the tenant is started. You can read more about this feature in the documentation. Trumbowyg 2.21.0 and resizimg plugin Orchard Core using Trumbowyg, a lightweight WYSIWYG editor, that makes easier to edit your HTML content. Thanks to Antoine Griffard, Orchard Core now using version 2.2.10, including the resizimg plugin. For instance, when you set the Trumbowyg as the editor type of your HtmlBodyPart and insert a media with URL, you can just simply set the size of the image with a friendly user interface. Use GetLanguageDirection method everwhere When you check the content of the OrchardCore.Localization.Abstractions module, you will find a GetLanguageDirection extension method in the LanguageDirection static class. This method is used to get the language direction for a given culture. So, if we have an extension method like this, let's use it everywhere in the code. For example, check the code of the CultureDir extension method in the RazorHelperExtensions class, where you can see an example usage of the GetLanguageDirection method. Fix localization accessors names In ASP.NET Core we have many ways to use localization. The IStringLocalizer interface represents a service that provides localized strings and the IHtmlLocalizer interface provides localized HTML content. In Orchard Core, we used T, S, H, TS and TH, so it's time to unify these names and avoid the confusion. From now in the source code, the S will be used for the IStringLocalizer and the H will be used for IHtmlLocalizer. When localizing the views, the name T will be used like before. Scoped Liquid TemplateContext The goal was to improve perf on the Liquid rendering because we were creating a new TemplateContext and resolving all the services for each template. Here the idea is to create a shared Liquid TemplateContext only once per scope for perf, on which we do once a shared contextualization and then a specific contextualization before each rendering. Shared contextualization is done once per scope: add scoped services in ambient values, call Liquid handlers to add more ambient/scope values and access strategies, add all scoped Liquid filters. Specific contextualization before each rendering: e.g contextualize the localizer with the current view context, update the specific model value and its access strategy. And there are many places where we add a ContentItem value to the Liquid scope, we could remove them because now most of the time it is already accessible through Model.ContentItem. Here you can see that there is no need to create a new TemplateContext and add the ContentItem and the Model to it, it's enough to just simply pass the MarkdownBodyPartViewModel. News from the community Orchard Core on Stack Exchange Area 51 Area 51 is the Stack Exchange Network staging zone, where users come together to build new Q&A sites. New site ideas are proposed, discussed, and the best go on to beta. There is a request on Stack Exchange to create a custom community for Orchard Core. If you want to create a community you have to push for an idea and people need to approve and follow that idea. For this, it's needed more people to join and every person can vote for 5 questions and create 5 questions so, the community can continue on to the next stage. If you are interested in, check the FAQ of the Area 51 site and feel free to join the proposal! Orchard Nuggets: How to use Orchard Core without the sample themes? Try to reference the OrchardCore.Application.Cms.Core.Targets NuGet package instead of the OrchardCore.Application.Cms.Targets in your ASP.NET Core web application, that will only add the TheAdmin theme to your solution. In our third Orchard Nuggets post, we show you the differences between these two packages! Check out the other posts for more such bite-sized Orchard tips and let us know if you'd have another question! Orchard Dojo Newsletter Now we have 112 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

How to use Orchard Core without the sample themes? - Orchard Core Nuggets

Try to reference the OrchardCore.Application.Cms.Core.Targets NuGet package instead of the OrchardCore.Application.Cms.Targets in your ASP.NET Core web application, that will only add the TheAdmin theme to your solution. Orchard Core has many built-in themes that can be useful, for instance, if you are searching for a way about how to override your templates using Liquid or Razor. By checking the code of these templates you can see the different custom Liquid helpers and Razor tag helpers in action. But if you would like to deploy your application it could be unnecessary to add these themes to your solution. The Getting started with Orchard Core as a NuGet package page of the Orchard Core documentation mentioned to reference the OrchardCore.Application.Cms.Targets package. However, if you reference the OrchardCore.Application.Cms.Core.Targets you can modify your Startup.cs file the same way, but when you set up your application, you will only be able to use the Blank site recipe, that allows you to set up your site with additional pre-configured options, features, and settings out of the box. Head to the bottom of the content of the OrchardCore.Application.Cms.Core.Targets.csproj file, where you can see that only the TheAdmin theme is referenced. And the only difference is that the OrchardCore.Application.Cms.Targets referencing the themes also among with the OrchardCore.Application.Cms.Core.Targets project. This way you would get a smaller solution without the themes and have a smaller and faster-deployed app to your server with the complete CMS functionality! Did you like this post? It's part of our Orchard Core Nuggets series where we answer common Orchard questions, be it about user-facing features or developer-level issues. Check out the other posts for more such bite-sized Orchard Core tips and let us know if you have another question!

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

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

Advanced content management and starting with theme development - Dojo Course

UPDATE (2017-11-22): Dojo Course 2 is released with new, updated videos! Forms, tokens, projections? Command line scaffolding for themes and shapes? This is what the third Dojo Course tutorial is about. Continuously updated source code for the Course (you can upload the latest source in a zip from here) Using Custom Forms: Creating a content type for using as a form, with fields Creating a custom form with the newly created content type Using Workflows to run custom activities like sending an e-mail when a form is submitted Using tokens to create dynamic texts Using the Projector module to list content items: Creating queries to define which content items to list, in what order and how to display them Creating Projection Pages or Projection Widgets to display the result of the query Using Query Links in Navigation Starting with developing extensions: themes Using the command line tool, help Command line scaffolding: generating a theme with a separate project and adding it to our custom solution Basic settings for your theme with Theme.txt: Name, BaseTheme (inheritance) Using the Shape Tracing feature to reveal how the layout is built up, notion of shapes Remember: if you have any questions don't hesitate to ask them by creating a new issue in the Orchard issue tracker with the "discussion" label. Make sure to prefix your thread's title with "Dojo Course - "! We keep an eye on these issues. Haven't you enrolled yet? Why not do it some time in the near future like right now?

First steps with Orchard - Dojo Course

UPDATE (2017-11-22): Dojo Course 2 is released with new, updated videos! What is Orchard, how to begin with Orchard? Our first Dojo Course tutorial introduces Orchard to the newcomers. The notes for this tutorial: Orchardproject.net (documentation) Technological stack Rough overview of the course structure How to download, how to run -> GitHub repository, source package for devs Run from WebMatrix (download from App Gallery) Basic settings in WM, database Installation: DB layers, database providers, recipes Content types, content parts and fields, content items Content versioning and soft delete Installing modules and themes from the Gallery User management, roles and permissions Widgets, Layers, Zones, Layer rules, how a widget's generated source looks like Remember: if you have any questions don't hesitate to ask them by creating a new issue in the Orchard issue tracker with the "discussion" label. Make sure to prefix your thread's title with "Dojo Course - "! We keep an eye on these issues. Haven't you enrolled yet? Why not do it some time in the near future like right now?