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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

@taxonomy: Array to String Conversion error

Started by ian russell 8 years ago · 3 replies · 673 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 Thomas, 1 week ago
2 57 15 hours ago
Support · by Anna, 3 days ago
2 65 17 hours ago
Support · by Justin Young, 18 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago