\!h custom.js
export default function () {
$(function() {
blogFilters();
});
function blogFilters(){
$('.filter-select').change(function() {
window.location.href = $(this).val();
});
}
}
\!h blog.html
<div class="filter-area">
<div class="subtitle">{{lang 'blog.filters'}}</div>
<select class="filter-select">
<option value="">{{lang 'blog.by_author'}}</option>
<option value="/blog/tag/Gordon+Ramsy" {{#if blog.tag '==' 'Gordon Ramsy' }}selected="selected"{{/if}}>Gordon Ramsy</option>
<option value="/blog/tag/Ariana+Grande" {{#if blog.tag '==' 'Ariana Grande' }}selected="selected"{{/if}}>Ariana Grande</option>
</select>
<select class="filter-select">
<option value="">{{lang 'blog.by_tag'}}</option>
<option value="/blog/tag/Dog" {{#if blog.tag '==' 'Dog' }}selected="selected"{{/if}}>Dog</option>
<option value="/blog/tag/Bird" {{#if blog.tag '==' 'Bird' }}selected="selected"{{/if}}>Bird</option>
</select>
</div>
{{#each blog.posts}}
{{> components/blog/post post=this show_tags=true}}
{{/each}}