Nau*_*wir 3 handlebars.js ghost-blog
我无法在侧边栏中显示可用标签列表,在ghost博客中.
我是tag.hbs文件,代码如下.
<header class="main-header tag-head {{#if tag.image}}" style="background-image: url({{tag.image}}){{else}}{{#if @blog.cover}}" style="background-image: url({{@blog.cover}}){{else}}no-cover{{/if}}{{/if}}">
<nav class="main-nav overlay clearfix">
<a class="back-button icon-arrow-left" href="{{@blog.url}}">Home</a>
</nav>
<div class="vertical">
<div class="main-header-content inner">
<h1 class="page-title">{{tag.name}}</h1>
<h2 class="page-description">
{{#if tag.description}}
{{tag.description}}
{{else}}
A {{pagination.total}}-post collection
{{/if}}
</h2>
</div>
</div>
</header>
{{! The main content area on the homepage }}
<main class="content" role="main">
<div class="container">
<div class="row-fluid">
<div class="col-md-12">
{{! The tag below includes the post loop - partials/loop.hbs }}
{{> "loop"}}
</div>
</div>
</div>
</main>
{{> myfooter colour='ec-teal' inverse='true'}}
Run Code Online (Sandbox Code Playgroud)
这就是我在post.hbs文件中包含它的方式
<div class="col-md-4">
<div class="row tags-row">
<h3> TAGS </h3>
{{#tag}}{{/tag}}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
小智 8
确保您已激活选项api,您可以使用此帮助程序,例如:
如果你得到标签使用
{{#get "tags"}}
{{#foreach tags}}
//Add html for each tag here
{{/foreach}}
{{/get}}
Run Code Online (Sandbox Code Playgroud)
如果你得到al标签使用这个:
{{#get "tags" limit="all"}}
{{#foreach tags}}
//Add html for each tag here
{{/foreach}}
{{/get}}
Run Code Online (Sandbox Code Playgroud)
如果你得到带有计数帖子的标签
{{#get "tags" include="count.posts"}}
{{#foreach tags}}
//Add html for each tag here
{{/foreach}}
{{/get}}
Run Code Online (Sandbox Code Playgroud)
我希望这些例子回答你的问题