Routes.yaml has no effect on latest posts collection "\:"

Can you help me with a question on routes.yaml.

I have a long post that I’ve broken up into smaller posts,
Post_1, mytag
Post_2, mytag

I would like my home page (showing the latest posts by default) to NOT show these smaller posts.

I would like my user to see a separate post
Topic_Intro
with no tags.

So I’d like to have only
Topic_Intro
show in latest posts.

From Topic_Intro the user can see the collection of tagged posts.

This is the routes.yaml file I’m using. But it has no effect in Ghost.

routes:

collections:
  /:
    permalink: /{slug}/
    template: index
    filter: tag:-mytag


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

I’m using ghost cli so once I’ve change the routes.yaml file, I

ghost stop
ghost start

But I don’t see any changes to my latest posts which continues to show all posts in reverse chronological order.

Thanks for any help you can give.

Which theme? Some (source) don’t entirely respect routes settings.

What directory are you putting routes.yaml into? I suggest uploading it via settings>labs and letting ghost handle it (no restart required).

Theme:
Source (v1.4.1) theme (default Ghost theme)

Folder for routes.yaml:

project_folder/content/settings/routes.yaml

I’ve fully stopped the Ghost instance using the ghost cli command

ghost stop

And then I’ve run

ghost start

And the routes.yaml file appears to have been ignored.

I’ve also tried the labs method.

Thanks for any advice you can give :folded_hands:

Yep, that’s a Source problem. Source doesn’t respect routing on the homepage. More here: Unexpected behavior with routes - #6 by Cathy_Sarisky

@Cathy_Sarisky You’re absolutely right.

I updated Ghost itself to [5.115.1]

And I tried the Headline and Ruby themes for example and the routes.yaml file works as I expected it to.

Thanks so much for letting me know that Source is the problem.

I might’ve been stuck for ages trying to figure that out for myself!

It seems strange that Source should be buggy when it is the default theme for Ghost!

Thanks again :folded_hands: :folded_hands: :folded_hands:

Quick related question: I’m a newbie to Ghost but can do some coding.

Can you recommend a magazine/news theme that works properly.

Or is it better that I start off with a simple no-frills theme and gradually customise it? If so what would you recommend?

Thanks again!

Source is great if you like how it works, you’ll just have to update some get requests.

Lots of good paid options in the theme directory, too

Thanks again for your insights, @Cathy_Sarisky!!

1 Like