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

How to list taxonomy?

Started by woollypigs 2 years ago · 10 replies · 297 views
2 years ago

Mojn

I have failed my googling. In my default.md I got:

YAML
---
title: pageTitle
taxonomy: 
    tag: [tag1, tag2, tag3]
    category: Cat1
---

Which I hope is correct from when I read this page: https://learn.getgrav.org/17/content/taxonomy and https://github.com/getgrav/grav-plugin-taxonomylist

But when I edit the page in Admin I end up with this:

YAML
---
title: pageTitle
taxonomy: 
    tag: 
        - tag1
        - tag2
        - tag3
    category: 
        - Cat1
---

I got the Lingonberry theme (v1.2.1), Taxonomy List plugin (v1.3.6) and Grav v1.7.48 and Admin v1.10.48 running.

So which one is correct and how can I make the taxonomy to look the same.

Many thanks
woollypigs

last edited 01/04/25 by woollypigs
2 years ago Pedro M What is the problem? The format in md file? . Is your page working with both formats?

Mojn

the problem is that when I edit/create the default.md file in a text editor and enter this " tag: [tag1, tag2, tag3]" it works and show up happily. But if I log in and create a new post/file (default.md) via Grav Admin editor the tags get written like this "tag: - tag1 - tag2 - tag3"

Which isn't what is shown in the Grav documentation.

2 years ago

This is an example of item in blog from Editorial theme demo page.

YAML
---
title: 'First item'
taxonomy:
    category:
        - featured
    tag:
        - tag1
---

It works fine. I’m not understand what is the problem. The taxonomy could be shown in both formats without problem.

2 years ago

The main problem is that if I create the files "manually" and follow this page: https://learn.getgrav.org/17/content/taxonomy

This is how the tags should be written

YAML
---
title: pageTitle
taxonomy: 
    tag: [tag1, tag2, tag3]
    category: Cat1
---

i tend to create the pages/blogs in a text editor and then FTP them up once I'm online. And I would like my pages to look the same, easier to edit.

But if I log into the site via Grav Admin page and create a page/blogs there and use the options there to add tags I get this

YAML
---
title: pageTitle
taxonomy: 
    tag: 
        - tag1
        - tag2
        - tag3
    category: 
        - Cat1
---

Which isn't what is shown in the Grav Documentation page that I linked above. It just confuses me and somewhat annoys me that my pages aren't looking the same or follow the same "rules" with the regard to the layout.

Thanks

2 years ago

But then it is not a problem in itself, but the documentation of the Grav Taxonomy is incomplete and should include this .md file format

In that case you could send it to the Grav team through a PullRequest in the Documentation repository.

2 years ago

Mojn

Never done a PullRequest so a bit stumped there.

Do you know which "version" of the taxonomy is correct, so that I can make sure all my pages are following that. Don't want to end up it not working in a future update.

Thanks

2 years ago

@woollypigs, these are just a different styles for sequences (block/flow ), both are valid. However, the 'block' style is generally considered more readable, especially with longer data. Here is link to the yaml documentation.

👍 1
2 years ago

OK thanks.

Is there a way to get Grav to use the 'block' style as I prefer that and have used it for nearly 500 posts already.

Or shall I just learn to live with it and create the new post in a text editor and FTP them into place, instead of using Grav editor. 🙄 😜

Thanks

Suggested topics

Topic Participants Replies Views Activity
Support · by Anna, 21 hours ago
2 67 23 minutes ago
Support · by gtx, 1 week ago
4 233 2 days ago
Support · by Paul Hodges, 2 weeks ago
13 283 5 days ago
Support · by Anna, 3 weeks ago
9 339 1 week ago
Support · by TomW, 2 weeks ago
4 192 2 weeks ago