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 :)

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|}}
      {{#intro}}
        <section class="post-full-content">
            <div class="post-content">
            {{content}}
            </div>
        </section>
      {{/intro}}
    {{/get}}

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

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

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

taxonomies:
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
CODE: SQLITE_CANTOPEN
MESSAGE: SQLITE_CANTOPEN: unable to open database file

level:normal

empty
“Unknown database error”
ERROR DETAILS:
empty

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