Skip to content

Instantly share code, notes, and snippets.

@StevenLangbroek
Created March 23, 2015 17:22
Show Gist options
  • Save StevenLangbroek/1026175064435f63a255 to your computer and use it in GitHub Desktop.
Save StevenLangbroek/1026175064435f63a255 to your computer and use it in GitHub Desktop.
"Get Posts" Tag independent of "the loop".

Get Posts independent of URL.

As a stand-in to a full-fledged, publicly accessible JSON API, it would be incredibly liberating to have a Handlebars helper which allows us to loop through posts by parameters (maybe query params could even be mixed into the Handlebars context) instead of some internal state dictated by the URL. This would allow for easy creation of "related content", or a "search" function.

{{#post}}
<h2>{{ title }}</h2>
{{ content }}
<hr>
{{> related_posts }}
{{/post}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment