Custom route as base for pages AND posts

Hello again, everybody in this lovely forum!
I have some new questions about Ghost I need some help with.

I love the collections feature and I use it heavily. I use it to run multiple blogs on the same site. Thank you Ghost, for that! :heart:

However, is there a way to have a base url? I recently found out you can add custom routes like this:

routes:
  /en/:
    template: page
    data: page.home

That’s great, but I wonder if it’s possible to have that /en/ route as a base for all my pages and posts in English? I’ve tagged the posts and pages with #en but it only works for posts, not pages.

Today I tested and added this for my about page in Swedish and it worked:

routes:
  /sv/:
    template: page
    data: page.sv
  /sv/om/:
    template: page
    data: page.om

My swedish about page is now found at /sv/om/. However, it feels a bit redundant/weird to add all pages with that base to my custom /sv/ route. Why is that so? It could be a pretty big file with many lines, when a base is all that’s needed, really.

To clarify - when I create a page inside the admin, I’d like to just set the permalink to /en/about/about-me for example, so it could look more like a sub-structured menu, paired with each collection, and then in my routes.yaml file, add the base /en/.

Also I have another question - is it possible to remove the /: route so I can have custom ‘landing pages’ for each language I write in instead? If it works, what do I do with the sitemaps and feeds? I’d like for my English readers to only read my English stuff and vice versa.
This without having multiple Ghost installs - very, very important!!!

I switched to Ghost to let go of the hassle of handling multiple separate blogs, and it’s working better than I thought. This solution, if it works would only be like adding cream with cherries on top :blush:.

As it is now, it’s very mixed and majority of readers are coming from the U.S, even though I write mostly in Swedish.

Thanks in advance!!!

1 Like

With only route setup, it will be hard to create a multilingual blog. You have a lot of things to deal with, not only route. I’ll show you how to create a multi-language blog that I succeeded in transforming that took heavy modifications + route + many tricks. It’s a long-form article with lots of details.

1 Like

Awesome, thanks. I’m already a member of your blog, and it was your setup that got me curious about this. Waiting for the post eagerly then. Thanks!

@cuongtran How goes it with that post? Still waiting eagerly on a solution with this.

I’m writing about it, just make a bit busy with migrate my blog and my clients to new hosting and implement new framework. But I write it as the next one publish.

1 Like

Hi AnnaMariaEriksson,

I had similar problem trying to create what I ended up calling “multi-volume” blog.

Taking from Casper which used the metaphor of a “magazine” that I wanted was a “binder” mechanism that allowed my Ghost Blog to hold multiple magazines.

I found that was I was not able to do this with existing Ghost HandleBars/Casper/Route mechanisms and so ended up creating a new Theme (“Trio” - do google search) which needed new HandleBars Helpers to work.

This ended up being more complicated than I initially wanted and also “breaks” on Ghost update :-( .

I am going to submit some “feature” request to Ghost team to see if they can add some helpers / features which would allow this to be done without need to go so far off the beaten path.

Cheers from Oz,

Zebity

1 Like

Thanks for commenting!
Yeah, it is a bit tricky for us who want to create something more advanced than just a simple blog with a newsletter. I’m pretty satisfied, even though I haven’t gotten everything to work yet. Also Ghost is about to add more translation features as well, and hopefully Ghost 6.0 will contain loads of new and useful features for us!

Also, if you’re not a member of @cuongtran’s blog, please become one, since he writes a lot of tutorials about Ghost.

1 Like