[SOLVED] 404 while trying to use routes

Been trying to create 2 content hubs for my site. The idea is to use tags to separate the posts to 2 menus.

I’ve updated the routes.yaml and updated the tags and navigation menu, as well. But when I try to access the site menus nothing works, just shows 404.

routes:
/blog/:
  controller: channel
  filter: tag:[Video Editing, Business, Personal]
/learninpublic/:
  controller: channel
  filter: tag:DevLog


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

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

I believe you need to create a topic index page for the new route, e.g., learninpublic.hbs.

how do i link this .hbs file to my yaml file? or do i have to?

The .hbs files are in the theme, e.g., index.hbs, which is used to generate the home page; that is, template: index. If you want something like this for your “content hubs” you’ll need to do some bespoke coding to filter the posts you need.

However, if you’re simply using a single tag, then you could simply use the relevant tag archive page, and add this to the menu.

1 Like

Ensure you are using the tag slugs rather than their names, you can see the slugs when editing the tag in the Admin area. The Video Editing tag shown suggests you’re using the name as spaces are not valid in slugs or in the type of filter you’re using.

routes:
/blog/:
  controller: channel
  filter: tag:[Video Editing, Business, Personal]
/learninpublic/:
  controller: channel
  filter: tag:DevLog

YAML (the language used for the routes config) uses significant whitespace. You’ll need to add two spaces in front of everything after routes: similar to the spacing shown in the collections: section.

I believe you need to create a topic index page for the new route, e.g., learninpublic.hbs.

That’s not necessary. By default channels will use the index.hbs template.


I suggest fixing the spacing and filters and see how you get on :slightly_smiling_face: With the extra indent and a valid filter you should be able to access your channels successfully.

3 Likes

SOLVED!
I did your suggestion to fix the spacing and used the tag slugs. I am now able to access the channels. Thank you so much!

1 Like