Filtered author taxonomy does not work if it is defined in the page header

Hello

What is the difference between having the author taxonomy defined in site.yaml and page.header.author? If I use the author taxonomy from site.yaml, I can filter blog pages by author, however, if I use the taxonomy in the page header, that filter doesn’t work.

The following code

{% if page.taxonomy.author %}
{% for author in page.taxonomy.author %}
       <a href="{{ base_url }}/author{{ config.system.param_sep }}{{ author }}">{{ author }}
{% end for %}
{% endif %}

Filter correctly by taxonomy if site.yaml is like this:

taxonomies:
   - category
   - tag
   - author

DO NOT filter by taxonomy if item.md is like this:

taxonomy:
     category:
         -category1
     tag:
         -tag1
     author:
         - Peter

I have defined the taxonomy according to this post:

Set Category and Tag (Taxonomies) as required

How can I solve this problem?

@pmoreno

In site.yaml you just define the types of taxonomies you like to use. And in item.md you define the taxonomy value for exactly that page.

E.g. I have in a similar use case:

Add desired taxonomies to site.yaml

taxonomies:
  - author
  - category
  - tag

Use it in blog_item.html.twig

  {% if page.header.author %}
    {% set author = page.header.author %}
  {% else %}
    {% set author = array(page.header.taxonomy.author)[0] %}
  {% endif %}

which uses the data from

item.md frontmatter

taxonomy:
    author: abc
    category: blog
    tag: [2020, anyname]

Does that answer your question?

The saying goes that a picture is worth a thousand words.

I have modified some pages in the Future2021 theme demo to be able to show this error.

We have two pages, with the author “Ana”, one with the author defined in the header of the page, Post Five,

page_header_post_five

and another with the author defined in the author taxonomy (previously defined in site.yaml), Grav Install.

Now, if we visit the blog, filtering the author “Ana”, we get only one post, the post that has the author defined in the taxonomy (Grav Install) and NOT in the page header (Post Five)

http://future.juanvillen.es/blog/author:Ana

The question is the following: How can I get all the posts of an author, regardless of whether it is defined in taxonomies or in page header?

Sorry I can’t express it better. Thanks in advance

OK, now I understand your issue. As far as I know …/author:Ana only works when the author is defined as taxonomy, but not when it’s simply in the header.