Create hierarchical URL structure (dynamic routing) for Pages

Hey there!
I have been trying various things, looking out for topics at forum, and checked the documentations from past 9 hours with dynamic routing and yet I persist to face an issue with Page URL.

I have successfully created my custom template named as custom-gallery.hbs and the template selection is also visible at post and page in the Ghost editor as Gallery.

Since I am concerned only with creation of pages (not posts), so whenever I select the template as Gallery at the editor, how can I route this template’s slug to
So that, the slug will be based on the Page URL.
All my attention is for creating custom Page URL with dynamic support (not static) like, on entering the Page URL it is automatically set to instead of like this I shall have to deal with hundreds of such under /gallery/ similarly, for so setting it with static data or routing parameters is not feasible approach.
There must be some feature for setting the Page URL which I am unable to figure out, I am sure there would be solution as it is a basic fundamental thing to be available on any CMS.

Theme: Solo
Version: 5.49.0

As of now, I have reverted back to the default routes.yaml configuration.


    permalink: /{slug}/
    template: index

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

The URL used to render a static page is always /:slug/ . This cannot be customised, unlike post permalinks. Page Context: Ghost Themes - Documentation

This means that you’ll want to use posts to achieve /gallery/slug. To do that, you can check out this guide: Building content collections in Ghost

1 Like
  • Are there any other possible ways or controller available for hierarchical URL structure or directory structure for Page?

  • Can data: page.{slug} under dynamic routing configuration be substituted or work as variable for .{slug}?

Is it possible to have expectation for any such updates in future for this scenario directly?
To justify, having page is more convenient for us in certain cases than posts as it has been customized in a different ways.

1 Like

The route for pages can’t be customized. There aren’t any immediate plans to change this behavior.

Can you say why a page is more convenient? Anything possible with a page is also possible with a post.

1 Like

I understand, the reason is all about organizing & managing at GUI, and Pages only does the work as that is intended - simple enough.

But our posts’ template are by default customized with different styling and features such as comments, table of contents, etc. which is not intended for the content or events we put upon page.
I agree, posts is more than capable of doing the work entirely of page but at the end of the day it is also the writers and managers who have to deal with this technical thing which they aren’t intended to.

This small change can help the creators and business on Ghost like us a lot to change and avoid all these patch works by standardizing hierarchical URL structure even for Page URL at dynamic routing configuration - good for the server, team, cost of time, and would allow the appropriate usage of Pages at Ghost by this small implementation.

1 Like

Also, any clues that what are these controllers intended for?
Such as the static one, not all of these were mentioned at the documentations.

1 Like

The workaround is to create these as posts. Use a tag to indicate that they should be on the gallery route (and block display on the front page as needed). You can use your custom page.hbs template as a custom post.hbs template. The only part of your workflow that should need to change is adding that internal tag.

As soon as you want collections of things and custom routing not specified for items one at a time, that’s a case for using posts.

If you just needed a custom /gallery, it could be accomplished by writing a custom page that displayed your pages and a single routes yaml entry, but if you need gallery/slug, that’s a job for posts.


Thanks for the reply.
I understood your whole ideology and method. But once again it’s a patch work, adding more and more of codes and files to the directory. In fact, I had given at an attempt too in the past and after your reply.
Hence, still pages are treated as pages and so does for the posts. If I had to give one more example, when the custom-post_to_page.hbs (based on page.hbs source) template is used to create a post in editor, and after publishing the post (supposedly the page) is routed to right URL format as wanted, but at same time it’s indexed to the native search which is not the intended behavior of our purpose.

Basically, we want have a native page for featuring some of the NGOs for fund raising under a directory based on hierarchical URL structure.
Example:,,, …
This was just a single instance.

Why native Pages does it better?

  • By default, it is simply what we need and expect.
  • Doesn’t features the Page on the native search option at the website, as expected.
  • No extra work needed to remove or add code, since if I use the above custom template technique also, it doesn’t makes to the 100% of the requirement like styling is bit cluttered and it is affected by the default site’s code injection in a negative lead. Also, the post will be listed under at least one author when written over posts even using the custom page template.

Expectations/Possible all in solution forever:

  • Either to make the static page render /:slug/ dynamically at the routing configuration just as it does for posts by {slug} .
    (Small change and good to go since this is already supported by posts, it must be not be a great deal for pages too)

  • Standardize hierarchical URL structure or directory based structure by any another feasible approach such as by allowing to render the files from the self-hosted ghost directory.

This request is a very basic one for any CMS, and all the creators and businesses at Ghost surely have a versatile path to make, and this small push will end this unwanted PATCH WORK.


Can anyone help with writing the dynamic routing code for this case for my pages where I want to the URL to be like and goes on till around

Unfortunately, no, this is not possible in Ghost CMS with the pages. You have to only use posts in order to create such URL format. I know it is a very basic fundamental feature, yet not a priority to introduce or make for such URL customization with pages.

1 Like

@Kevin @RyanF

It is been so long yet I had to just halt my whole project since this feature has been missing.
May I expect some escalations based on this?
I have said and confirmed multiple times that pages can’t replace posts and neither posts can replace the pages, though it seems like a small change but holds equally respectable amount of impact for us.
I understand, both the use cases of these two types where pages are tend to be mostly static but is unable to provide the flexibility in URL customizations to meet the standard commercial needs of any website. If there is still more clarification required based on the reasons and requirement for this feature then I kindly suggest you to look into replies in the thread for which I have spent my time on requesting one single feature for such a long time rather than continuing the development of my project.

Kindly, consider having this one real small change which is a real necessity.


Exactly, and this not only our request or demand multiple such topics and suggestion are laying out there even as question in very many forums.
In fact, I tried once even raising the same on Ghost’s official GitHub repository but it was said that it won’t be accepted until it is escalated by the staff via the forum as an idea for their roadmap. Even I don’t get how long and how many hours I spent in requesting these kinds of things but never fulfilled by Ghost.

To be very simple and specific with an instance, the way collection works dynamically without use of data parameter, if the same gets applied based on pages will reduce a lot of issues and reduce time wastage.

    permalink: /releases/{slug}/
    template: page
    filter: tag:releases

Though the ideology of static page is true only until certain categories. Because, not every time we have a single about page, the subpages is needed to added and updated very many times. But all of these one thing aside, I can guarantee for your faith it's really worth into the you beloved team's roadmap and definitely not a loss for any.

Any possible updates?

:point_up_2: The situation hasn’t changed.


Still hoping that this becomes a reality.

1 Like