Search code examples
ghost-blogghost

Ghost blog - empty navigation


I would like to setup a custom navigation on my ghost blog, yet even the simple walkthrough in the documentation is giving me blank output. I can also confirm that {{#if @blog.navigation}} evaluates true, as seen below.

ghost version: 0.11.4
database: mysql

ghost/content/themes/omikron_1.4/partials/navigation.hbs

{{!-- Navigation --}}
<ul class="nav navbar-nav navbar-right doYouReadMe {{#if @blog.navigation}}weHaveNav{{/if}}">
    {{#foreach navigation}}
        <a href="{{url absolute="true"}}">{{label}}</a>
    {{/foreach}}
</ul>

I added the "doYouReadMe" class to confirm this file is actually being referenced. I also added the conditional to confirm that Ghost is seeing that navigation items exist. I then restarted ghost, and the navigation element is empty, with my added classes:

<ul class="nav navbar-nav navbar-right doYouReadMe weHaveNav">
    ::before
    ::after
</ul>

Have also confirmed the values are in the db and they seem to be formatted properly. Additional evidence that there is no issue here is that the Navigation page in the admin area loads the content without any issues:

mysql> select settings.key, settings.value from settings where settings.key = 'navigation';
+------------+-------------------------------------------------------------------------------------------------------------+
| key        | value                                                                                                       |
+------------+-------------------------------------------------------------------------------------------------------------+
| navigation | [{"label":"test google","url":"https://google.com"},{"label":"test facebook","url":"https://facebook.com"}] |
+------------+-------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Solution

  • The issue was in my theme's insertion of the navigation in my header partial.

    Incorrect code was:

    {{> navigation}}
    

    I fixed this by correcting it to:

    {{navigation}}