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 >

This week in Orchard - 05/31/2019

In our post, we show you how you can create a SPA with the new recipe in Orchard Core. We also mention the tab support for admin/content edit for Orchard Core and the updated text field predefined list radio button alignment. Check out our post for more! On Orchard 1.x Lombiq had another Orchard issue bug fixing hackathon where the goal was the same: fix as many issues for Orchard 1.x as we can. We made good progress again and fixed several bugs. Let's see some of them! Adding indexes to CommonPart(Version)Record tables There are no indexes on CommonPartVersionRecord and CommonPartRecord columns, which can cause performance issues and query timeout with a couple of thousand content items in common scenarios, such as simply displaying the content list at "/Admin/Contents/List". This listing can order items by Created/Modified/Published date, so at least those columns should have an index. In this PR we added the indexes to CommonPartRecord and CommonPartVersionRecord tables. Extending automatic Workflows CSS discovery with caching Using ICacheManager we store the names and paths of the resources used by the activities and now the IResourceManifestProvider hasn't been called on every page load. You can find the corresponding PR here. Workaround for the Azure blob rename bug This is a workaround only since the bug is in the AzureStorage SDK. When you rename the folder and the name differs only in casing the file will break - except if you rename it to a temporary name and then rename it again to the target name. On Orchard Core Update text field predefined list radio button alignment When you using the admin to set up the editor of your text field, you can choose to have radio buttons as the type of list editor when selecting the predefined list editor type. Here you can see the editor to set the options for the list. Unfortunately, the alignment of the radio buttons was not properly shown, but from now you will see a correctly formatted editor. Improve the documentation of the OpenId module The OpenId module of Orchard Core has got new features and improved configuration settings from time to time. Now the documentation has been updated with more lines about the way that how is the authorization server feature works. Tab support for admin/content edit When you create a driver you can define the placement that is the zone where you want the shapes to be rendered in like in Orchard 1. The validation remains outside the tabs. Let's see how does it work! First of all, add a new placement.json file to the theme that you use for your admin site. Now we added the placement file to the TheAdmin theme with the following content: { "TitlePart_Edit": [ { "place": "Parts#TabContainsTitle:0" } ]} This means that move the TitlePart of every content item to a tab called TabContainsTitle when editing. As per O1 if there are no tabs the editor does not display the tab dialog or wrap the content in a border. In the following screen, you could see the editor of the Landing Page content type (defined by the Agency recipe) with the two tabs. Styling is an extension of Bootstrap tabs, so works with RTL as well. Also, the tabs could go into a collapse if there are a lot of them. Demos Orchard Core SPA Install your site using the Headless CMS site recipe that creates a site with Single Page Application and content management features. Then when you open your site you will face with the following message: "File `index.html` not found. Please check the settings and/or upload your SPA" When you install your site with this recipe, you enabled the OrchardCore.SpaServices module. The purpose of this module is to serve static content and render a single page application for headless CMS mode. Once you enable the module, a spa directory is created under the site's folder from which the server serves the static files. This is the place to put your application's files. There are two options for bootstrapping, one is to use a static file and the other to define a Layout__SPA template with liquid syntax support. In the settings page, you can set the name of your static HTML file that you would like to be your home page. If you just simply copy an HTML file here with the given name, Orchard will render it as your home page. So, let's remove the tick from the checkbox near the "Use static HTML file" and create a new template called Layout__SPA. We can use the dashboard to do that if we navigate to the Templates option under the Configuration. Before creating a template, create a simple content type and a new content item that we can use in our liquid template. This MyContentType has a TitlePart, AliasPart, AutoroutePart and HtmlBodyPart. Let's see what can we do within our template. For example, let's find this content item by the alias and print the DisplayText of this content item. Note that we have also applied some styling to our template. The mystyle.css file is placed under the spa folder. Note that the PR for this feature is still open and might change in the future. On Lombiq Orchard Dojo Newsletter Now we have 66 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! 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 - 05/24/2019

In our post, we would like to show you some improvement of the content items list and the Markdown editor of Orchard Core. We also mention the Command Line support for Orchard Core. Check out our post for more! On Orchard 1.x Lombiq has an Orchard issue bug fixing hackathon and the goal was to fix as many issues for Orchard 1.x as we can. We made good progress and fixed several bugs. Let's see some of them! NumericField default value merge error fix The Default value of the NumericField was removed by accident after a merge. Now thanks to this PR, the textbox for specifying the Default value to NumericField was readded. Merge DraftFieldIndexService.cs into FieldIndexService.cs In Orchard 1.x, you could use the DraftFieldIndexService to save the draft and the FieldIndexService to save the published FieldIndexRecords. Because of these services do the quite same thing (the only difference is to save the Published or the Draft version of the record), it could be a good idea to remove DraftFieldIndexSerivice and keep only the FieldIndexService and have an enum to set which version you would like to save. You can find the implementation in this PR. Removing IProjectionManagerExtension There was an IProjectionManagerExtension interface to provide additional methods to the IProjectionManager. For example, you can get the content items by providing the ContentPart and a number to skip, which could be a great way to have pagination. Now the methods inside the IProjectionManagerExtension moved to the IProjectionManager and the IProjectionManagerExtension interface has been deleted. See the changes in this PR. Updating Newtonsoft.Json everywhere Orchard 1.x uses an outdated version of the Newtonsoft.Json library. We updated this package everywhere in Orchard to use the latest version. Fixing that stylesheets are not found on Dashboard Resource URLs are not replaced with file virtual path in StylesheetBindingStrategy leaving the URL pointing to TheAdmin theme folder instead of the related module path. Now when you visit the admin page of Orchard and open the Developer Tools in your browser, you will notice the missing 404 errors for the CSS files thanks to this PR. Fixing that Orchard.Workflows requires styles that don't exist We had a quite similar issue here as in the previous one, except there were also some empty CSS files that are included in the csproj files. You can see the fixes here. On Orchard Core Build error if a module with views doesn't use the Razor SDK If you create a module and you have views inside and you didn't correctly use the Microsoft.NET.Sdk.Razor SDK you will get a build error. In the project files, there is an SDK tag at the top and you can define which SDK the project should be built with. When you have Razor views, you need this SDK to be able to get precompiled views and embed them in the assemblies. Now if you have views and you didn't do that, the build will automatically fail to prevent failing in runtime because it could not find specific assets or views. Or maybe you started to implement your module with a standard class library, which didn't have views, then you add a view and don't understand why it doesn't work anymore. Consider Command Line support for Orchard Core There was some Command Line support in Orchard Core, but it was removed because of performance concerns. The code that is currently in for Command Line support for Orchard Core is using the same concept as Orchard 1, where modules can provide custom commands with the Command Line extensibility. The idea would be to have a CLI that is not in process of the Orchard host, but out of a process like a very separate .NET CLI, that will talk using HTTP with the host and the tenants. Therefore we could even use a CLI to remote control some tenants or instances. We don't have to run the CLI on the machine that runs Orchard. Being able to run remotely the CLI would be nice, and to automatically discover the commands from the API. You can find more details about the Command Line support for Orchard Core in this issue. Admin CSS: wrong BS4 version If you create a new pull request and don't update to the dev branch, then you will also submit an old version of Bootstrap and assets and people will have to fix it again. The only way to prevent that is by having a CI task that will ensure that the version is committed and rebuilding the assets doesn't change anything. We can't automate it, but we can fail the build to detect it. That would be an improvement because at least we could show the issue before we commit the issue. Orchard Harvest Based on the progress on Orchard Core, we could totally have something in September or October, like we did last time in a warm location. It would be about Orchard Core of course and a little bit about Orchard 1.11. That would be also a very good way to work on a free public online workshop during the Harvest. Orchard Core will be new for most of the people and they could learn the basics of Orchard Core here. Demos Filter content items on content items list page If you navigate to the admin page of Orchard Core and head to the Content Items page, you can search content items by title. You can also filter them by content types and by version. There was an error when you filter content items and hit the back button in your browser. In this case, you got a Confirm Form Resubmission, now it's fixed by using a GET request. Bulk actions in content items list You can also realize a Select All option here to select all the content items in the page. When using the Bulk Actions button, you can publish, unpublish and delete all the selected content items without needing to do these actions one by one. Markdown editor CSS and toolbar improvements This week the community fixed a bunch of styling issues with the SimpleMDE markdown editor. It used to look like with a dark border around the top and some horrible hovers and now it looks like this. It also couldn't go full screen because the z-index was below the Orchard navbar but it now goes fullscreen. Of course, the side by side preview mode works. It does also work on mobile as well. On Lombiq Orchard Dojo Newsletter Now we have 63 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! 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 - 05/17/2019

In our post, we would like to give you some tips about how to write localizable text in Orchard Core. We check the new User liquid filters, the new Twitter integration and many more! On Orchard Core Add various User liquid filters We already had the User object in liquid and now we have the has_permission filter to check for named permission and optionally a resource to check for. We have the is_in_role filter to check if the user is in the role and the has_claim filter to check if the user has a claim of the specified type. Workflows Internalization This PR has three changes related to localization. First of all, the State text in the OrchardCore.Workflows/Views/Workflow/Details.cshtml file was not translated. The second one is more interesting. In the OrchardCore.Workflows/Views/Workflow/Index.cshtml we render the status of the workflow. The status can be Idle, Starting, Resuming, Finished and so on. This is an enumeration. These will be rendered as is in the output, they were not translated. Translating as you can see here could be fine because it's just a static value. The issue is nobody will be able to translate them because we don't know they have to be translated. The solution, in this case, is to use a switch statement. So, enums should be localized using a switch statement that resolves to calls to T[] with the static string inside it. This way our tool will be able to pick it up and add the entry in pot files. The last point for translation is tricky. It's not a dynamic value (a class) and it can't be solved with a switch. The solution here is to add a new property on the activity to return a localized string, like DisplayText. Add create new option to Publish and Save Draft buttons Now we have a Publish button with one suboption called Publish and continue.This PR extends this and adds a new suboption which is Publish and create new. The Save Draft button will also get a new option to Save Draft and create new. Twitter client and update status workflow activity In this PR, Michael Petrinolis extends Twitter Module with a Twitter API client and an Update Twitter Status workflow task. To use the new Twitter integration and the new Update Twitter Status activity, you need to enable the Twitter Integration module. Now you can navigate to the Twitter Integration page in the admin site, where you need to provide four different settings: API key: The API key defined in the Keys and tokens tab of the Twitter app dashboard. API secret key: The API secret defined in the Keys and tokens tab of the Twitter app dashboard. Access Token: The Access Token defined in the Keys and tokens tab of the Twitter app dashboard. Access Token Secret: The Access Token Secret in the Keys and tokens tab of the Twitter app dashboard. To get these settings, you need to create a new Twitter application where you can get these values. Now you can use the new Update Twitter Status Task. Let's say we would like to post a new tweet when a new blog post has been published to our site. We can use the Content Published Event as a startup task and set the Blog Post content type to filter on. After add the Update Twitter Status Task and provide a title and a template for updating Twitter status. Bethany Christian Services using Orchard Core Bethany Christian Services using Orchard Core for their website. Bethany believes every child deserves to be loved, connected and empowered through the family. Bethany is a global nonprofit that supports children and families with world-class social services, all designed to help families thrive. APS Medical Billing Solutions using Orchard Core APS understands that it takes experience to run a successful healthcare business, and they are dedicated to finding solutions that fit your specific practice requirements. The team of qualified medical billing specialists work with each practice to create value through customized service. If you are interested in more websites using Orchard and Orchard Core, don't forget to visit Show Orchard. Show Orchard is a website for showing representative Orchard CMS (and now Orchard Core) websites all around the internet. It was started by Ryan Drew Burnett, but since he doesn't work with Orchard anymore, as announced earlier it is now maintained by our team at Lombiq Technologies. On Lombiq Orchard Dojo Newsletter Now we have 61 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! 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 - 05/10/2019

In our post, we would like to give you a walkthrough about how to use the localization files in Orchard Core. With the localization files, we will see the brand new RTL support and close our post with the new attached media field! On Orchard Core Demos Use localization files To get localization files you can go to the documentation of Orchard Core, where you will find the link called localized. This will navigate you to the Crowdin page of Orchard Core. At the upper right corner of the page, you will find a button to download translations. Download this ZIP file and extract the Localization folder to your App_Data folder. You can see that we have one folder for each language. These will come NuGet packages at some point. If you have a running site you have to restart it, because these files will be found and loaded only on startup. The next thing to do is to enable the Localization module, that provides support for UI localization.After that you should head to Configuration -> Settings -> General and add the supported cultures for the site. Here we added to cultures (Arabic and French) to the list of the supported cultures. If we set the default culture to French and hit Save, you will see the localized Settings page. RTL support Now because in the previous demo we added Arabic to the list of the supported cultures we can see the RTL support. Set Arabic as the default culture and hit Save. Now everything is translated in Arabic and everything is on the right. It automatically picks up the RTL logic from the current culture and all the CSS have custom properties to render differently based or not on RTL flags. In the following screen, you can see the Assets page using the Arabic culture. The Assets.json file has a new property called generateRTL. If you set the value of this property to true, this will process the CSS files to generate a new rule specifically for RTL by inverting all the margins and the paddings and the positions, because it's integrated with the Gulp pipeline. You can see a good example for the RTL support in the media.css file of the OrchardCore.Media module. Attached media field Let's see how to use the new attached media field in Orchard Core! If you set up your site using the Blog recipe, you can add a new field to the existing Article content type. Go to the content definition of the Article content type and add a new Media Field to it. Let's call it Images. Now if you edit the Images Media Field, there should be an option to say I would like to use the attached type of the editor. In the following GIF, you can see how to change the editor type of the media field and add images with the different editor types. The main difference is now instead of browsing an image from the Assets, you can upload your new image from your computer. So in the case of an attached media field, you can't pick a file using the media picker. These pictures are not available in the media manager, they are only stored for this content item and only accessible from this content item. They are stored in the same folder as all the media, but they are not manageable. The content item is the aggregate root of these images. If you navigate to Content -> Assets we don't see the files, just if you have the right permissions for that. On Lombiq Orchard Dojo Newsletter Now we have 59 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! 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 - 05/03/2019

The content localization for Orchard Core reached a huge milestone! Don't hesitate to read our post about the newest awesome features of the CMS! On Orchard Core Apply dynamic content type permissions to Admin Menu The dynamic content type permissions are now implemented. In the past they were not supported in the navigation (you clicked on the menu and got a permission error message), now the admin menu reflects the permissions. You can see an example of this in the following GIF. There is a user who logged in with a contributor role. If the admin adds or removes permissions, the admin menu reflects the changes and hides/shows the options in the New, Content Types and List Admin Node menu. Features bulk actions Now you can enable multiple features at the same time. In the past, we had the checkboxes, but we were not taking them into consideration. If you navigate to Configuration -> Modules and open the select list near the Actions, you can see that now you can enable, disable and toggle the features that you have selected using the checkboxes before them. Use Bootstrap modal instead of browser confirm When you have to confirm an action (like Delete), we're using a Bootstrap modal instead of the native browser popup, so it looks nicer. And of course it's also localizable in the following way: <div id="confirmRemoveModalMetadata" data-title="@T["Delete"]" data-message="@T["Are you sure you want to remove this element?"]" data-ok="@T["Ok"]" data-cancel="@T["Cancel"]"></div> This div has data attributes in it (for example title and message) and we localize the text here that we want to include to JavaScript. From JavaScript, we load the element by ID and get its data which is the localized text. You don't inject localization in JavaScript, you inject it in HTML for encoding and security reasons. Orchard Core Translations repository By using this repository, we will automatically get all the localizations from Crowdin. There will be an AppVeyor script, that will automatically list all the localizations from Crowdin and generate a NuGet package for each of the languages and then push it to NuGet. So, the AppVeyor script will download the files, create a package and publish it to NuGet. This package will contain the AppData with the exact structure, so it will contain the pot files for the language. ASP.NET Core - App Building Workshop There was an app building workshop, where developers created something using ASP.NET Core. The demo is about building a conference agenda website. Sébastien did it also in Orchard Core to be sure you can do the same thing in Orchard. In our documentation, we have a Guides section and there is a tutorial called Building a Website from a Web Template (TBD). With the help of this conference, we could write this section soon. RTL support for TheAdmin theme The latest issue was to merge this PR was to do not manage two different files and then to have some condition in the theme to check the current culture and then switch between the CSS files. The goal is to have only one single CSS file and thanks to Hisham Bin Ateya this PR now merged. Demos Content localization If you would like to make your content items localizable you have to enable the Content Localization module. Then you can head to the Configuration -> Settings -> General page and hit the Add or remove supported cultures for the site link and add supported cultures for the site. Let's add some cultures! Now you have an enabled Content Localization module and added some supported cultures to your site. Time to do some content localization! By enabling the Content Localization module, you can attach a new content part, called Localization to the content type that you would like to localize. Let's edit the Blog Post content definition and add the Localization part to it! When you install your site using the Blog recipe, you have one predefined blog post. If you would like to edit your blog post, you will get the following screen. You will notice that you cannot add a new localized instance of your content item until you do not save the existing one. By saving a content item that exists before, you will create the localized version of the content item, in our case the Hungarian version will be created, because this is the default culture of our site. After saving the content item you will notice that the editor has changed. The list of the cultures this site supports appears with a little plus sign before each culture. By clicking one of the plus signs, a new localized version of the content will create, keeping the content of the item. If you navigate back to Blog, you will see a little badge icon under each blog post showing the culture of the content item. Notice the new Localizations button. By clicking on it, you can create a new localized version of the content item or edit an existing one. Now if you edit the Hungarian version of this blog post, you will see the changed icon before the Qafar. That's because a content item with that culture already exists and by selecting the Qafar version, you can edit the existing content item instead of creating a new one. Thanks to JP Tissot, this feature will be merged to dev soon and with this PR, we will reach a huge milestone towards supporting localization in Orchard Core! On Lombiq Orchard Dojo Newsletter Now we have 59 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! 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 - 04/26/2019

There was no Orchard Podcast this week, but we have lots of news around Orchard Core and new PRs that will be added to Orchard Core soon! On Orchard Core The Arabic translation for Orchard Core is ready A few weeks ago Hisham Bin Ateya and Abdullah Salem have started to work on the Arabic translation for Orchard Core. Thanks to their hard work, the Arabic translation is now ready! This is the second language that has been completed after the French language, which is the main language for many of the core team. Now it's time to test those translations! Order TimeZone list by name When you would like to set the default time zone for your site under Configuration -> Settings -> General you had to select the preferred timezone from a list that wasn't ordered. Now thanks to this PR you can set the value of the time zone using a list that contains ordered values. New user created event and assign user to role task to workflows Soon you can use two brand new activities when constructing your workflows in Orchard Core. The first one called User created, which is surprisingly fired when a user created. The second one is about assigning a role to a user. Let's say we attached this task after the user created event. In this case, when you edit this task, you can say that assign the Authenticated role for the user that has been created just now. In the following workflow, we do the following and show success or failed notification just for demonstration purposes. GitHub authentication Thanks to Michael Petrinolis when this PR will be merge, you can authenticate yourself in Orchard Core using GitHub, by adding this provider to the list of supported external providers soon. Let's see how this feature will work! First, you need to create a new GitHub App. To do that, head to the GitHub Apps page in the Developer settings and hit New GitHub App. Here you need to provide the name of your GitHub app, the full URL to your GitHub App's website and a user authorization callback URL. Don't forget to generate a private key. After you will get a Client ID and a Client secret. You will need them in the next step. Now you can navigate to Orchard Core admin site and enable the Github Authentication feature. After that, you can notice the Github Authentication option under Github in the menubar. Copy your values here and hit save. Now let's open a new incognito window and navigate to the admin page. Here you can see the GitHub, as another service to log in. Provide the username and the password of a GitHub account to sign in. Now Orchard Core asks you to create a new account based on the user information you have just provided in the previous step. If you click on Register your user account will be created in Orchard Core and you will be able to log in using your newly created account. For note, let's see what happens if a user tries to login with an external provider, and registration is enabled: If the external provider provides an email claim, we search for an existing account with that email. If not found, a new OC Account is created based on the username, email, and password provided by the user. If found, we request the password of the OC Account in order to link the external login. There is a PR that takes into consideration the email must confirmed parameter, if we request a password in order to create a local Account from external login, and also uses the ReCaptcha. There is a front page (OrchardCore.Users/Account/ExternalLogins) where you can link/unlink OC account with external providers. Of course, is not complete, we must decide how this is integrated with profile/account info in admin/front end. Regarding the GitHub, you must select to use your email in public and select which one of the verified emails will be included in the claims. External Login registration without password As you noticed in the previous section when you create a new account using an external login provider you have to provide a password to create the user account in Orchard Core. There is a PR to add a setting to register external users without requesting a local password. In this PR, Michael Petrinolis also implements the way to generate a username instead of parsing claims from external login info and to integrate ReCaptcha in External Login Registration. Facebook module OrchardCore.Facebook provides the following features: Core Components Facebook Login First, you need to enable the Users Registrations module and put a tick in the Users can create new accounts on the site checkbox under Configuration -> Settings -> Registration, because we will create a new user account based on the details provided in the Facebook log in page. To register the Facebook App with the site you need to provide the following settings: AppId: Facebook application id. AppSecret: The application secret. Both settings are available in the Facebook for developers application's page, under Basic Settings. Now enable the Facebook Login module and add these values to Orchard Core. The configuration can be set through the Configuration -> Facebook -> Application menu in the admin dashboard. Now you can log in in your site using a Facebook account, where you can get a familiar screen. After that, you can create your new account in Orchard Core that you can use to log in to Orchard. But the PR is not just about authenticating users from Facebook. If you head to the modules, you will find a feature called Facebook Social Plugins Widgets. Let's enable it! Let's say you installed your site using the Blog recipe. In this case, you have a Page content type with a FlowPart attached to it. Create a new Page and hit on the Add Widget button. Here you will see several new widgets that you can attach to your content type that has a FlowPart attached, like Facebook Comments, Facebook Share, Facebook Like and many more. If you publish or preview your page you will see that the widgets are displayed in your page. On Lombiq Orchard Dojo Newsletter Now we have 57 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 - 04/19/2019

In our post we review the happenings after the Beta 3 release, then head to the open pull request of Orchard Core and see what will be merged soon, that will be available for the next release! On Orchard 1.x Style.Include and Script.Include register the wrong resource key in debug mode When you are injecting resources using the Script.Include or the Style.Include methods, you have to pass the debug version for the first parameter, and the release version for the second parameter. Let's see the following code: Script.Include("webfont.js", "head.deferred.min.js").SetAttribute("defer", "").AtHead();Script.Include("jquery-migrate.js", "head.deferred.min.js").SetAttribute("defer", "").AtHead();Script.Include("slick.js", "head.deferred.min.js").SetAttribute("defer", "").AtHead(); We have 3 separated js files that will be bundled when compiling in release, as a single js file but we want to render them as separated js files when developing/debugging. The ResourceManager.Include method registers the webfont.js as head.deferred.min.js causing the other files (jquery-migrate.js and slick.js) not to be rendered because they use the same key of webfont.js. The ResourceManager.cs has a virtual RequireSettings method, where we return the following value: resourcePath = FixPath(resourcePath, relativeFromPath);resourceDebugPath = FixPath(resourceDebugPath, relativeFromPath);return Require(resourceType, ToAppRelativePath(GetResourceKey(resourcePath, resourceDebugPath))).Define(d => d.SetUrl(resourcePath, resourceDebugPath)); Where a new method, called GetResourceKey has been introduced to decide when we need to return the release or the debug path of the requested resource. Now there is an issue in Orchard Core too, to do the same thing when injecting resources in this way. On Orchard Core Docker images If you navigate to the Docker Hub of Orchard Core you can download the updated docker images. Here you can see that the Windows version of Orchard Core has more than 5.0K downloads and the Linux version has more than 10K downloads! Both of the images have the following supported tags: latest: The latest public release 1.0.0-beta3: The latest release of 1.0.0-beta3 dev: The current development branch NuGet packages If you visit https://www.nuget.org/ and search for orchardcore, you will find a new package called OrchardCore. This is a new package, which is only available since Beta 3. You will see there are two packages because we merged on master and later on a new tag for beta 3 has been created to know which commit was Beta 3. And by creating a tag, AppVeyor restarted the build and republished everything on NuGet. We could change AppVeyor script to do not deploy or build on tags, just on commits on master. The YamlDotNet is still a dependency for Orchard Core Beta 3, but we do not use it anymore. In the next version it will be removed, we just kept it for the migrations from Beta 2 to Beta 3, because we convert all the YAML files to JSON and we still need YAML for the conversion. Open Pull Requests When you navigate to Orchard Core's GitHub page and check out the open PRs, you will see that there are currently more than 50 open PRs waiting to be merged to the dev branch. The reason for being as many open PRs is that these branches containing quite huge changes and by merging these into the dev branch could break some features of the framework. By being careful, we thought it would be better to merge these PRs after Beta 3 has been released. Now the Beta 3 is out, so it's time to merge these pull requests to dev branch! Let's see some of these! Add custom Widget styles and classes with Flow After this PR will be merged you can customize the classes and the styles for each widget in the flow. Technically, this PR provides Classes and Styles fields in the FlowMetadata on a Widget for users to add custom classes and styles to the widget container. Features matrix A list of features of Orchard Core, so people don't have to look for the available features and the ones that are currently in development or excepted for an upcoming version of Orchard Core. It could be good if they compare Orchard Core with other CMSs. Add user avatar to the admin site This PR is about to add the avatar to the top right with the name of the currently authenticated user. It could also be interesting to have a Liquid filter to generate a Gravatar. RTL support for TheAdmin theme This PR is using a Gulp pipeline that will convert the admin.css into RTL, by switching all the left margin to right margin and so on. In this week there was an article about how Spotify implemented to support Arabic. They used a similar technique, but not using the same pipeline from the PR, they used PostCSS-RTL in their build step. It's the same process, but with a different library. It looks like this one solves the part of the issue that exists in the PR. It's not replacing the existing CSS, but extending it with more rules that are specific for RTL. It's one CSS which will adopt the look and feel based on RTL or not. It will let us do it automatically for any CSS that we want to instead of manually specify which CSS we want to include. On Lombiq Orchard Dojo Newsletter Now we have 58 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! 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 - 04/12/2019

There was no Orchard Podcast this week, but we have lots of news around Orchard Core and the Orchard Core Beta 3 release! On Orchard Core Updated website for the Orchard Core Beta 3 release The community has been developing Orchard Core for more than 3 years now, but the official website of Orchard hasn't provided much information about Orchard Core. For the Beta 3 release, orchardproject.net got a huge update to focus on Orchard Core instead of the Legacy CMS. However, if you are interested in the 1.x of Orchard, you can still reach the old page by clicking on the Legacy Orchard option from the menu. In the new page, when you click on the Try Orchard button, you will be navigated to https://try.orchardproject.net/, under the Getting started section you can try our Docker images, and the Portfolio is also filled with websites created using Orchard Core. In the Features section you can see we mentioned that you can use Orchard Core as a full, decoupled, or headless CMS and thanks to ASP.NET Core, you get one of the fastest CMS solutions you have ever tried on any OS (Windows, Linux, MacOS). Visit orchardproject.net now! A new website using Orchard Core California School Information Services has a website which runs on Orchard Core! Check out this site to see the loads of capabilities that you can achieve using the CMS. If you are interested in more websites using Orchard and Orchard Core, don't forget to visit Show Orchard. Show Orchard is a website for showing representative Orchard CMS (and now Orchard Core) websites all around the internet. It was started by Ryan Drew Burnett, but since he doesn't work with Orchard anymore, as announced earlier it is now maintained by our team at Lombiq Technologies. Customize Login and Registration pages in Orchard Core CMS A few weeks ago we wrote about Orchard Core now allows theming for Login/Registration/ResetPassword screens. In this post, David Hayden wrote about how to display the login and registration pages using the active site theme. If you have created an Orchard Core CMS site using The Blog theme, you could see what the Login Page looks like now with the setting enabled. We see the consistent header, footer, and copyright of the site theme along with the login form. Normally it's just a login form. Custom Admin Menus in Orchard Core CMS One of the new features in The Blog Theme and its setup recipe is the use of the Admin Menus module to add custom menu items to Orchard Core's Dashboard. In this post, David wrote about how he changed the admin menu using the Admin Menus module. Portfolio Widget - Orchard Core Theme Development In this post, David wrote about which new features of Orchard Core he used to build a new portfolio widget for his themes using the liquid template language instead of Razor, where you can create, modify and override templates in the Orchard Dashboard using the Templates module. Orchard Core Blog Recipe and Running Custom Recipes Orchard Core Themes come with a setup recipe, but an Orchard Core CMS Developer is not limited to setup recipes. There can be custom recipes that are part of the theme or module that are not setup recipes and add functionality on-the-fly. Read David's post about what you can achieve using separate custom recipes that can be run on demand. Create an Orchard Core CMS Website using Orchard Core Code Generation Templates The Orchard Core Code Generation Templates that work with the .NET Core CLI make it really easy to create a website, Orchard Core Module, Orchard Core Theme, and even a modular .NET Core MVC Website. Here is a quick Orchard Core CMS Tutorial that shows you how to create an Orchard Core CMS Website. Modern Business theme Last September we had a demo about how to create a decoupled theme based on the Modern Business one. Thanks to Sijmen Koffeman the theme for Orchard Core is available in this repository. To use this theme in a solution that uses the full Orchard Core source (not NuGet packages), you have to do the following set up, after copying the source to your themes folder: Add this theme as an existing project to your solution. Reference ModernBusiness to OrchardCore.Application.Cms.Targets project. Remove the referenced NuGet packages and add them as a ProjectReference. Now head to the admin site and make this theme as default. When you set up your site using The Blog recipe and open a blog post, you will see your blog post as in this screen: You can also take a look at Start Bootstrap's Modern Business Theme for Orchard Core as a decoupled Razor Pages Module. On Lombiq Orchard Dojo Newsletter Now we have 57 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 - 04/05/2019

Orchard Core Beta 3 is here! Read our post about the latest improvements of the new release and a way about how we could store static media files in the future using Orchard Core! On Orchard Core Orchard Core Beta 3 release We are proudly announcing that the community shipped Orchard Core Beta 3 release! Head to the GitHub page of Orchard Core to download the assets of the new release, where you can also find the list of changes for this release! Fixing DataAnnotations localization Using the PO file string localizer, users can't localize data annotations. When you have a model with some Required or DisplayName attributes, the value of the Error Message will be translated automatically using the StringLocalizer. In Orchard 1.x it never worked, but in Orchard Core, it supposed to work because it's using the correct service for translating which Orchard implements. The IStringLocalizer is created by a StringLocalizerFactory. The question is should a StringLocalizer know about the culture supposed to render or is it when we call _localizer.GetString that we should check what is the current culture? Our assumption was that the localizer should be localize for a specific culture because it had a method called WithCulture to return a new one for another culture. But actually, it's not working in this way. In our case is that we were creating a localizer for the current culture (like English, because it's our default), then we go on a page for Spanish, and it will still reuse the same localizer. Now we do the culture resolution when the GetString is called on the instance. It worked in the case of views, because the views get a new StringLocalizer instance every time they rendered, but not when the attributes are evaluated. It's important because this package is not just for the Orchard Core Framework or the CMS, it's a NuGet package, that anyone can use to localize their ASP.NET applications based on PO files. We support pluralization and dynamic PO files too. How to create Media content items in Orchard Core? In Orchard Core media are not content items, they are just files with a path. The Media Field is just a list of path to a file that is handled by the media storage. Most of the time we don't need a content item for the media. It's faster to store just the path and then to load the content item to store the data and render an image. But we can have Media content items by just create a content type (call it Image, Video or whatever) and attach a Media Field to that. Then you can have content pickers on your other content items to select this kind of media. Localization files guide Last week we wrote about that the new localization guide has been added to Orchard Core documentation. And we have good progress on some translations! As you can see, the Arabic is over 40%, the Chinese more than 80% ready! And we have just added the Orchard Core project to Crowdin! The documentation just has the dev version Now when you visit the ReadTheDocs page of Orchard Core, you will not see the option to read the latest or the dev version of the documentation, only the dev version is available. There can't be any misunderstanding about which branch you are targeting, we always show the latest branch (dev branch), and if we have documentation that only relates to the dev branch, we should make some notes in the documentation to say this won't work with the master. Improve the create button on List Part When you have only one content type attached to a List Part, then instead of having a drop down to select it, there is a button to create the given content type. Storing static Media By using the IFileStore, you can get files, store documents into a file store, etc. The IMediaFileStore implements IFileStore and provides two additional methods: MapPathToPublicUrlKnowing a path for media (like /images/thumbnail.png), this method will return the public URL that we need to render when we render a media. This file store can serve the correct media when it's requested. It's a bridge between an HTTP request to the file that is contained by the store. The default one is using the file system implementation (the folder), so it's just saying whenever you want to access /images/thumbnail.png, it will return /media/images/thumbnail.png. MapPublicUrlToPathThis is the opposite. When we have a public URL, can you guess which image it will present? This is done for a very specific reason. If we have an Azure Blob Storage, we want to render not the local path to the image, but the path to Azure Blob Storage. When we have an image to the media manager, it will store the image for example on Azure Blob Storage and then when we get the path for this media from a content item we need to find what is the public URL of this media in Azure. So the custom implementation for Azure Blob Storage will return http://mystorageaccount.blob.core.windows.net/mycontainer/myblob. The next step would be to remove the whole IMediaFileStore interface. Therefore we don't have to care about where publicly the media is accessible.What about serving the Blob Storage from our web server? When we go in /media/myimage.png, the path will be: "myimage.png". In case of an Azure Blob Storage, the public URL will be http://mystorageaccount.blob.core.windows.net/mycontainer/myimage.png. This is the URL, where the browser finds the image. When /media/myimage.png is requested, Orchard will download the blob (corresponding to that from Azure, and either render it directly on the request or save it as a cache locally) and serve it for the next request without having to ask for Azure. In terms of perf, it won't be slow and it opens other possibilities: 1. Resizing images If we do a resize, we could use the following URL: http://mystorageaccount.blob.core.windows.net/mycontainer/myimage.png?width=123 But this won't work, because if we do something like this, the server of Azure doesn't know about ImageSharp or whatever. This thing can only be done if we server the image by ourself. To be able to resize images, we need to process them, that means we need to load them and serve them not from a public URL. 2. CDNs Content Delivery Networks are local caches of the files we request. Some people use Azure Blob Storage because they want CDNs. But we can use CDNs even for our local images. The idea is to use CDNs even for Blob Storage. We could say that yes, we have Blob Storage, but just for storage, it's not for serving the images. We could also make it completely private, so nobody can access our Azure Blob Storage. It's the Orchard web server that will download the media, serve it in a way (/media/images/thumbnail.png) and if we have a CDN, then the CDN itself is responsible for asking us for the media (which will download from Blog Storage, so it will be slower for the first time), but then every time the users will hit the CDN, then they will get the image from the CDN, not from us. We won't even serve the image. Instead of having an interface, that gives us a public URL, every time we render a media is to have a configuration setting with the public CDN prefix for media files. In this configuration, we would define //myownsite.azurecdn.com. What you would do is configure Azure CDN to be a CDN on your website which is mywebsite.com. And whenever we render a media file, we would prefix the URL with that. The browser will ask the CDN for the resource, which will itself ask our site for the resource and then get the blob storage thing. We serve it, that means it will be resizeable, even with a CDN. If we make a request like //myownsite.azurecdn.com/foo.png?width=123, it will request that on our server, so we can resize everything. That would work with any CDN, like Azure CDN, Akamai, Horizon, CloudFlare, etc. Another option is to add a configuration setting with public CDN for resources. When we define a resource, we can set the debug version and the minified version, and also the CDN version. And we also have a setting to say I want to use a CDN version of my resources instead of the local ones (if they are available). We could also be able to set the CDN prefix for these files too, and then they would be also cached by a full CDN and the site would be much faster. However, we need to purge ImageSharp cache automatically with some thresholds. If we cache media items, need to have a way to purge. That's doable because every time we store a media we can store how much data we already stored like in a file that is also on the file system. There are many ways to do that. There is a website using the Blog recipe under sebastienrosdotcom.azurewebsites.net. It's hosted on the east coast, if we look at the Network tab using Google Chrome Developer Tools, it takes about 150 ms to render the page in Hungary, plus the static files, which are either in CDN or loaded by Orchard Core. Seb enabled the CDN and mapped this website to cdn.sebastienros.com. In the first time, it will be slower, but after if you hit F5, it takes less ms. On Lombiq Orchard Dojo Newsletter Now we have 56 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! 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 - 03/29/2019

Read our post about tons of new documentation for Orchard Core and the way about how to prevent doc changes from running the CIs. In the current post, you could also learn about how to work with PO files in Orchard Core? On Orchard Core New Orchard Core CMS Guide: Adding a Menu Item to the Admin Navigation from a Module Two weeks ago we talked about a new section called Guides has been added to Orchard Core documentation. Till now there was only one getting started guide in the Guides page, where you can read about how to run tasks on application startup from a module. Now it's time to introduce the second getting started guide about how to add a menu item to the admin navigation from a module. By following this guide you will build a module that will add a menu item at the root level and two child menu items. Each menu item will point to its own view. Preventing doc changes from running the CIs When we push a new changeset to Orchard Core's GitHub repository, the CI builds and redeploys new NuGet packages every time. As you can see, in the last few days we have lots of changesets containing only documentation changes. From now if Travis can't find any change that is not in an .md file/mkdocs file or in the docs folder, then ignores the build, because there is nothing to build, only the documentation has been updated. Same thing for AppVeyor, but in a different way. In this case, we say skip everything that is not in an .md file/mkdocs file or in the docs folder. Let's see an example of this behavior in GitHub. This PR is about to fix a minor typo in the HTML escaping section documentation of OrchardCore.Liquid. The sentence "If you need to render some raw HTML chars you can use the `Raw` filter." was wrong, because here you need to use the raw filter instead of Raw. If you click on the View details button near the merge commit, you will see only 2 checks. The AppVeyor one doesn't appear here and Travis just only has one step, that detects there are no changes and it will do nothing. If you check the Job log of this build in Travis, you will see the message: Not running CI since only docs were changed. Now it will be faster if we do just documentation changes. Adding SVG in allowed media types It's common to upload .svg files and now you can upload .svg by default. Defining Menu parts This is to actually describe the parts as available. They were used, but not declared in the system, so you won't see them in the list of available parts. Now it's working and it's also has a description. You can find the new changes in the menu.recipe.json recipe. Add Crowdin badge to Localization page If you visit the Localization page in ReadTheDocs you can see a badge under the Online translations header. If you click on that badge you will be redirected to the Crowdin page of Orchard Core. How to work with PO files in Orchard Core? The Crowdin page contains all the entries for the languages which we had in Orchard 1.x. Now people can start translating Orchard Core! The files are organized by modules to make you easier to find the text that you want to translate. The next thing is to provide a guide about how to download the .po files and work with them, but it's fairly easy: just select a translation, hit the button with a black cloud icon near the Translate all button to download the translations in a ZIP archive. You can put the .po files from the archive in the Localization folder of the App_Data and then you should enable the given language in the dashboard to pick up the files. Oh wait, the documentation about installing localization files are up now? Yes, the third guide is up, so now nothing can stop you to add your first language to Orchard Core! On Lombiq Orchard Dojo Newsletter Now we have 53 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! 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!