A page routed to as home looses title

Hi guys.

I use routes.yml to redirect home to a page and when I do that page looses its title - would you have some suggestion on how to keep the title? I’m on journal theme. I presume it has something to do with home.hbs? Thanks.

  • Can you share the part from your routes.yaml that contains the redirect ?

  • Make sure your Ghost server is v5.54.1 or later

  • If you have the beta editor enabled, make sure that “Show title and feature image” is enabled on your page

-> $ cat settings/routes.yaml 
routes:
  /:
    data: page.systems-locality
    template: home
...
-> $ cat themes/journal-mine/home.hbs 
{{!< default}}

{{#page}}

<main id="gh-main" class="gh-main">
    <article class="gh-article {{post_class}}">
        <header class="gh-article-header gh-canvas">
            {{#is "page"}}
                <span class="gh-article-meta">
                </span>
            {{/is}}

            {{#if custom_excerpt}}
                <p class="gh-article-excerpt">{{custom_excerpt}}</p>
            {{/if}}

            {{#if feature_image}}
                <figure class="gh-article-image">
                    <img
                        srcset="{{img_url feature_image size="s"}} 300w,
                                {{img_url feature_image size="m"}} 720w,
                                {{img_url feature_image size="l"}} 960w,
                                {{img_url feature_image size="xl"}} 1200w,
                                {{img_url feature_image size="xxl"}} 2000w"
                        sizes="(max-width: 1200px) 100vw, 1200px"
                        src="{{img_url feature_image size="xl"}}"
                    >
                    {{#if feature_image_caption}}
                        <figcaption>{{feature_image_caption}}</figcaption>
                    {{/if}}
                </figure>
            {{/if}}
        </header>

        <div class="gh-content gh-canvas">
            {{content}}
        </div>

        {{#if comments}}
            <div class="gh-comments gh-canvas">
                {{comments}}
            </div>
        {{/if}}

    </article>
</main>

{{/page}}

No beta editor.

Can you share your complete home.hbs ?

Looks like you don’t have any title in that file.

Try this:

{{!< default}}

{{#page}}

<main id="gh-main" class="gh-main">
    <article class="gh-article {{post_class}}">
        <header class="gh-article-header gh-canvas">
            {{#is "page"}}
                <span class="gh-article-meta">
                </span>
            {{/is}}

            <h1 class="gh-article-title">{{title}}</h1>

            {{#if custom_excerpt}}
                <p class="gh-article-excerpt">{{custom_excerpt}}</p>
            {{/if}}

            {{#if feature_image}}
                <figure class="gh-article-image">
                    <img
                        srcset="{{img_url feature_image size="s"}} 300w,
                                {{img_url feature_image size="m"}} 720w,
                                {{img_url feature_image size="l"}} 960w,
                                {{img_url feature_image size="xl"}} 1200w,
                                {{img_url feature_image size="xxl"}} 2000w"
                        sizes="(max-width: 1200px) 100vw, 1200px"
                        src="{{img_url feature_image size="xl"}}"
                    >
                    {{#if feature_image_caption}}
                        <figcaption>{{feature_image_caption}}</figcaption>
                    {{/if}}
                </figure>
            {{/if}}
        </header>

        <div class="gh-content gh-canvas">
            {{content}}
        </div>

        {{#if comments}}
            <div class="gh-comments gh-canvas">
                {{comments}}
            </div>
        {{/if}}

    </article>
</main>

{{/page}}

I just added <h1 class="gh-article-title">{{title}}</h1> before the excerpt

1 Like

Ah, I’ve been fiddling with those - just learning… that container needs a restart in order to pick up such changes.
How to comment out in .hbs files, if possible?

1 Like

Like this:

{{!-- This is a comment --}}