Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

@taxonomy: Array to String Conversion error

Started by ian russell 8 years ago · 3 replies · 773 views
8 years ago

I have switched to in a fresh load of "grav-skeleton-bootstrap4-site".

Why does @taxonomy give an Array to String Conversion error with the following front matter:

YAML
content:
    items: 
        '@taxonomy':
        tag: [photography,text]
    order:
        by: date
        dir: desc
    limit: 5
    pagination: '1'

Thank you.

Ian Russell

8 years ago

Your YAML is bad. Whenever you get problems like this, pull up a YAML linter/validator. In this case, tag isn't indented properly.

All that said, read the docs on Page Collections. A simple '@taxonomy.tag': [photography, text] will also do.

8 years ago

@jitr:
items: '@taxonomy': tag: [photography,text] order: by: date dir: desc limit: 5 pagination: '1'

Thank you, but the following still gives an Array to String conversion error:

YAML
content:
items: 
    '@taxonomy':
        tag: [photography,text]
order:
    by: date
    dir: desc
limit: 5
pagination: '1'

and so does this:

YAML
content:
items: 
    '@taxonomy.tag': [photography, text]
order:
    by: date
    dir: desc
limit: 5
pagination: '1'

I am wondering if there is problem with the latest version of Grav or Gantry.

Ian Russell

8 years ago

This issue is resolved now - incompatible item selector, I think.

The grav-skeleton-bootstrap4-site has Children instead of @self.children in the options. Maybe this is shorthand but I went back to my website and got it working.

To repeat a note from my other thread, using taxonomy to select pages can be confusing before you have worked out how to do it!

Sometimes my selectors in the front matter and the options tab were out of step. When there is a problem I start with one and check the other.

Thank you

Ian Russell

last edited 07/11/18 by ian russell

Suggested topics

Topic Participants Replies Views Activity
Support · by Paul Hodges, 4 weeks ago
19 484 5 days ago
Support · by Lauw, 7 days ago
2 99 7 days ago
Support · by Anna, 3 weeks ago
4 426 1 week ago
Support · by gtx, 4 weeks ago
4 377 3 weeks ago
Support · by Anna, 1 month ago
9 484 3 weeks ago