--- name: orchardcore-menus description: Skill for creating and managing menus in Orchard Core. Covers menu content types, menu item types, menu widgets, navigation rendering, pager shapes, breadcrumbs, and menu customization via shapes and alternates. Use this skill when requests mention Orchard Core Menus, Create and Manage Navigation Menus, Enabling Menu Features, Menu Item Types, Creating a Menu via Recipe, Multi-Level Navigation Menu, or closely related Orchard Core implementation, setup, extension, or troubleshooting work. Strong matches include work with OrchardCore.Menu, OrchardCore.Widgets, OrchardCore.Layers, OrchardCore.ContentManagement, OrchardCore.Navigation, OrchardCore.Navigation.MenuItem, OrchardCore.Modules, MenuItemsListPart, MenuWidget, LinkMenuItemPart, MenuPart, TitlePart. It also helps with menus examples, Creating a Menu via Recipe, Multi-Level Navigation Menu, Placing a Menu Widget in a Zone, plus the code patterns, admin flows, recipe steps, and referenced examples captured in this skill. license: Apache-2.0 metadata: author: CrestApps Team version: "1.0" --- # Orchard Core Menus - Prompt Templates ## Create and Manage Navigation Menus You are an Orchard Core expert. Generate menu definitions, navigation structures, menu widgets, and pager configurations for Orchard Core. ### Guidelines - Enable `OrchardCore.Menu` to manage menus. Menus are content items with the `Menu` content type. - A menu consists of a `MenuItemsListPart` that holds an ordered tree of menu items. - Built-in menu item types include `LinkMenuItem`, `ContentMenuItem`, and `UrlMenuItem`. - `LinkMenuItem` renders a static link with a display text and URL. - `ContentMenuItem` links to a published content item and derives its text and URL from the item. - `UrlMenuItem` renders a link whose URL is evaluated as a Liquid expression at runtime. - Display menus on the front end by placing a `MenuWidget` in a theme zone via a layer. - Pager shapes (`Pager`, `PagerSlim`, `Pager_Links`) provide pagination for content lists. - All recipe JSON blocks must be wrapped in the root recipe format `{ "steps": [...] }`. - All C# classes in code samples must use the `sealed` modifier. ### Enabling Menu Features ```json { "steps": [ { "name": "Feature", "enable": [ "OrchardCore.Menu", "OrchardCore.Widgets", "OrchardCore.Layers" ], "disable": [] } ] } ``` ### Menu Item Types | Type | Purpose | URL Source | |---|---|---| | `LinkMenuItem` | Static navigation link | Hardcoded URL in `LinkMenuItemPart.Url` | | `ContentMenuItem` | Link derived from a content item | Resolved from the referenced content item's route | | `UrlMenuItem` | Dynamic link with Liquid URL | Liquid expression evaluated at render time | ### Creating a Menu via Recipe ```json { "steps": [ { "name": "Content", "data": [ { "ContentItemId": "main-navigation", "ContentType": "Menu", "DisplayText": "Main Navigation", "Latest": true, "Published": true, "MenuPart": {}, "TitlePart": { "Title": "Main Navigation" }, "MenuItemsListPart": { "MenuItems": [ { "ContentItemId": "menu-item-home", "ContentType": "LinkMenuItem", "DisplayText": "Home", "LinkMenuItemPart": { "Name": "Home", "Url": "~/" } }, { "ContentItemId": "menu-item-about", "ContentType": "LinkMenuItem", "DisplayText": "About", "LinkMenuItemPart": { "Name": "About", "Url": "~/about" } }, { "ContentItemId": "menu-item-blog", "ContentType": "LinkMenuItem", "DisplayText": "Blog", "LinkMenuItemPart": { "Name": "Blog", "Url": "~/blog" } }, { "ContentItemId": "menu-item-contact", "ContentType": "LinkMenuItem", "DisplayText": "Contact", "LinkMenuItemPart": { "Name": "Contact", "Url": "~/contact" } } ] } } ] } ] } ``` ### Multi-Level Navigation Menu Nest menu items inside a parent item's `MenuItemsListPart` to create dropdown or flyout submenus: ```json { "steps": [ { "name": "Content", "data": [ { "ContentItemId": "main-menu", "ContentType": "Menu", "DisplayText": "Main Menu", "Latest": true, "Published": true, "MenuPart": {}, "TitlePart": { "Title": "Main Menu" }, "MenuItemsListPart": { "MenuItems": [ { "ContentItemId": "menu-products", "ContentType": "LinkMenuItem", "DisplayText": "Products", "LinkMenuItemPart": { "Name": "Products", "Url": "~/products" }, "MenuItemsListPart": { "MenuItems": [ { "ContentItemId": "menu-products-software", "ContentType": "LinkMenuItem", "DisplayText": "Software", "LinkMenuItemPart": { "Name": "Software", "Url": "~/products/software" } }, { "ContentItemId": "menu-products-hardware", "ContentType": "LinkMenuItem", "DisplayText": "Hardware", "LinkMenuItemPart": { "Name": "Hardware", "Url": "~/products/hardware" } } ] } }, { "ContentItemId": "menu-services", "ContentType": "LinkMenuItem", "DisplayText": "Services", "LinkMenuItemPart": { "Name": "Services", "Url": "~/services" } } ] } } ] } ] } ``` ### Placing a Menu Widget in a Zone Use a `MenuWidget` assigned to a layer and zone to render a menu on the front end: ```json { "steps": [ { "name": "Content", "data": [ { "ContentItemId": "widget-main-menu", "ContentType": "MenuWidget", "DisplayText": "Main Menu Widget", "Latest": true, "Published": true, "LayerMetadata": { "Layer": "Always", "Zone": "Navigation", "Position": 0 }, "MenuWidget": { "MenuContentItemId": "main-navigation" } } ] } ] } ``` ### UrlMenuItem with Liquid Expression `UrlMenuItem` accepts a Liquid template in its `Url` field. The expression is evaluated at render time, allowing dynamic URLs based on request context: ```json { "ContentItemId": "menu-item-profile", "ContentType": "UrlMenuItem", "DisplayText": "My Profile", "UrlMenuItemPart": { "Name": "My Profile", "Url": "{{ '~/profile/' | append: User.Identity.Name }}" } } ``` ### ContentMenuItem Linking to a Content Item `ContentMenuItem` generates its URL and display text from a referenced content item: ```json { "ContentItemId": "menu-item-featured", "ContentType": "ContentMenuItem", "DisplayText": "Featured Article", "ContentMenuItemPart": { "ContentItem": { "ContentItemId": "article-featured-2025" } } } ``` ### Menu Shapes and Alternates Orchard Core renders menus through a shape hierarchy. Override these shapes to customize rendering: | Shape | Purpose | |---|---| | `Menu` | The root shape wrapping the entire menu as a `