Navigation & Menus
The top navigation bar is one of the first things your visitors see. ModernDuang gives you full control over what appears in the nav bar, how it looks, and whether links open in new tabs.
Basic Configuration
All navigation is configured through the menu key in your theme config file (_config.modernduang.yml):
Each key is the display name shown in the nav bar, and each value is the URL the link points to.
Simple Menu Items
A simple menu item is a key-value pair. ModernDuang automatically assigns a built-in SVG icon when the key matches one of the recognized Chinese names:
Built-in Icon Names
The following Chinese menu names are pre-mapped to SVG icons:
If your menu name does not match one of the above, no icon is shown by default. Use the extended menu item format to supply a custom icon.
Extended Menu Items
For finer control — custom icons, external links, or submenus — use the extended object format:
Tip: The
iconvalue must be a raw inline SVG string, not a file path. Copy the SVG markup directly, including the<svg>tag.
Dropdown Submenus
Any extended menu item can have a children object to create a dropdown submenu. Each child follows the same format as top-level menu items (simple or extended):
When a user hovers over "项目", a dropdown appears showing "主题商店" and "GitHub" as sub-items. The parent item can optionally have its own icon. The parent itself is not clickable — it only serves as a dropdown trigger.
Behavior
- Desktop: Dropdowns open on hover and close when the mouse leaves.
- Mobile: Dropdowns toggle on tap. The parent shows a small arrow indicator to distinguish it from regular links.
External Links
Set external: true on any extended menu item to make it open in a new tab:
External links also display a small open-in-new-tab indicator icon (a diagonal arrow) after the label, so visitors know they will leave your site.
Mobile Menu Behavior
On screens narrower than 768px, the navigation bar collapses into a hamburger menu. The mobile drawer:
- Slides in from the right with a smooth animation
- Shows all menu items vertically, including dropdowns which can be expanded by tapping
- Displays a semi-transparent overlay behind the drawer that dismisses the menu on tap
- Triggers
externallinks to open in a new tab just like on desktop
There is no separate mobile configuration — the menu adapts automatically.
Complete Example
Here is a realistic nav bar configuration with a mix of all item types:
Related Pages
- Profile Card — Social icons on the homepage profile card
- Footer & ICP Beian — Social icons and links in the footer
- Social Icons — Full list of built-in social icon names
