Reputation: 49
I am creating a group of different templates as want to allow the users create different types of pages as in using different templates depending on content. That is why I would like to create a filter that will help me filter the pages by type and using the different tags included on each page.
Upvotes: 0
Views: 367
Reputation: 49
I just want to add that in the following tutorial for creating UI with apostrophe-pieces-pages when describing how to list the tags when creating the filter, the url field is missing a part. It should go as follows:
<ul class="tag-filters">
{% for tag in data.piecesFilters.tags %}
<li><a href="{{ data.page._url | build({ tags: tag.value }) }}">{{ tag.label }}</a></li>
{% endfor %}
</ul>
Upvotes: 1
Reputation: 7572
Since your content is not structured in a tree, but rather filtered dynamically by other properties, the right direction for you is to use pieces rather than pages. See reusable content with pieces.
In particular, you'll want to look at the filtering the list of people section of that tutorial, which demonstrates how to create filters based on any schema field, including fields of type "select". A field of type "select" is ideal for your distinct "blog templates." You can use that field to decide what file to include
via nunjucks from the main show.html
template for your apostrophe-pieces-pages
subclass.
Read on past that point and you'll learn how to power those filters with AJAX so they don't require a full page refresh, but still support SEO and build a browser history, etc.
Edited to add: some of the most relevant material, as linked to from the above tutorials, is in the article creating UI with apostrophe-pieces-pages.
Upvotes: 0