🎨 Update to use Primary Tag syntax (#337)

refs TryGhost/Ghost#8668

- In Ghost 1.2.0 we introduce primary_tag as a calculated property
- Casper can be updated to use this for clarity
This commit is contained in:
Hannah Wolfe 2017-08-10 15:10:17 +01:00 committed by Katharina Irrgang
parent d7ca6fd2f6
commit ba10cb1516
2 changed files with 12 additions and 10 deletions

View File

@ -7,8 +7,8 @@
<div class="post-card-content"> <div class="post-card-content">
<a class="post-card-content-link" href="{{url}}"> <a class="post-card-content-link" href="{{url}}">
<header class="post-card-header"> <header class="post-card-header">
{{#if tags}} {{#if primary_tag}}
<span class="post-card-tags">{{tags.[0].name}}</span> <span class="post-card-tags">{{primary_tag.name}}</span>
{{/if}} {{/if}}
<h2 class="post-card-title">{{title}}</h2> <h2 class="post-card-title">{{title}}</h2>
</header> </header>

View File

@ -20,9 +20,9 @@ into the {body} of the default.hbs template --}}
<header class="post-full-header"> <header class="post-full-header">
<section class="post-full-meta"> <section class="post-full-meta">
<time class="post-full-meta-date" datetime="{{date format="YYYY-MM-DD"}}">{{date format="D MMMM YYYY"}}</time> <time class="post-full-meta-date" datetime="{{date format="YYYY-MM-DD"}}">{{date format="D MMMM YYYY"}}</time>
{{#if tags}} {{#primary_tag}}
<span class="date-divider">/</span> <a href="{{@blog.url}}/tag/{{tags.[0].slug}}">{{tags.[0].name}}</a> <span class="date-divider">/</span> <a href="{{url}}">{{name}}</a>
{{/if}} {{/primary_tag}}
</section> </section>
<h1 class="post-full-title">{{title}}</h1> <h1 class="post-full-title">{{title}}</h1>
</header> </header>
@ -102,11 +102,11 @@ into the {body} of the default.hbs template --}}
<div class="inner"> <div class="inner">
<div class="read-next-feed"> <div class="read-next-feed">
{{#get "posts" filter="tags:{{tags.[0].slug}}+id:-{{id}}" limit="3" as |related_posts|}} {{#get "posts" filter="tags:{{primary_tag.slug}}+id:-{{id}}" limit="3" as |related_posts|}}
{{#if related_posts}} {{#if related_posts}}
<article class="read-next-card" <article class="read-next-card"
{{#if ../tags.[0].feature_image}} {{#if ../primary_tag.feature_image}}
style="background-image: url({{../tags.[0].feature_image}})" style="background-image: url({{../primary_tag.feature_image}})"
{{else}} {{else}}
{{#if @blog.cover_image}} {{#if @blog.cover_image}}
style="background-image: url({{@blog.cover_image}})"{{/if}} style="background-image: url({{@blog.cover_image}})"{{/if}}
@ -114,7 +114,9 @@ into the {body} of the default.hbs template --}}
> >
<header class="read-next-card-header"> <header class="read-next-card-header">
<small class="read-next-card-header-sitetitle">&mdash; {{@blog.title}} &mdash;</small> <small class="read-next-card-header-sitetitle">&mdash; {{@blog.title}} &mdash;</small>
<h3 class="read-next-card-header-title"><a href="{{@blog.url}}/tag/{{../tags.[0].slug}}/">{{../tags.[0].name}}</a></h3> {{#../primary_tag}}
<h3 class="read-next-card-header-title"><a href="{{url}}">{{name}}</a></h3>
{{/../primary_tag}}
</header> </header>
<div class="read-next-divider">{{> "icons/infinity"}}</div> <div class="read-next-divider">{{> "icons/infinity"}}</div>
<div class="read-next-card-content"> <div class="read-next-card-content">
@ -125,7 +127,7 @@ into the {body} of the default.hbs template --}}
</ul> </ul>
</div> </div>
<footer class="read-next-card-footer"> <footer class="read-next-card-footer">
<a href="{{@blog.url}}/tag/{{../tags.[0].slug}}/">{{plural meta.pagination.total empty='No posts' singular='% post' plural='See all % posts'}} →</a> <a href="{{#../primary_tag}}{{url}}{{/../primary_tag}}">{{plural meta.pagination.total empty='No posts' singular='% post' plural='See all % posts'}} →</a>
</footer> </footer>
</article> </article>
{{/if}} {{/if}}