Show only a specific taxonomy in a page blueprint

hello folks! is there a way to display only a specific taxonomy type in a page blueprint? Right now when I add the field type taxonomy it shows all the taxonomies available.

Currently no, you could make a feature request to provide filtering in the taxonomy form field:

hy, i’ve created my own custom field this is the code:
create the file taxonomytype.html.twig in this path
/admin/themes/grav/templates/forms/fields/, I do this in my plugin folder but i thinc it works also in a theme.

{% set parentname = %}
{% set name = field.filter %}

    {% set value = array(data.value(|default([])) %}
    {% set sub_taxonomies = attribute(grav.taxonomy.taxonomy, name)|default([])|keys %}
    {% set list = []|merge(sub_taxonomies)|merge(value)|array_unique %}
    {% set field = {
        type: 'select',
        classes: 'fancy create',
        label: field.label|capitalize,
        name: parentname,
        multiple: true,
        options: list,
        selectize: {
            create: true
    } %}
    {% include ['forms/fields/select/select.html.twig'] %}

and in the page blueprint

                          type: taxonomytype
                          filter: category
                          label: Set category filter
                          multiple: true
                            type: array

Hope that help!

Hi Mauro,

Would your code work to filter a list of pages/posts like this Wordpress plugin does? [ ]

I would like a very clean homepage like this Grav

where filtering narrows down the portfolio.

Thanks, k

hi, with this field, you can have a filed in blueprint with only the taxonomy that you need (in my example see “filter:category”). After you save the page, you can retrive the value that you can save like any other other grav field and use it to filter the pages you need in your twig template. I use it to get collection by page taxonomy, for example

page.collection({'items':{'@taxonomy':{'category': page.header.filter , }},'order': {'by': 'default', 'dir': 'asc'}}) %}

In my case
Hope that help

but you need a selectize that show you only a single taxonomy type or a select where you can select the taxonomy type available on the site?? my example works for the first purpose.
Sorry… I have a doubt :slight_smile:

One available theme seems to have the function needed: