{ Quick Tip } > 7 posts

A few Ghost Tips: Static Pages, Debugging tips, and more.

quick tip

So I have been playing around with Ghost feverishly since it came out. I installed it on my server, redirected my old WordPress site and was off to the races. Along the way I have figured out a few quick tips id like to share.

How to launch Ghost with forever and still see what's going on in the console.

This one was a bit tricky for me to figure out. None of the commands seemed to like me. Anyway, here is the solution I came up with:


#Start the ghost process and create a log file
forever start -o out.file --fifo --watch="core/server/controllers" index.js  


#watch the output to the log file live.
tail -f out.file  

The following is a band aid fix, not a perscribed solution.

How to make static pages

I know that the static pages feature isn't going to be out until the next milestone ( December ), but I couldn't wait. This is more of a hack in my opinion than an actual solution, but hey, it gets the job done.

This process made me pull my hair out. Partly because i'm relatively new to node and partly because Ghost isn't ready for prime time ( as in all of it's features there yet ). Don't get me wrong, the features that shipped are awesome and i'm super satisfied. The internals don't exactly shine a light on the path of customization though. With that said, let's make a ficticious about page. Here is my approach:

Step 1: Setup the route

#add this to your: core/server.js file
// ### Frontend routes
server.get('/about', frontend.about);  

Circa line 357 you see the comment for the front end routes. You can add the route there. This then calls the about method of the frontend controller.

Step 2: The controller logic

#add me to the bottom of your #core/server/controllers/frontend.js file
'about': function (req, res, next) {  
    var page = {
        title: "The about page",
        para: [
            "heading" : "paragraph1",
            "text"    : "I am some text."
            "heading" : "paragraph2"
    res.render('about', page);
    return next();

Almost there for the controller, at the top of this file I think you need to add:

hbs = require('express-hbs')  

I say I think because it didn't work for me without it. Not sure if my forever was being buggy though.

Step 3: Setup your page.

In your active them, add your page. In this case its called about.hbs. You can find mine here.

It is also prudent to create a different layout file from which your pages can inherit. I think the defaults have some blog specific stuff in them that isn't related to a simple page. It causes errors. Again you can find my layout file here.


The above tips are the tricks i've picked up so far. If you have a better solution I would love to hear it. You can catch me on twitter or just email me peb7268[at]gmail.com.

Installing Laravel with composer

quick tip

Did you know you can actually install a laravel instance straight from the command line without even having a composer instance setup?

This is done by the following command.

composer create-project laravel/laravel  

The format this command expects is:

composer create-project [PACKAGE] [DESTINATION PATH] [--FLAGS]