0
私のloop.hbsテンプレートでは、 "Top"というタグを持つ投稿をGhostにピン止めさせようとしています。私は{{#foreach posts}}
と組み合わせた{{#has}}
ヘルパーを使用しています。Ghost handlebars.js {{#has tag = "Top"}}は機能しません
以下のコードを参照してください。私が行っている動作は、{{^has tag="Top"}}
(つまり、2番目のforeach
ループ)だけが動作しているということです。
私が間違っている可能性のある手がかりはありますか?
{{#foreach posts}}
{{#has tag="Top"}}
<article class="{{post_class}} top-post" style="background-color:lightgray">
<header class="post-header">
<h2 class="post-title"><a href="{{url}}">{{{title}}}</a></h2>
</header>
<section class="post-excerpt">
<p>{{excerpt words="26"}} <a class="read-more" href="{{url}}">»</a></p>
</section>
<footer class="post-meta">
{{#if author.image}}<img class="author-thumb" src="{{author.image}}" alt="{{author.name}}" nopin="nopin" />{{/if}}
{{author}}
{{tags prefix=" on "}}
<time class="post-date" datetime="{{date format='YYYY-MM-DD'}}">{{date format="DD MMMM YYYY"}}</time>
</footer>
</article>
{{/has}}
{{/foreach}}
{{! All the code above doesn't seem to be working. Only the below code outputs posts to the blog homepage }}
{{#foreach posts}}
{{^has tag="Top"}}
<article class="{{post_class}}">
<header class="post-header">
<h2 class="post-title"><a href="{{url}}">{{{title}}}</a></h2>
</header>
<section class="post-excerpt">
<p>{{excerpt words="26"}} <a class="read-more" href="{{url}}">»</a></p>
</section>
<footer class="post-meta">
{{#if author.image}}<img class="author-thumb" src="{{author.image}}" alt="{{author.name}}" nopin="nopin" />{{/if}}
{{author}}
{{tags prefix=" on "}}
<time class="post-date" datetime="{{date format='YYYY-MM-DD'}}">{{date format="DD MMMM YYYY"}}</time>
</footer>
</article>
{{/has}}
{{/foreach}}