Pages (but not Posts or static homepage) are blank

While setting up my static homepage and routing, I did something causing my pages (but not posts) to appear blank. Posts work fine. My homepage, built on a version of the page template, works fine.

Pages themselves are blank.

Example page: The Founder's Guide to Hiring

pages.hbs

{{!< default}}

{{> header}}

<main class="wrapper_digitus" role="main">

{{#page}}
<article class="article_digitus" role="article" itemscope itemtype="http://schema.org/Article">
	<header class="postheader_digitus">
        <h1 class="posttitle_digitus" itemprop="headline">{{title}}</h1>
        <hr class="pause">
	</header>
	
	<div class="postcontent_digitus" itemprop="articleBody">
		{{content}}
	</div>

</article>

{{/page}}

</main>

{{> footer}}

routes.yaml

routes:
  /:
data: page.home
template: home


collections:
/articles/:
permalink: /{slug}/ 
template: index

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

I already recreated the page.hbs file from what was working on the static homepage and post.hbs.

Can anyone provide any guidance on where I might look to troubleshoot next?

Thanks,
Fred

For legacy reasons, normal pages in Ghost have all their data associated with a data key post and so they use {{#post}}{{/post}} where the newer dynamic route pages uses {{#page}}{{/page}} by default.

Or another way of putting it is that:

data: page.home is shorthand for

   data: 
     page: page.home

So, home.hbs should use {{#page}}{{/page}}
And page.hbs should use {{#post}}{{/post}}

Alternatively, if you change your routes to this:

routes:
  /:
    data:
      post: page.home
      template: home

You can change the home page data key to post and then consistently use {{#post}}{{/post}} everywhere.

FWIW yes this is daft and confusing and we need to fix it.

1 Like

That is confusing. Now I don’t feel so bad that I couldn’t figure it out myself.

Thanks, Hannah. Your explanation was super helpful. I’ve got it working with the your first suggestion.