Trying to get a custom static page to load on the webroot rather than the default, while rotating the default to /blog/. Have been trying a number of things that don’t seem to work properly. Not sure where I’m going wrong.
Currently I’m trying:
routes:
/:
controller: channel
template:
- home
collections:
/blog/:
permalink: /blog/{slug}/
template:
- index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
however it’s not loading anything different, despite my having home.hbs created in my theme folder.
I’ve also tried
routes:
/: home
collections:
/blog/:
permalink: /blog/{slug}/
template:
- index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
However that resulted in a slew of errors. Even if the home.hbs is completely blank, the error is the same. Short form of the error is: Cannot read property 'match' of undefined. If anyone wants me to post the full ghost-cli log output I can if that’s helpful.
Ah I see. I’m using the theme odin if that helps at all.
I figured I could just copy and mod the standard index.hbs and use it as a home.hbs, but that’s not working either. I’ve also just tried a blank one just to test and it errors out just the same.
Full error below:
[2019-01-22 02:46:09] ERROR "GET /" 500 11ms
NAME: InternalServerError
MESSAGE: Cannot read property 'match' of undefined
level: normal
empty
empty
ERROR DETAILS:
empty
InternalServerError: Cannot read property 'match' of undefined
at new GhostError (/var/www/ghost/versions/2.6.0/core/server/lib/common/errors.js:10:26)
at _private.prepareError (/var/www/ghost/versions/2.6.0/core/server/web/shared/middlewares/error-handler.js:42:19)
at Layer.handle_error (/var/www/ghost/versions/2.6.0/node_modules/express/lib/router/layer.js:71:5)
at trim_prefix (/var/www/ghost/versions/2.6.0/node_modules/express/lib/router/index.js:315:13)
at /var/www/ghost/versions/2.6.0/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/var/www/ghost/versions/2.6.0/node_modules/express/lib/router/index.js:335:12)
at next (/var/www/ghost/versions/2.6.0/node_modules/express/lib/router/index.js:275:10)
at Layer.handle_error (/var/www/ghost/versions/2.6.0/node_modules/express/lib/router/layer.js:67:12)
at trim_prefix (/var/www/ghost/versions/2.6.0/node_modules/express/lib/router/index.js:315:13)
at /var/www/ghost/versions/2.6.0/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/var/www/ghost/versions/2.6.0/node_modules/express/lib/router/index.js:335:12)
at Immediate.next (/var/www/ghost/versions/2.6.0/node_modules/express/lib/router/index.js:275:10)
at Immediate.<anonymous> (/var/www/ghost/versions/2.6.0/node_modules/express/lib/router/index.js:635:15)
at runCallback (timers.js:812:20)
at tryOnImmediate (timers.js:768:5)
at processImmediate [as _immediateCallback] (timers.js:745:5)
TypeError: Cannot read property 'match' of undefined
at ExpressHbs.declaredLayoutFile (/var/www/ghost/versions/2.6.0/node_modules/express-hbs/lib/hbs.js:89:21)
at parseLayout (/var/www/ghost/versions/2.6.0/node_modules/express-hbs/lib/hbs.js:463:27)
at /var/www/ghost/versions/2.6.0/node_modules/express-hbs/lib/hbs.js:582:7
at getSourceTemplate (/var/www/ghost/versions/2.6.0/node_modules/express-hbs/lib/hbs.js:556:16)
at compileFile (/var/www/ghost/versions/2.6.0/node_modules/express-hbs/lib/hbs.js:578:5)
at /var/www/ghost/versions/2.6.0/node_modules/express-hbs/lib/hbs.js:635:12
at ExpressHbs.loadDefaultLayout (/var/www/ghost/versions/2.6.0/node_modules/express-hbs/lib/hbs.js:320:44)
at ExpressHbs.___express (/var/www/ghost/versions/2.6.0/node_modules/express-hbs/lib/hbs.js:623:8)
at View.render (/var/www/ghost/versions/2.6.0/node_modules/express/lib/view.js:135:8)
at tryRender (/var/www/ghost/versions/2.6.0/node_modules/express/lib/application.js:640:10)
at Function.render (/var/www/ghost/versions/2.6.0/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/var/www/ghost/versions/2.6.0/node_modules/express/lib/response.js:1008:7)
at Object.renderer (/var/www/ghost/versions/2.6.0/core/server/services/routing/helpers/renderer.js:22:9)
at handleResult (/var/www/ghost/versions/2.6.0/core/server/services/routing/controllers/static.js:44:21)
at tryCatcher (/var/www/ghost/versions/2.6.0/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/var/www/ghost/versions/2.6.0/node_modules/bluebird/js/release/promise.js:512:31)
Just to test I 777’d the entirety of the currently in-use theme’s directory, which removed all of the errors for some reason. Now rather than 500 error’ing, the response is 304 & no content is served. Completely blank page regardless of what is in the home.hbs.
i.e.
[2019-01-23 18:28:55] INFO "GET /favicon.ico" 200 2ms
[2019-01-23 18:28:55] INFO "GET /" 304 4ms
Update: Followed a tutorial seemingly doing the same thing I’m doing, but no progress has been made. If anyone else has had this issue or managed to solve it please let me know
Update2: No luck yet. Not sure why these routes won’t obey me.
Update3: Still no luck. Is there some error I should be getting but am missing somewhere along this chain? ghost log is only producing the 304 etc, not seeing any other issues arise though the only thing that’s loading is still the blank page regardless of what’s in the home.hbs.