Skip to content

Instantly share code, notes, and snippets.

@johanbrook
Created May 12, 2015 18:07
Show Gist options
  • Save johanbrook/d53be319f291ccd3c886 to your computer and use it in GitHub Desktop.
Save johanbrook/d53be319f291ccd3c886 to your computer and use it in GitHub Desktop.
.use collections
posts:
pattern: 'posts/**.html'
sortBy: 'date'
reverse: true
.use branch('posts/**.html').use(
permalinks(pattern: 'writings/:title', relative: false)
)
.use branch('!posts/**.html').use branch('!index.md').use permalinks
relative: false
.use pagination
'collections.posts':
path: 'writings/page/:num/index.html'
perPage: 1
template: 'posts.html'
first: 'posts.html'
pageMetadata:
page: 'posts'
<main role="main">
{{#each pagination.files}}
<article role="article">
<header>
<time datetime="{{toISODate date}}" pubdate>{{ niceDate date 'MMMM D, YYYY'}}</time>
<h1><a href="/{{path}}">{{title}}</a></h1>
</header>
<div class="post-text">
{{{excerpt}}}
<p class="read-more">
<a href="/{{path}}">Read more…</a>
</p>
</div>
</article>
{{/each}}
<footer>
{{pagination.num}} - {{pagination.pages.length}}
</footer>
</main>
title template page
Writings
posts.html
posts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment