Reputation: 674
I have just set up a Ghost Blog. This is a clean install on a VPS, and it is up and running correctly.
By default, Ghost shows a list of posts when opened in the browser. I would like to have a home page at the /
location, and have my posts available at /blog
. From what I can tell, this can be achieved by using Dynamic Routing.
To simplify this, I thought I would be able to page
(Ghost has the concept of pages and posts) as the home page. I could then render this page using the already existing page.hbs
template.
Here is my routes.yaml
file:
routes:
/:
data: page.home
template:
- page
collections:
/blog/:
permalink: /blog/{slug}/
template:
- index
taxonomies:
tag: /blog/tag/{slug}/
author: /blog/author/{slug}/
I have a page called home, but when I load the home page, I get an empty-ish page: just the footer displays.
There are no hints in the log that tells me what could be happening. Am I understanding routes.yaml correct? Is page.home
not how to pass data to a page?
Upvotes: 1
Views: 1931
Reputation: 674
I asked this question on forum.ghost.org and got the answer I was looking for.
The solution is to use the long-form data notation as below. My routes.yaml
file now looks like:
routes:
/:
data:
post: page.home
template: page
collections:
/blog/:
permalink: /blog/{slug}/
template:
- index
taxonomies:
tag: /blog/tag/{slug}/
author: /blog/author/{slug}/
Now, when I load example.com the page
home is loaded, and when I navigate to example.com/blog the blog is loaded
Upvotes: 5