惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News: Ask HN
Hacker News: Ask HN
WordPress大学
WordPress大学
H
Help Net Security
小众软件
小众软件
N
Netflix TechBlog - Medium
C
Check Point Blog
量子位
Last Week in AI
Last Week in AI
GbyAI
GbyAI
Martin Fowler
Martin Fowler
M
MIT News - Artificial intelligence
博客园 - 聂微东
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
J
Java Code Geeks
D
DataBreaches.Net
Project Zero
Project Zero
P
Proofpoint News Feed
T
Threat Research - Cisco Blogs
Security Latest
Security Latest
Cisco Talos Blog
Cisco Talos Blog
Recorded Future
Recorded Future
I
Intezer
L
Lohrmann on Cybersecurity
Cyberwarzone
Cyberwarzone
博客园_首页
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog
P
Palo Alto Networks Blog
V
V2EX
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
The Exploit Database - CXSecurity.com
The Hacker News
The Hacker News
Blog — PlanetScale
Blog — PlanetScale
G
GRAHAM CLULEY
T
The Blog of Author Tim Ferriss
C
Cisco Blogs
The Register - Security
The Register - Security
L
LINUX DO - 热门话题
P
Privacy & Cybersecurity Law Blog
Scott Helme
Scott Helme
F
Full Disclosure
博客园 - 司徒正美
Recent Announcements
Recent Announcements
IT之家
IT之家
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Attack and Defense Labs
Attack and Defense Labs
Cloudbric
Cloudbric
Help Net Security
Help Net Security
The Last Watchdog
The Last Watchdog

Example blog

Ghost redirects explained with practical redirects.yaml examples How to Serve JSON or XML Data in Ghost How to Change Your Default Post Template in Ghost Ghost Custom Theme Settings How to add Google Fonts to Ghost Themes How to Configure Ghost with Mailgun Ghost Theme Structure & Organization How to Make Custom Templates in Ghost Themes How to Install Ghost CMS via Ghost-CLI How to Add Syntax Highlighting to Ghost The best Ghost CMS hosting platforms Ghost 6.0 — Social Web and Native Ghost Analytics Ghost CMS Social web beta, email 2FA and more author social links How to keep custom design settings when updating your Ghost theme How to use the public preview card in Ghost How to add members-specific sections in Ghost How to customize the default content CTA in Ghost How to build a custom homepage in Ghost An overview of Ghost editor cards and and how they work Ghost CMS News: One-time payments & collecting sales tax How to customize the private site access template in Ghost How to add custom fonts in Ghost themes Ghost CMS News: Additional payment methods & internal linking How to use Code Injection in Ghost How to set meta data of your custom routes & collections in Ghost Ghost CMS News: TK reminders, ActivityPub and improvements How to format dates and use the date helper in Ghost Ghost CMS internationalization, custom fonts & spam protection Understanding and optimizing post and page settings in Ghost CMS Trigger the Ghost Portal popup based on page scroll progress How to Deploy Your Ghost Theme with GitHub Actions How to create a custom recommendations page for your Ghost CMS theme Ghost CMS News: New editor, refreshed settings & recommendations Ghost CMS News: Source - the new default theme and native image editing How to Add Different Logos for Dark & Light Themes in Ghost Upgrade to Node v18 for Ghost CMS & common errors Ghost Snippets: Adding Schema markup in Ghost How to add a scroll-based progress bar to your Ghost CMS site How to Create a Custom Navigation Template in Ghost How to Segment Subscribers with Member Labels in Ghost The best way to create a contact page in Ghost How to Use the Ghost Subscription Forms in Your Theme & Posts How to update your Ghost site URL when self-hosting Ghost CMS News: Signup cards and better landing pages How to Add Breadcrumbs to Your Ghost Theme How to integrate the Applause Button into your Ghost theme How to Hide a Post From the Home Page in Ghost CMS Ghost CMS block and contentFor helper overview & tips How to add Image Lightbox to Ghost Themes Ghost CMS News: Signup form embed, new editor and bulk actions. Biron Themes becomes Bright Themes 🎉 How to Audit & Test a Ghost Theme How to Create Related Posts Section in Ghost How to Use Ghost Filter Expressions Ghost CMS newsletter settings and post analytics How to Update Your Ghost Theme When We Release New Versions Ghost CMS News: Automatic list cleaning & email troubleshooting How to Create a Featured Post Slider in Ghost How to Add Reading Time to Ghost Blog Posts How to Create a Post Archive for Your Ghost Theme Ghost CMS Price Helper Overview & Tips Self-Hosted Ghost CMS with DigitalOcean Ghost CMS News: Member Growth Sources & Audience Feedback How to Open External Links in a New Tab in Ghost How to Integrate Google Analytics with Ghost Ghost CMS News: History Log & Newsletter Analytics How to Automatically Add Member Labels From Referral Traffic in Ghost? Ghost CMS News: Free trials & email notifications Ghost CMS Match Helper Usage & Tips Ghost CMS News: Native Comments Ghost CMS News: Ghost Explore & Premium Newsletter Previews Ghost Snippets: Custom Progress Cards & Steps Ghost CMS News: Native Search The Best Ghost CMS Search Plugins & Libraries Ghost Snippets: Custom Stylish Tables How to Add a Scroll Top & Progress Indicator Button in Ghost Ghost Snippets: Accordions How to Add Tag Dropdown to Your Ghost Theme Ghost 5.0 released 🎉 Ghost Snippets: Custom Subscribe Forms Ghost Snippets: Custom Alert Boxes How to Show Post or Newsletter Issue Number in Ghost How to Self-Host Google Fonts in Ghost CMS Ghost CMS News: Membership, Tiers & Activity Feed Custom Pages in Ghost CMS Themes Ghost CMS Search Using Fuse.js Ghost CMS News: Offers and Discounts & New Cards Ghost CMS News: Membership tiers, email CTA & filters Ghost CMS News: Grammarly Support & Feature Image Captions. Ghost CMS News: Improved Member Accounts & Personalized Newsletter. Ghost 4.0 Launched With Native Newsletters & Membership Ghost CMS News: Cancellation Feedback & Newsletter Stats. Ghost CMS News: Improved Member Dashboard & Sidebar Views. Ghost CMS News: Google Pay support, email newsletters & secondary navigation Ghost CMS News: Member Support, Portal & Content Snippets. Ghost CMS News: Referral Programs & Responsive Images. Ghost Themes as Progressive Web Apps Ghost 3.0 is here with brand new features Ghost 2.0 is here with new features How to Add Search to Ghost Using ghostHunter
Ghost routing explained with routes.yaml examples — routes, collections & taxonomies
Bright Themes · 2026-03-31 · via Example blog

In short: Ghost’s routes.yaml defines how URLs map to templates and how posts are grouped (collections, taxonomies, channels). You edit it by downloading and uploading the file from Settings » Labs in Ghost Admin—routing is not applied just by adding a file to your theme zip. Changing routes.yaml is how you reshape permalinks, use a custom homepage, split content into sections, and expose filtered archives.

Ghost began as a blogging platform and, over time, as its APIs and routing matured, it grew into a full-fledged CMS.

One of the main features that makes Ghost a powerful publishing platform and CMS is Dynamic Routing. Routing is the system that maps URL patterns to data and templates within Ghost, which you can use to build custom site structures. Your active routing is defined in routes.yaml: that file is where you configure URLs, collections, and related behavior. Ghost ships a starting configuration you can download from Admin, edit, and upload again (see below). For the latest properties and edge cases, see Ghost’s official routing documentation.

## routes.yaml

routes:

collections:
  /:
    permalink: /{slug}/
    template: index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

In Ghost Admin, open Settings » Labs. Use Download current routes.yaml to save the file, edit it locally, then upload your changes with Upload routes YAML. Routing applied this way is managed in Labs—not by dropping a file into your theme zip alone.

If you want a simple landing page and posts under /blog/, change the URL structure, or split posts into different content collections, dynamic routing is what you need.

Quick checklist

  1. Download the current routes.yaml from Settings » Labs.
  2. Edit the YAML (indentation matters—use spaces, not tabs).
  3. Upload the file and confirm URLs in the browser.

Common pitfalls

  • YAML indentation — Use spaces only; tab characters often make the file invalid or silently mis-nested.
  • Collection filters — Overlapping filters (the same post matching more than one collection) can cause confusing pagination and duplicates. Keep filters as distinct as practical (see the warning under Collections).
  • Posts “missing” from a collection — Check the filter: e.g. primary_tag:blog only includes posts whose primary tag is blog. A tag used only as a secondary tag will not match. Typos in tag slugs also break filters.
  • Trailing slashes — Ghost expects URLs with trailing slashes in many setups; inconsistent links can look like “wrong” or duplicate URLs. Align links and redirects with your live permalink style.
  • Upload didn’t “take” — If Admin rejects the file, fix YAML errors and re-upload. If it accepted but the site looks unchanged, hard-refresh or bypass cache; frontline caches can briefly serve old HTML.
  • Template names — The name in routes.yaml must match a template in your active theme (e.g. aboutabout.hbs). A typo yields missing-template errors or the wrong layout.

Routes

A route matches a specific URL to a template. Routes are useful when you want a static page outside of Ghost Admin—for example when the page should not be editable there, it relies on a lot of custom code, or you need a URL that is more than a basic slug.

For example, if you want a page called About with custom HTML and a more advanced layout, you can add your code in a new file about.hbs and then point a route to it:

routes:
  /about/: about

The first part is the URL: yoursite.com/about/ — the second part is the template that will be used, in this case about.hbs. The extension is not needed; Ghost adds it.

We defined a static page, but you might want some control from Admin. For that, use the data property. Change the route like this:

routes:
  /about/:
    template: about
    data: page.about

This assigns all data from the Ghost page with slug about to the route. Page fields are available inside the {{#page}} block helper in about.hbs. You get the feature image, title, content, and other fields, and Ghost can use that page’s meta settings for this URL too.

Besides generating a single page, you can output other responses—for example, a list of filtered posts with custom formatting. Routes usually render HTML, but you can override that with a content_type and a custom MIME type (text/xml, application/json, and so on).

Collections

Collections are groups of posts that match a filter, each with its own permalinks and an index URL listing matching posts. They are how posts are organized on a Ghost site.

By default, one collection holds all posts; you can define more for different topics or content types.

Collections can use these properties:

  • permalink — custom URL structure for posts in the collection
  • template — template used for the collection index
  • filter — which posts belong here (e.g. by primary tag); see Ghost filter expressions for syntax

Example routes.yaml with a custom home page and two collections:

routes:
  /: home

collections:
  /blog/:
    permalink: /blog/{slug}/
    template: blog
    filter: primary_tag:blog
  /portfolio/:
    permalink: /portfolio/{slug}/
    template: portfolio
    filter: primary_tag:portfolio

Here the home page is rendered from home.hbs, and two collections are configured.

The /blog/ collection:

  • appears at yoursite.com/blog/, rendered by blog.hbs
  • includes posts whose primary_tag is blog
  • post URLs look like yoursite.com/blog/{post-name}/

The /portfolio/ collection:

  • appears at yoursite.com/portfolio/, rendered by portfolio.hbs
  • includes posts whose primary_tag is portfolio
  • post URLs look like yoursite.com/portfolio/{post-name}/

Warning

Keep collection filters distinct from each other where possible, to avoid odd rendering and pagination.

Collections vs channels: A collection sets where a post “lives” in the URL scheme (permalink + index). A channel is a filtered, paginated archive at a path; it does not move posts to a different permalink. The next section covers channels.

Taxonomies

Taxonomies group posts by author or tag. Ghost generates archives for tags and authors automatically.

Note: The same post can appear in multiple taxonomies.

Default taxonomy URLs:

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

You cannot add brand-new taxonomy types today, but you can change the URL prefixes for tag and author:

taxonomies:
  tag: /category/{slug}/
  author: /writer/{slug}/

Channels

A channel provides paginated content for posts matching a filter—a way to surface subsets of your archive.

Channels use the controller property set to channel. They do not change a post’s canonical URL; a post can appear in any number of channels.

The controller property currently accepts only channel. Example:

routes:
  /news/:
    controller: channel
    template: news
    filter: tag:[news]

This channel lists posts tagged news, rendered with news.hbs, at yoursite.com/news/.

If you change permalink patterns or move content between collections, add 301 redirects in redirects.yaml so old links keep working. See our Ghost redirects guide and Ghost’s implementing redirects tutorial.

This overview covers the core pieces of Ghost’s routing system. The same building blocks appear in walkthroughs such as building a custom homepage (moving the post index to /blog/ and using a page at /), routes metadata and SEO for titles and meta on routed URLs, custom pages for one-off templates, and changing your site URL when you change domains.