On this page
A header menu with nine links is hard to scan, and on a phone it pushes your content down. A dropdown fixes that: “Topics” opens a short list of your sections, “About” holds the team and contact pages, and the header keeps four or five items.
Ghost doesn’t have dropdowns of its own. Its navigation is a flat list: each item is a label and a link, in a Primary and a Secondary menu. Dropdowns come from the theme, usually through a naming convention in that flat list. This tutorial shows how to use one, and how to add one yourself when your theme has none.
What you need
- A login to Ghost Admin as the Owner or an Administrator.
- Your theme’s documentation, to see whether it supports dropdowns and how.
- For a theme without dropdowns: access to Settings › Advanced › Code injection, or a copy of the theme you can edit and upload.
1. Check how your theme does dropdowns
Look in your theme’s docs for “dropdown”, “submenu” or “navigation”. Themes that support dropdowns pick one way to mark an item as a child of the one above it. The most common is a sign at the start of the label: a child item called -Membership sits under the item before it, and the theme shows it without the sign.
Some themes use another sign, or build the dropdown from the secondary navigation. Follow your theme’s convention exactly: an item the theme doesn’t recognize shows up as a normal link, sign included.
If your theme has no dropdowns, plan the menu with the steps below anyway, then add the code in step 5.
2. Plan the menu
Write the menu down before you change it:
- The parents: the items in the header, such as “Topics”, “Members” and “About”. Keep them few and short.
- The children: the links under each parent. Three to seven per dropdown is easy to read.
- Where a parent points: every Ghost navigation item needs a URL. Point the parent at a page that lists its children, such as a page that lists your tags, so it still works when someone opens it directly. (If the children are all tags, a tag dropdown may suit you better.) If there is no such page, many themes accept
#as the URL; check your theme’s docs.
Each child is an ordinary Ghost link: a page (/about/), a tag archive (/tag/news/), an author (/author/jane/), or any full URL.
3. Add the items in Ghost Admin
- Open Settings › Site › Navigation and choose Customize.
- Choose the Primary tab. Dropdowns usually belong in the header, which shows the primary menu.
- Add the parent: enter its label and URL, and add the item.
- Right after it, add each child, with the theme’s sign at the start of the label, for example
-Membership,-Sign upand-Sign inunder “Members”. - Drag items to put each child directly under its parent. The order of the list is the order of the menu: a child always belongs to the closest parent above it.
- Choose Save.
The navigation in Ghost Admin stays a flat list; the theme turns it into dropdowns on the site.
4. Check the menu on your site
Open your site in a new tab and test the menu the way readers will:
- With a mouse: the dropdown opens when you move over the parent, and stays open while you move into it.
- With a keyboard: press Tab through the header. Each child link should be reachable, and visible when it has focus.
- On a phone: open the mobile menu. Themes often show the children indented under their parent there, instead of a dropdown.
If an item still shows its sign, it isn’t directly under a parent, or the theme uses another convention.
5. Add dropdowns to a theme that has none
When your theme doesn’t support dropdowns, a small script and a few lines of CSS can add them, using the same - convention. Both go in code injection, so they survive theme updates.
The script assumes the menu is a list of links, as in Ghost’s default navigation template (<ul class="nav"> with one <li> per item). Many themes keep that markup; if yours doesn’t, change .nav to your menu’s class. To find it, inspect the menu in your browser: in most browsers, open the context menu on a menu item and choose Inspect.
Open Settings › Advanced › Code injection, choose Open, and add this in Site footer:
<script>
// Items whose label starts with "-" become a dropdown under the item above them.
document.querySelectorAll('.nav').forEach((menu) => {
let parent = null;
[...menu.children].forEach((item) => {
const link = item.querySelector('a');
if (!link) return;
const label = link.textContent.trim();
if (label.startsWith('-') && parent) {
link.textContent = label.slice(1).trim();
let sub = parent.querySelector(':scope > .nav-dropdown');
if (!sub) {
sub = document.createElement('ul');
sub.className = 'nav-dropdown';
parent.classList.add('has-dropdown');
parent.append(sub);
}
sub.append(item);
} else {
parent = item;
}
});
});
</script>Then add the styles in Site header, and choose Save:
<style>
.nav .has-dropdown { position: relative; }
.nav-dropdown {
display: none;
position: absolute;
top: 100%;
left: 0;
z-index: 100;
min-width: 12rem;
margin: 0;
padding: 0.5rem 0;
list-style: none;
background: #fff;
border: 1px solid rgba(0, 0, 0, 0.12);
border-radius: 6px;
}
.nav-dropdown a { display: block; padding: 0.375rem 1rem; }
.has-dropdown:hover > .nav-dropdown,
.has-dropdown:focus-within > .nav-dropdown { display: block; }
</style>:focus-within opens the dropdown when a link inside it has keyboard focus, so it works without a mouse. Adjust the colors and spacing to your theme. If your theme’s mobile menu looks wrong afterwards, limit the dropdown styles to wide screens with a media query, such as @media (min-width: 768px).
For full control over the markup, override the navigation template in the theme instead: see How to customize the navigation template in Ghost.
Most of our themes have dropdowns built in with the - convention; their docs show it under Dropdown menus (for example in the Maali docs).
The result
Your header shows a few clear parents, each opening a short list of links, and readers reach every page with a mouse, a keyboard or a finger. To change the menu later, edit the list in Settings › Site › Navigation: the dropdowns follow.