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 >

ConsoleLog helper, IsSectionDefined method - This week in Orchard (03/01/2020)

Happy new year everyone! There was no meeting this week, but in the first post of 2020, we would like to give you a nice overview of the latest improvements of Orchard Core, including the ConsoleLog helper, updated documentation, the new look and feel of our weekly blog post and newsletter and many more! Orchard Core updates ConsoleLog Razor helper and Liquid filter Sometimes you may struggle to get the correct placement or the available alternates of a shape. From now there is a shape dumper to try and see what was going on. Dean Marcussen adapted the dumper to use the ConsoleLog, so when you dump ZoneHolding, you see the holding zone, then another log with all the items in it, with their alternates (as they are calculated at execution time). Let's say you rewrite the Content-BlogPost.liquid to Content-BlogPost.cshtml. In this case, you can use the ConsoleLog Razor helper in the following way: @Orchard.ConsoleLog((object)Model) Then hit F12 if you are using Google Chrome and check the content of the console. The ConsoleLog extension method can be used to dump data from well-known properties, or objects serializable to JSON to the browser console. But if you prefer Liquid instead of Razor, you can use the console_log Liquid filter that will do the same for you in Liquid! Check out the documentation for more info about these new features! Thanks to this new shape dump feature you can construct your Orchard Core site faster and easier! Register User class as an accessible Liquid member Let's say you want to get the User fields from a Liquid template when you are using the UserCreated event of a Workflow. To do that, it's required to make this class an available one from Liquid. Else the only value accessible is the Workflow.Input.User which returns the username. If you check the content of the UserLiquidTemplateEventHandler class, you will see that the User class has been registered. Handle error while rendering resources When using the ResourcesTagHelper and referencing a non-existing resource, it breaks page rendering with the following error: Error 500 : InvalidOperationException: Could not find a resource of type 'X' named 'Y' with version 'Z'. It should log an error, but not break the rendering. To do not break the rendering, the Process method of the ResourcesTagHelper now catches the exception if any and creates a log entry instead of breaking the rendering. Clarify getting started and update for .NET Core 3 in the documentation The Getting Started page of the documentation is one of the most important parts of the Orchard Core documentation where you can see how you can add the Orchard Core NuGet packages to your .NET Core web application. Now this page got some more details about how to create your empty .NET Core web application, how to use the dev packages of Orchard Core and so on. Cloning removed LocalizationSet When cloning a content item that has a LocalizationSet, a duplicate entry of a language was created. That's because the LocalizationSet was not being cleared when cloning so a duplicate entry would be created for a locale. The fix was to remove the LocalizationSet when cloning in the CloningAsync method of the LocalizationPartHandler. Here you can see that the LocalizationSet of the cloned part will get an empty string value. Added IsSectionDefined method Let's say you are using RenderSection to render a zone in a view and you want to render certain HTML elements before and after rendering the zone, only if the zone is available. First, you can call IsSectionDefined to verify if the zone is present as follows: @if (IsSectionDefined("News")){ <div class="news"> @await RenderSectionAsync("News", required: false) </div>} But it was throwing the following exception. InvalidOperationException: IsSectionDefined invocation in '/Areas/XXX/Views/XXX.cshtml' is invalid. IsSectionDefined can only be called from a layout page. The fix for this issue was to add the IsSectionDefined method to the RazorPage abstract class. News from the community Improving our This week in Orchard newsletter We published our first This week in Orchard post on the 20th of June, 2018 and since then we wrote 75 posts, 76 with this one :). Our goal is with the series is to give you valuable news and demos about the happenings around Orchard and Orchard Core every week. To do it we improve the posts from time to time and from this year we would like to introduce a new pack of changesets. Last month we created a poll on Twitter and asked you: would you like keywords about highlights in the title of This week in Orchard blog posts and newsletter subjects? We had 10 votes and everyone agreed that this would help to search, so from now, we changed the title in this way. And that's not everything about the title. Regarding the current date, we used the following format: mm/dd/yyyy. From this year we will use the following format: dd/mm/yyyy, which is a more international way to represent the date. We also changed the structure of the posts a little bit. Let's see the old way: On Orchard 1.x: contained everything that is related to Orchard 1.x. On Orchard Core: contained everything that is related to Orchard Core like the new features, bug fixes, new websites built with Orchard Core. Demos: this section was inside the On Orchard Core section and contained demos about Orchard Core. If there were demos about Orchard 1.x, the On Orchard 1.x also had this section. On Lombiq: news from Lombiq. And now let's see the structure that we use from this year: On Orchard 1.x: new features and news around Orchard 1.x, but the demos will be in a separate place together with Orchard Core demos. Orchard Core updates: bug fixes, new features of Orchard Core. Demos: here come the demos of Orchard 1.x and Orchard Core. News from the community: new websites, news about the Harvest, blog posts about Orchard Core, news from Lombiq, everything that is not related to the code itself. And if you are subscribed to our newsletter you will see that we created a new template for our emails that looks nicer and easier to read. We hope you will like our improvements! Feel free to contact us and share your thoughts about the current improvements or add your own ideas that could help us to make This week in Orchard better! 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!

This week in Orchard - 11/01/2019

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

This week in Orchard - 09/27/2019

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

This week in Orchard - 09/13/2019

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

This week in Orchard - 09/06/2019

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

This week in Orchard - 08/16/2019

More Razor helpers, advanced Liquid support in GraphQL, a new OrchardCore.Application.Cms.Targets meta package, Full-Text-Indexing and updated milestones for Orchard Core. Want more? Then check out our current post! On Orchard Core Added Liquid support to Markdown GraphQL query We have a property in GraphQL for instance called Html on Markdown and HTML body. The new thing is that this Html property on the Markdown body was evaluating the Markdown of the content item. On the client you can directly have the Markdown evaluated, but not the source Markdown. But what was missing is that this Markdown in this body could also have Liquid. It would not interpret the Liquid syntax. Now the method first evaluates the Liquid and then convert the Markdown. Added Liquid Razor Extension Method & Markdown Helper parses Liquid Two extensions, one just to render Liquid as IHtmlContent and the other to render Liquid as a raw string that can be passed to another extension method like the markdown helper. LiquidToHtmlAsync: parses a Liquid string to HTML as IHtmlContent. MarkdownToHtmlAsync: converts Markdown string to HTML. See the updated documentation about the LiquidToHtmlAsync, and MarkdownToHtmlAsync helpers. Documentation to explain how to generate PO files Documentation to explain how to generate PO files has been merged with the tool called PoExtractor. That tool will analyze all the source code and extract all the strings that are used in the localizer. A new OrchardCore.Application.Cms.Core.Targets core CMS meta package There is an OrchardCore.Application.Cms.Targets already that you can point to. If you reference this NuGet package in your project, the CMS will just run and all the dependent Nuget packages will be downloaded. It's also linking all the themes that we have in Orchard Core and there is no way to remove them. Let us introduce a new package, called OrchardCore.Application.Cms.Core.Targets, that just contains the modules and only the TheAdmin theme. In this way you can just reference your own themes and not the other ones, that will make your deployment smaller. So, OrchardCore.Application.Cms.Targets contains every theme that we have in the solution and OrchardCore.Application.Cms.Core.Targets is just the TheAdmin theme. Full-Text-Indexing in Orchard Core This is the settings page of a Content Picker field. Here you can see the following settings: include this field in the index: be able to include the value of this element in the index. stored: when you want the value of the field to stored with the Lucene index. analyzed: when you want the content of the field to split into different words. It means you can search by word and not as a whole. Also, simplify every word, so you can find the root of the word like depends, depending will be converted to depend. sanitized: when you want to remove any HTML from a field. So HTML tags will be not available when you search. tokenized: when you want to convert the value of the field with some custom Liquid logic. Here you can take the content of the field and you can convert it using a Liquid filter and do some computation and so on. If you go to a created content item, you can see there is an option for Full-Text-Indexing in Liquid, that determines if this content type can use a customizable full-text index field by using Liquid. The Liquid template here is accessible in queries with Content.ContentItem.FullText. You can use the Model helper to reference the current element. This feature is still under development and hasn't available in the dev branch yet. Orchard Core updated milestones and Roadmap The milestones have been updated in GitHub of Orchard Core. There are more of them now: rc: we still have the rc for September 23. 1.0: now we have a 1.0 milestone for late October. 1.1: which means the next major release. 1.0.x: some bugs we need to fix that not blocking 1.0, but have to be fixed before a major release. backlog: good idea, will see when we can do that. Let's have a look at our Roadmap! On Lombiq Orchard Dojo Newsletter Now we have 91 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting! There will be no 'This week in Orchard' post next week because of vacation, so see you in two weeks!

This week in Orchard - 08/03/2019

Huge steps to make Orchard Core CDN ready and to support Azure Blob Storage provider and many more improvements and fixes in our upcoming post! On Orchard Core The plural extension should work with NullStringLocalizer There is a unit test that shows the issue. When the Localization module is not enabled we are using the NullStringLocalizer and this case the pluralization was not working correctly. Reload resource settings on update When changing the resource settings (CDN/debug mode etc) the current tenant is not reloaded, so the settings don't take effect. The solution here was to just reload the general site settings when they change so that resources will change to debug/CDN/minified, etc. You can find the changes in the UpdateAsync method of the DefaultSiteSettingsDisplayDriver. Show connection string hint for all data providers When adding a new tenant or set up a new site, for some providers you need to have a connection string. Now a little hint will help you to type the connection string in the required format. Make Orchard Core CDN ready There are two concerns here. One is the Azure Blob Storage provider support and CDN support. These are actually two different concerns. In Orchard 1.x, we used Azure Blob Storage as a CDN, meaning when we would render the media from Azure Blob Storage, we would render the URL from the Azure Blob Storage, so the client would directly download the media from Azure Blob Storage. The Orchard server will not serve the file, the Azure CDN will serve it. In Orchard Core, we are using ImageSharp as the first middleware that serves the media. Right now when we render a file from Azure Blob Storage, we still render the Azure Blob Storage URL, and in this case, the media resizing doesn't work. Based on some feedback from the ImageSharp developers they said we are doing it wrong, you should always serve all your media from your server, even if it's coming from Azure Blob Storage. This way the ImageSharp filter be able to convert the images using the given sizes.When we serve a media, first we load the blob from the server, transform it, cache it locally and finally serve it. The next time when somebody asks for this media, we have it in the cache, so serve it from the cache. In this case, the Azure Blob Storage is not used as a CDN, it is used just like some storage and we have to load it whenever we need to load it. Then we still have the issue of the CDN. How do we do a CDN then, because we can't use Azure Blob Storage as the solution for the CDN? The solution is just to be able to use ACDN for any media that we render either they are from the local disk or from Azure Blob Storage, they will be always served by the Orchard Core server, but when we generate the URL to the generated media (for instance the resized media) we don't generate our own local URL to access our local cache of the resized file, but we generate a URL to a CDN endpoint (that could be any CDN endpoint, like Cloudflare, Azure, Horizon), that itself is configured to ask our server for the media. So, our only job for the CDN support is to generate a CDN URL. It can be an Azure CDN URL, not an Azure Blob Storage URL. With this CDN solution, we could work with any storage provider. When the request comes to Orchard with the local URL, it will download the file from the Blob Storage if it hasn't done it yet. The client cache is active because when we generate these files we had a public cache tag, so the client won't reload the same image again, won't send the same request again. Even if we send a request, it's cached locally on the server, so we won't ask Azure again, just load the file locally. On Lombiq Orchard Dojo Newsletter Now we have 86 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here! If you are interested in more news around Orchard and the details of the topics above, don't forget to check out the recording of this week's Orchard meeting!

This week in Orchard - 07/19/2019

New Media Library web search providers for Orchard 1.x, improved documentation, and demo about the ability to set localization cookie when using the Content Culture Picker in Orchard Core. Read our post for the latest news around Orchard! On Orchard 1.x Demos New Media Library web search providers If you navigate to the modules, you will see some new ones in the Media category: now you can have Bing, Google, and Pixabay web search providers! Let's enable them and see how you can use it. For any web search provider that you would like to use you need to have an API key and provide them to Orchard under Settings -> Media. Now head to the Media Library and hit Import. Then select Web Search from the list to get the Search text box and a select list near that. Here you can use those web search providers, that you have provided an API key for. For example, let's choose Pixabay. If you select one or multiple files and hit the Import button, the selected files will be downloaded and Orchard puts them in the folder you have previously selected. Thank you for the contribution to Milán Keszthelyi from Lombiq Technologies! On Orchard Core Role-based permissions to display admin menus In the following GIF, you can see two admin menus (admins only and contributors only). Their visibility is configured from the roles page. If you logged in as an administrator, you can see both, but if you are a contributor you can only see one of them. Being able to see an admin menu doesn't mean you can see everything inside it, of course, normal permissions still apply. For example, a contributor can see the link menu, but can't see the content types links if they don't have the right permissions for them. Consuming Content Parts and Fields using C# For a while now it's possible to get strongly typed versions of Content Parts and Fields using Orchard Core. Thank's to John Rom, he wrote great documentation about how you can do that! Demos Content Culture Picker - Add ability to set Localization Cookie Last week we wrote about the Content Culture Picker feature of Orchard Core. The Content Culture Picker module helps you to manage cultures for the frontend and now comes with two now options you can set. If you enable the Content Culture Picker module, you can head to Configuration -> Settings, where you will see a new option, called ContentCulturePicker. Here you can decide to set the localization cookie when switching between cultures (this is enabled by default) and to redirects to the homepage of the target culture if the ContentItem of the target culture does not exist. The documentation is also updated about how to set the cookie from the admin site of Orchard Core or by using a recipe step. On Lombiq Orchard Dojo Newsletter Now we have 80 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 every time when a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!

This week in Orchard - 07/12/2019

Lots of new features and improvements and a very interesting demo about the Content Culture Picker is waiting for you in our current post! Oh, and of course our Orchard Core Training Demo Module has got a huge update too! On Orchard Core Set Content Types during Azure Blob creation When uploading a file, for example, a PDF into Orchard the Content Type is set to "application/octet-stream" on the Azure Blob when it should be "application/pdf" (this is the content type that Azure itself picks when you upload a PDF directly). Now Orchard Core has the fix that sets the blob properties during creation. Improve ImageSharp Middleware Processing Speed Because /Media is a well-known location we could improve the processing speed of the ImageSharp middleware and reduce the allocations it makes on every request. At the moment the MediaFileProvider returns IsValidRequest which is the first opportunity for ImageSharp to drop out of the processing pipeline. The first check in IsValidRequest checks for a valid image extension in the URL using Request.GetDisplayUrl(). If we check Request.Path for contains Media first we can bypass all the allocations from Request.GetDisplayUrl() and _formatUtilities.GetExtensionFromUri(...). Let' see the MediaFileProvider now! The IsValidRequest method here first checks that the first segment of the path is equal with the Startup.AssetsRequestPath. The AssetsRequestPath contains PathString("/media"). Add grouping of widgets to their site layer The GraphQL siteLayers query enhanced to group widgets into their layers. In the following screen, you can see that there are two widgets in the Always layer and one on the Homepage layer. Add PathBase PathBase may contain a virtual folder and, before the execution of the tenant pipeline (e.g. when executing a middleware configured at the app level), it doesn't contain the tenant prefix yet. PathBase = /{virtualFolder} - Path = /{tenantPrefix}/somePath// If no value => {}, converting the PathString to a string results in an empty string. Then, when we are in the tenant pipeline (e.g. when executing a middleware configured at the tenant level e.g. by a module), the tenant prefix (null for the default tenant) has been moved to the PathBase. PathBase = /{virtualFolder}/{tenantPrefix} - Path = /somePath In some contexts, we don't have to care about this e.g. when using the URL helper for an action, but here, how we build URLs, this is not the case. So, here it was not working under a virtual folder, the fix is to use PathBase but without reusing the tenant prefix. _contentItemlistUrl = httpContextAccessor.HttpContext.Request.PathBase + "/Admin/Contents/ContentItems1/";var formActionWithoutTypeName = Context.Request.PathBase + "/Admin/Contents/ContentItems"; LocalizationSettings recipe step documentation The Localization section in ReadTheDocs of Orchard Core has been updated with how to add cultures with recipes using the settings step. Demos Content Culture Picker When you enable the Content Culture Picker module, you will get a culture picker shape for the frontend. The Content Culture Picker module helps you manage cultures for the frontend. This uses a dropdown listing all the supported cultures and you select which culture you want to see when you are on the website. The Content Culture Picker selects the URL to redirect to like: if the ContentItem has a related ContentItem for the selected culture, it redirects to that Item if a HomePage is specified, finds the ContentItem that is set as the Homepage and attempt to find a Localization of this ContentItem for the current culture or a NotFound() page Let's see how it works! To create localizable content items, you have to enable the Content Localization module. This module will provide you the LocalizationPart, that you can attach to your content type. For the sake of the demo, we set up the site with the Blog recipe and attached the LocalizationPart to the Blog Post Content Type. Then head to Configuration -> Settings -> Localization to add more supported cultures. Now head to the editor of a content item that has LocalizationPart attached and save or publish it. You can see that our default culture is English and we added 3 other supported ones. If you click one of the cultures, the localized version of the content will be created. We created slightly modified blog posts for each culture to be able to see the differences between them. Now it's time to use the Content Culture Picker! You can find detailed documentation on ReadTheDocs about how to use the picker and what shapes are available for the frontend theme. For now, let's just simply modify the Layout.liquid file of the TheBlogTheme and using the liquid syntax, use the shape shape tag to create and render the ContentCulturePicker shape. We added a white background behind the picker to see it better. Now if you visit one of the blog posts you can switch between them using the content culture picker. On Lombiq Orchard Core Training Demo Module V2 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 has got a huge update with new tutorials: permissions, admin menus, site settings, caching, file management, background tasks, and VueJS! In the StartLearningHere.md you can find all the training sections to easily navigate to the topic that you are interested in. Orchard Dojo Newsletter Now we have 78 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 every time when a new post published to Orchard Dojo, including This week in Orchard of course. Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!

This week in Orchard - 06/28/2019

New queries for GraphQL to return all the configured layers and their widgets and to have access to the site's configured culture settings, and other smaller changes and fixes for Orchard Core are waiting for you in the current post! On Orchard Core Package.json or package.json? If you are using Orchard Core in a Windows environment, you should not to be worried about you have a Package.json or a package.json file. But if you run npm install for example on a Linux operation system, this command will fail because Package.json had the wrong case. So, instead of Package.json, you should call your file to package.json to work with every environment. WYSIWYG editor converts <div> to <p> tag Orchard Core uses Trumbowyg, that is a lightweight WYSIWYG editor when you would like to create a new content item using the dashboard. By using Trumbowyg, you can view and edit the HTML source too. When you edited the source and used <div> tags, the <div> tags automatically converted to <p> tags. In the trumbowyg.js file, you can find an array, called DEFAULT_SEMANTIC_MAP. Semantic generates a better, more semantic oriented HTML (i.e. <em> instead of <i>, <strong> instead of <b>, etc.). Since 2.12.0 you can also put an object to customize the semantic tag mapping for each one of these tags: <b>, <i>, <s>, <strike>, <div>. The issue was in this map, the <div> was converted to <p>. Now it has been fixed. Top Open Source Asp.net Core Content Management Systems (CMS) DotTutorials was developed to give .Net Developers a place to find step by step solutions for their coding problems. They plan to provide the solutions of some of the common & unique programming problems with complete source code for educational & commercial purposes, and in addition, helping developers stay up to date with the latest DotNet Libraries. They have an article in which they list down some top Content Management Systems (CMS) available for .Net Core Developers. And as you can see, Orchard Core is in the list too! Creating an Orchard Core .NET Core Project From Scratch Hofmeister Christian wrote a blog post about how to create an Orchard Core project from scratch. In this guide, he shows how to set up a custom Orchard Core CMS Web Project. He wrote the blog post in German, so if you speak this language, head to his site and read the post! Implemented siteLayers GraphQL query You have a new query that will return all the configured layers and their widgets. This could be useful for defining header/footer content on GatsbyJS or similar sites. Let's see how you can use it with the GraphiQL Explorer! You can see that you can get the description, the name and the layer rule of your layers. If you place widgets in those layers, you can get the details of them too! Using siteLayer you can create more complex queries like: query LayersQuery { siteLayers { description name rule widgets(status: DRAFT) { widget { contentType ... on Markdown { markdownBody { html markdown } } } position renderTitle zone } }} Implemented siteCultures GraphQL query If you use the siteCultures query, you can have access to the site's configured culture settings. We defined 4 supported cultures and made the Hungarian as the default. Now let's run this query using the GraphiQL Explorer! You can see that the default shows that the Hungarian localization is the default one. On Lombiq Orchard Dojo Newsletter Now we have 76 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 every time when 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! There will be no 'This week in Orchard' post next week because of vacation, so see you in two weeks!