Skip to content

Instantly share code, notes, and snippets.

@centminmod
Created November 15, 2013 15:48
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save centminmod/7486490 to your computer and use it in GitHub Desktop.
custom index.hbs foreach post loop used on ghost.centminmod.com
<main class="content" role="main">
{{! Each post will be output using this markup }}
{{#foreach posts}}
{{#if @first}}
<article class="{{post_class}}" itemscope itemtype="http://schema.org/BlogPosting">
<header class="post-header">
<span class="post-meta"><time datetime="{{date format='YYYY-MM-DD'}}" itemprop="datePublished">{{date format="DD MMM YY"}}</time> {{#if tags}}| {{tags}}{{/if}} | <a href="{{url absolute="true"}}#disqus_thread" data-disqus-identifier="{{id}}">Comments</a></span>
<h2 class="post-title"><a href="{{url}}" itemprop="url"><span itemprop="name headline">{{{title}}}</span></a></h2>
</header>
<section class="post-excerpt" itemprop="articleBody">
<p>{{excerpt characters="28"}}&hellip;<span class="read-more"> <a href="{{url}}">Read More</a></p>
</section>
</article>
{{else}}
<article class="{{post_class}}" itemscope itemtype="http://schema.org/BlogPosting">
<header class="post-header">
<span class="post-meta"><time datetime="{{date format='YYYY-MM-DD'}}" itemprop="datePublished">{{date format="DD MMM YY"}}</time> {{#if tags}}| {{tags}}{{/if}} | <a href="{{url absolute="true"}}#disqus_thread" data-disqus-identifier="{{id}}">Comments</a></span>
<h2 class="post-title"><a href="{{url}}" itemprop="url"><span itemprop="name headline">{{{title}}}</span></a></h2>
</header>
<section class="post-excerpt" itemprop="articleBody">
<p>{{excerpt characters="18"}}&hellip;<span class="read-more"> <a href="{{url}}">Read More</a></p>
</section>
</article>
{{/if}}
{{/foreach}}
{{!! After all the posts, we have the previous/next pagination links }}
{{pagination}}
</main>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment