Hi! I really like the was the edge theme’s front page looks, with an image representing each post. I just didn’t want it on the front page. I made a new all.hbs and custom route to it. Everything is great /except/ I’m getting two copies of each blog post.
My routes.yaml:
routes:
collections:
/:
permalink: /{slug}/
template: index
/all/:
template: all
permalink: /all/
taxonomies:
tag: /tag/{slug}/
My all.hbs:
{{!< default}}
<div class="content-area">
<main class="site-main container">
<div class="post-feed">
<div class="grid-item grid-sizer"></div>
{{#get "posts"}}
{{#foreach posts}}
{{> "loop"}}
{{/foreach}}
{{/get}}
</div>
{{pagination}}
</main>
</div>
My loop.hbs (I think unchanged except for styling?):
<div class="grid-item">
<figure class="{{post_class}}">
<a class="post-link" href="{{url}}">
<img class="post-image lazyload" data-srcset="{{> srcset}}"
data-sizes="auto" src="{{img_url feature_image size="s"}}"
alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}">
</a>
<a class="post-lightbox" href="{{img_url feature_image}}">
<i class="icon icon-arrow-expand"></i>
</a>
<figcaption class="post-caption">
<h2 class="post-caption-title">{{title}}</h2>
<div class="post-caption-meta">
{{#primary_tag}}
<span class="post-caption-meta-item post-caption-meta-tag">
<a href="{{url}}">{{name}}</a>
</span>
{{/primary_tag}}
<span class="post-caption-meta-item post-caption-meta-date">
<time
datetime="{{date format="YYYY-MM-DD"}}">{{date published_at}}</time>
</span>
<span class="post-caption-meta-item post-caption-meta-link">
<a href="{{url}}">View project</a>
</span>
</div>
</figcaption>
</figure>
</div>
The setup above gives me two copies of each post. Reverting to vanilla edge does not do that on the front page, so I’m pretty confident this isn’t a database problem or something.
I tried removing the {{#get “posts”}} and {{/get}} thinking maybe it was getting set already by some other code, but then I got NO posts. I’d like all the posts (so no filter or tag) to show up on the /all/ page, but only once.
Help, please? I’m enough of a Ghost and Handlebars newbie that I’m about at the limits of what I can troubleshoot.
Edit to add: It’s a little hard to tell with the masonry packing wizardry, but I’d say I’m getting one whole set of posts, then a second whole copy of those posts. So it’s like 1-2-3-4-1-2-3-4, not 1-1-2-2-3-3-4-4. Not sure if that’s a clue or not.