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

Add Recipe Roles permission behavior, how to add media management to an ASP.NET Core app? - This week in Orchard (24/01/2025)

This week's topics are migrating the OpenID module to OpenIddict 6, adding Recipe Roles permission behavior, and we will mention our latest Orchard Nuggets post, where you can learn how to add media management to an ASP.NET Core app. Without further ado, let's dive in!

Featured tags

IIS
API
SMS
SEO
All tags >

Add Recipe Roles permission behavior, how to add media management to an ASP.NET Core app? - This week in Orchard (24/01/2025)

This week's topics are migrating the OpenID module to OpenIddict 6, adding Recipe Roles permission behavior, and we will mention our latest Orchard Nuggets post, where you can learn how to add media management to an ASP.NET Core app. Without further ado, let's dive in!

OpenAI feature including Azure OpenAI integration, Orchard Harvest 2025 survey - This week in Orchard (17/01/2025)

This time, you can see a fascinating demo of the OpenAI feature, including Azure OpenAI integration! But first, let's check out our other topics, like removing ReCaptchaMode and DetectionThreshold, introducing the new ReCaptcha shape, and exposing properties of ITrackingConsentFeature and cookie policy in Liquid! Oh, and did we mention that we have just created a survey for Orchard Harvest 2025?

How to add media management to an ASP.NET Core app? - Orchard Core Nuggets

Using media files, such as images, videos, and documents (like PDF files), is a common requirement for a modern website. Media can enhance user experience by making content more engaging, visually appealing, and/or easier to understand. Fortunately, Orchard Core has a built-in solution: the Orchard Core Media feature. As the description says in the official documentation:The Media module provides a UI to upload and organize binary files that can be used while creating content.Are you new to Orchard Core? It's a great open-source framework, and CMS built on ASP.NET Core. Check out the official getting started docs.Let's see Orchard Dojo and its blog for a real-life example of why you would use the media feature. At Orchard Dojo, we mainly use images for two things:Image of trainers: As you can see on the About page.Images for blog posts: For example, in this blog post.We have flexibility, and we can organize the media files using the media feature.Flexibility: Let's say a trainer got a new haircut and wants to update their image. Then, we can overwrite the old image with the same name in the media library, and that's it.Organization: We can have a “Trainers” media folder with the trainers' images, a “Blog Posts” folder with the images for blog posts broken down to years, and a folder for each individual blog post's images.Now, to turn on the feature, go to Configuration → Features and make sure the Media feature is enabled. You can additionally enable these media features: Media Cache: The feature caches remote media files locally, improving performance and reducing bandwidth usage for sites using external storage like Azure Blob or S3. For example, an online store with product images hosted on cloud storage can deliver images faster to users.Media Slugify: The feature ensures SEO-friendly URLs by automatically renaming new media folders and files to use slugs (e.g., “The team (2020).jpg” becomes “the-team-2020.jpg”). This is useful for improving search visibility, such as when uploading product images for an e-commerce site. The URLs are also just nicer.Secure Media: This feature allows administrators to control access to media folders based on user roles, ensuring only authorized users can view or manage specific files. For example, a company could restrict marketing files to the marketing team while allowing all staff to access shared resources, enhancing security and organization. If you are new to Orchard Core, you can check out user management (including adding permissions to roles) in one of our Dojo Course videos (to learn more about Dojo Course, click here).After enabling the Media feature, go to the Content menu, and you will see the Media Library menu item. Inside the Media Library, you will see one already existing folder named “_Users”. You can read about this here in detail. But in a nutshell, Orchard Core's Media Library includes a “_Users” folder with subfolders for each user, allowing them to manage their own media. New permissions like Manage All Media Folders and Manage Own Media let admins control access while restricting editors to their folders.A few buttons are not self-explanatory in the media library; we will go through them. With the plus button, you can add new folders to the media library. Just click on the folder and type its name. If you click on an existing folder, follow the same process; the new folder will be created as a subfolder of the current one.The invert button inverts the selection, so if you have image-1.jpg, image-2.jpg, and image-3.jpg, and you selected images 1 and 2, if you click on it, images 1 and 2 will be unselected, and 3 will be selected.With these buttons, you can change between list and grid view: This is the button for uploading files. You can select them from your computer, but you can also just drag them into the empty space in your folder in the media library.The delete button is also available, which is mainly for mass deleting files. If you want to do something with only one file, you can click on it, and three options will appear: rename, delete, and download. You can also filter by file name, that option is left to the upload button (4).Turning on different media features will also add new menu items to the Media menu under the Configuration menu. Media Cache: This menu item appears only if you turn on the Media Cache feature, which we discussed earlier. It contains options related to that feature, such as purging all the assets from the cache.Media Options: Here, you can see the configured media options. One option, for example, is Allowed file extensions, which tell you files with which extensions may be uploaded. You can configure these options from the appsettings.json file or other ASP.NET Core configuration providers. You can read more about it here. For example, if you want to allow only image uploads, you can specify extensions like .jpg, .png, or .gif. This ensures users can upload only images, preventing unauthorized file types like .exe or .zip.Media Profiles: In this menu item, you can define custom image transformations, such as resizing or cropping, to ensure consistent formatting across your site. For example, you can create a thumbnail profile that automatically resizes all product images to 200x200 pixels for a uniform storefront display.When you turn on the Media feature, you will also have a new content field, the media field. Returning to our example, we have trainers on the About page on Orchard Dojo. We already have a widget dedicated to trainers. A media field called image was added to the content type. You can see the media field's settings here: For example, when using the “Multiple” option, we can display multiple images in one media field. With the media field added, when we are creating a Trainer Widget, we can select an image: The plus button opens the media library, where you can select your image. After selecting the image, you will get a small preview of it: But let's see the blog post example. In our Blog Post content type, we have an HTML body (with the Trumbowyg editor). This supports adding an image with the image shortcode. Clicking on the “Insert Media” button, you can select the file from the media library. The result will be something like this: [], and the image will appear in the blog post after publishing it.In this blog post, we’ve seen Orchard Dojo's media library and how we use it, but let's look at another example: You have an e-commerce page where you sell tech products. With the Media feature, you can create product content items with media fields to display images of the products (even multiple with one media field). Let's say on the same site, you are also reviewing tech products in a blog-like format. When you are writing a review, you can use the image shortcode in the HTML body to display your photos of the product.To conclude, Orchard Core’s Media feature makes it easy and effective to manage media files across your site. With features like customizable media profiles, caching, and role-based access, it helps keep your media organized.Did you like this post? It's part of our Orchard Core Nuggets series where we answer common Orchard questions, be it about user-facing features or developer-level issues. Check out the other posts for more such bite-sized Orchard Core tips and let us know if you have another question!

Extension method for easier ResourceManagementOptions registration, Testing time-dependent functionalities with a time shifting clock using the Lombiq UI Testing Toolbox - This week in Orchard (03/01/2025)

In our first post of this year, we will examine a new extension method for easier ResourceManagementOptions registration, test time-dependent functionalities with a time-shifting clock using the Lombiq UI Testing Toolbox, and more! Without further ado, let's dive in!

Reorganize the Admin Menu, Add PollingTime & MinimumIdleTime to BackgroundServiceOptions - This week in Orchard (13/12/2024)

This week's topics are adding PollingTime and MinimumIdleTime to BackgroundServiceOptions and showing the Remove Field/Part button when it is system-defined. The community is reorganizing the Admin Menu, and we need your valuable feedback to build the best admin menu for Orchard Core!

Auto Attach the DashboardPart to content types with DashboardWidget stereotype, how to add import/export to an ASP.NET Core app - This week in Orchard (29/11/2024)

This week's topics include auto-attaching the DashboardPart to content types with the DashboardWidget stereotype and supporting randomly ordering results in SQL queries. Don't forget to check out our newest Orchard Nuggets post about adding import/export to an ASP.NET Core app! Let's see the details!