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: https://github.com/getgrav/grav-plugin-admin/issues

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 = field.name %}
{% set name = field.filter %}

    {% set value = array(data.value(field.name)|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,
        style: field.style,
        selectize: {
            create: true
        }
    } %}
 
    {% include ['forms/fields/select/select.html.twig'] %}

and in the page blueprint

                        header.filters:
                          type: taxonomytype
                          filter: category
                          label: Set category filter
                          multiple: true
                          validate:
                            type: array

Hope that help!

Hi Mauro,

Would your code work to filter a list of pages/posts like this Wordpress plugin does? [ http://www.tedor.info/test/ ]

I would like a very clean homepage like this Grav

https://demo.getgrav.org/multilang-skeleton/en

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:
http://demos.chiefqualakon.net/cardstack/#