Dynamic Routes: incorrect example in doc?


#1

Hi,

I just installed ghost 2, was experimenting with dynamic routing. Basically, I want a different page to be shown at the root of my blog, and the usual home page at /blog/. I started with the following example taken from the documentation:

routes:
  /: home
  /about/careers/: about-careers
  /about/team/: about-team

I have a page /about-me/. For testing purposes, I’d like this page to show up when someone visits the home (/). And my other posts (the usual home) to show up in /blog/ So I tried the below:

  /: about-me
  /blog/: home

But I got almost empty page at my home after this change. I’m sure I’m doing something wrong. Could someone please shed some light on what I need to do to get this right ?


#2

If you want to show the posts under /blog, then you need to configure this under “collections”.

e.g.

collections:
  /blog/:
    permalink: /blog/{slug}/

/: about-me

This takes the template “about-me” and renders it on /. Not sure what you expect there to see, because i don’t know what the content of this template is :slight_smile:


#3

Thank you @Kate for the super quick response!

I was assuming I can just put the post-url I want (in /: about-me). But now I understand I need to have a template rather.

How do I specify a particular post rather than a template ? I want a specific page to show up in the home, and not the whole posts. I think this would be a very popular use case, and would be easy if an example is given in the documentation!

One more question: Should I omit rest of the sections or, do I need to keep them untouched ?


#4

From the docs:

routes:
  /:
    data: resource-type.slug

The redirect from the resource page to / currently does not work, tracked here.


#5

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.