Tracing a page build?


When I’ve made a config change (e.g. selecting a new template in routes.yaml) and I don’t get the expected result, it would be really helpful to be able to debug the complete build of the page.

Is there a log level or ghost-cli option I could use to dump the detailed assembly of the page through all the Handlebars substitutions and routes actions?

What techniques do you most commonly use?


If you post your routes.yml file, and explain what you’re trying to do, someone from the community might be able to help you out!

That being said, here’s some useful information:

Ghost uses the debug node library for exhaustive debugging.

You can use this module with the CLI by running (on linux, and possibly OSX) DEBUG=ghost:* ghost run -D in your instance folder.

DEBUG=ghost:* specifies you only want messages that come sources like ghost: (there are other message sources, such as the CLI, and some of Ghost’s dependencies, like knex and express, which are probably going to be more annoying than helpful for you)

ghost run -D runs Ghost in development mode interactively. This means until you terminate the proess (ctrl + c), your console won’t be usable, as Ghost has “taken it over” - you’ll see all the logs in realtime

You can get even more fancy by being even more selective - for example, for routing, you might use DEBUG=ghost:services:routing:*

That being said, it’s not the easiest thing to debug routes like that, reading debug logs is not usually fun!

Again if you post your routes.yml file, and explain what you’re trying to do, someone from the community might be able to help you out :slight_smile:


Fantastic advice - thanks, Vikas.

I am trying to load content from a hidden post (about software) into a tag landing page, as an intro to the tag.

I have cloned a custom index-software.hbs that contains a post fetch (below), and pointed the tag URL at this index in routes.yaml (belowbelow). I’m not picking up the custom index page at all, but what looks like a normal index.hbs. Don’t know why.

-------------------------- index-software.hbs excerpt
{{!-- The main content area --}}

    {{#get "posts" slug="about-software" as |intro|}}
        <section class="post-full-content">
            <div class="post-content">

    <div class="post-feed">
        {{#foreach posts}}

-------------------------- routes.yaml:
controller: channel
data: page.about
template: home

permalink: /{slug}/
- home
controller: channel
permalink: /software/{slug}/
- index-software
filter: tag:software+tag:-support
permalink: /support/{slug}/
- index-support
filter: tag:support+tag:-software

tag: /tag/{slug}/
author: /author/{slug}/


/var/www/ghost$ DEBUG=ghost:* ghost run -D

ghost:boot:index Initialising Ghost +79ms
[2018-12-02 07:02:28] ERROR

NAME: DatabaseError
MESSAGE: SQLITE_CANTOPEN: unable to open database file


“Unknown database error”


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