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.

Content & Markdown

Taxonomy Collections doesn´t show any article in home page

first-time

Solved by pamtbaau View solution

Started by Martin Larrea 7 years ago · 8 replies · 625 views
7 years ago

Hi everyone.
I´m using a Taxonomy Collections to create the homepage of my website. The frontmatter from the homepage looks like this:

YAML
title: Inicio
visible: true
content:
    '@taxonomy.tag': inicio
    limit: 5
    order:
        by: date
        dir: desc
    pagination: '1'

Now, I´m sure that there are articles with the tag ´inicio' but when I open the homescreen is empty. I´m really lost here.

I´m using Grav v1.6.16 and Admin v1.8.11.
Thank you in advance.

7 years ago

@martinlarrea According the documentation on collections, the format for Taxonomy collections should be:

YAML
content:
   items:
      '@taxonomy.tag': foo

You are missing node 'items'

When I use above syntax with '@taxonomy.tag': photography on the blog skeleton, it shows a correct result.

7 years ago

HI pamtbaau. I tried that:

YAML
title: Inicio
visible: true
content:
    item:
        '@taxonomy.tag': inicio
    limit: 5
    order:
        by: date
        dir: desc
    pagination: '1'

and I got the same result, nothing in the home page.

7 years ago

@martinlarrea Try 'items' instead of 'item'...

7 years ago

When I change ´item´ to ´items´:

YAML
title: Inicio
visible: true
content:
    items:
        '@taxonomy.tag': inicio
    limit: 5
    order:
        by: date
        dir: desc
    pagination: '1'

I got this:

Validation failed:
Invalid input in "Items"

7 years ago

@martinlarrea, When I copy your code into the 'blog.md' of the blog skeleton and use a proper tag, all works well...

  • Where/when do you get the validation error?
    • Are you using Admin?
      I've tried to create a validation error, but couldn't...
    • At runtime?
  • Did you create your own, or alter the blueprint of Admin?

I have no clue at the moment. My last suggestion would be to create a fresh copy the 'Blog Site' skeleton and try again.

7 years ago

Hi @pamtbaau

  • Where/when do you get the validation error?
    • Are you using Admin?
      I’ve tried to create a validation error, but couldn’t…
    • At runtime?
  • Did you create your own, or alter the blueprint of Admin?

I´m using Admin, I got the error at runtime when I modify the Frontmatter using the Expert view. I created my own. I will try your last suggestion and I will let you know. Thank you for your help.

7 years ago Solution

@martinlarrea If you created your own blueprint and get the error when editing a page's properties in Admin, I suspect you made an error in the definition of the blueprint..

👍 1
7 years ago

Holy sh***. It works. The blueprint was wrong. I overwritten it with a new one and now it´s working. Thank you so much @pamtbaau!

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 8 months ago
6 99 8 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 186 1 year ago
Content & Markdown · by Jan L'Am, 1 year ago
4 148 1 year ago
Content & Markdown · by Leonardo, 1 year ago
3 62 1 year ago
Content & Markdown · by belthasar, 1 year ago
4 257 1 year ago