Understanding routes

Hey there, I’m using a theme that comes with a home template and documentation (docs).

I’m trying to add a new page using the home template, titled PageName insted Site (Page 1). It’s not behaving as expected, so I checked some posts and found this How to use functional helpers to select index, with custom routing? - #2 by DavidDarnes I’m a bit unsure about making changes because I’m concerned that editing the page title might affect the pagination title as well. Could you please guide me on how to do this right?

I want it to be PageName instead of Site (Page 1)

Now, onto the docs issue.

I attempted to create another collection called “faqs” using the docs template. The main docs are at mysite.com/docs (collection page), and I want each page to open like mysite.com/test-doc. But for FAQs, it should be mysite.com/faqs, and each page should follow the mysite.com/faqs/test-faq-page structure.

However, the FAQ page isn’t following the desired mysite.com/faq/{slug} structure; it’s loading without the “faq” part. I’m using the docs template. Any idea what I might be doing wrong?

You can find my routes below:

routes:

collections:
  /:
    permalink: /
    template: hometemplate
    filter: "tags:hash-hometemplate"
    order: "published_at asc"
    rss: false
    limit: "all"
    
  /about/:
    permalink: /about/
    template: hometemplate
    filter: "tags:hash-about"
    order: "published_at asc"
    rss: false
    limit: "all"

  /docs/:
    permalink: /{slug}/
    template: docs
    data: page.docs
    filter: "tags:hash-docs"

  /faqs/:
    permalink: /faqs/{slug}/
    template: docs
    data: page.faqs
    filter: "tags:hash-docs+tags:hash-faqs"   

Thanks a bunch!

You have hash-docs on two routes. That doesn’t work for routes - each post needs a distinct url to be at.

(You can have posts show up in two collections, but collections don’t set the post routing.)

Edited: oops, you have collections not routes. Sorry, reading on my phone! Collections don’t specify where individual posts appear. Routes can, but each route must be unique.

1 Like

I will go and try the above one; could you modify it please?