Clarifying custom home page routing


#1

Hi, I just setup a fresh install of the latest version of Ghost with the aim of separating the home page from blog. The Ghost 2.0 post says it’s possible to set “a custom homepage on / with posts published on /blog/”, but regarding the installation, should I be setting the website to / or /blog/?

I’ve installed it on / for now, and had a look at the routing documentation, but I didn’t find it too clear, I changed the routes file to include
routes:
/: home
but wasn’t really sure how to follow this up, where do I include the home.hbs file? and if I want to set /blog/ to the standard ghost home, what would I enter?

Thanks for any clarity on these issues


#2

I think the easiest way you an achieve that without breaking anything lol, would be to have your landing / home page as anykind of HTML theme you want; then just install it in the root directory for your webserver.

Then you move over to your NGINX configuration and send all requests for ‘/’ to the static files

but then let every other request be sent to Ghost


#3

@tawandabrandon that was definitely the case before Ghost 2.0 but is no longer necessary

@deltoid you would set up Ghost on / then modify your routes.yaml to look something like this:

routes:
  /: home

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

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

Then your homepage uses home.hbs and lives on / and all of your posts, tags, author pages, etc live under /blog/


#4

Thank you for the assistance, but I now get an error: 500

Cannot read property ‘match’ of undefined

This appears on / directory, everything seems to be working fine on /blog

have I not got the home.hbs in the right directory? I’ve tried moving it around, and looking in the admin panel, but I’m at a loss


#5

That sounds like a broken template (incorrect usage/syntax). Did you fix it already?


#6

nope :frowning: is this incorrect syntax in the routes.yaml file?


#7

Maybe. Can you share your routes.yaml and the full error log from the server?


#8

my routes.yaml file was just copy and pasted from above

what’s the best way to share the error.log file?


#9

I’ve copied it too - the syntax is correct. So looks like it’s your template?

what’s the best way to share the error.log file?

Copy the error message with the last 5 lines of the stack in code back sticks.


You could also figure this out yourself, by not using the home.hbs template or the index.hbs and then restart Ghost. By that you can identify, which template might be wrong - if it’s the template :crazy_face:


#10

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