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

How to list taxonomy?

Started by woollypigs 1 year ago · 10 replies · 158 views
1 year 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
1 year ago

What is the problem? The format in md file? . Is your page working with both formats?

1 year ago

Please edit your post to use code blocks to paste your config. Currently there's no way to tell if formatting is wrong or something else

1 year ago

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.

1 year 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.

1 year 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

1 year 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.

1 year 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

1 year 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
1 year 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 Thomas, 1 week ago
2 60 16 hours ago
Support · by Anna, 3 days ago
2 66 19 hours ago
Support · by Justin Young, 20 hours ago
1 34 20 hours ago
Support · by Duc , 1 week ago
2 70 6 days ago
Support · by Colin Hume, 1 week ago
2 61 6 days ago