Hi,
I’m trying to display the category for each post on home page, but it’s not working.
I’m using : > {{ .Site.Taxonomies.categories }}
I get: > map[work:[{0 }]]
work = category name
How Can I get only “work” ?
Thank you
Hi,
I’m trying to display the category for each post on home page, but it’s not working.
I’m using : > {{ .Site.Taxonomies.categories }}
I get: > map[work:[{0 }]]
work = category name
How Can I get only “work” ?
Thank you
Hello @ecouto,
Is this an excerpt of a post’s front matter? Try categories = ["work", "cars", "stuff"]
to create a list of categories that you would like to assign to a post.
You can display the assigned categories of a post via .Params.categories
. Have a look at the range
keyword to loop over the categories list.
my front matter is like this: categories = [“work”]
You can display the categories next to each post as follows:
<ul>
{{ range .Site.RegularPages }}
<li>
Title: {{ .Title }} - Categories:
{{ range .Params.categories }}{{ . }}{{ end }}
</li>
{{ end }}
</ul>
Perfect - It’s work for me @digitalcraftsman
Thank you =D