I have set up in my blog to have 4 sections:
/content/projects/
/content/process/
/content/randd/
/content/misc/
I’d like to assign proper longer names to these sections, so that on the page, it won’t be “randd” like when I use {{ .Section }}
. The nicer human-readable names may be longer than the short names I have above.
I also want to have a short description associated with each section so I can call it in section list page.
Any suggestions on how to do these?
Edit: So, I followed the tips in this post, however, I’m not sure how to generically pass the variables. Here’s what I’ve done.
Any reference to a section is now like this:
Topic: <a href="/{{.Section}}/">{{.Section}}</a>
I created a toml file in data directory (\data\sections.toml
) where I have the following, for example:
[randd]
title="Research and Development"
description="Lorem ipsum R and D."
The code, for just “randd” then becomes:
Topic: <a href="/randd/">{{.Site.Data.sections.randd.title}}</a>
How do I genericize this so that it will be something like this?
Topic: <a href="/{{.Section}}/">{{.Site.Data.sections.[.Section].title}}</a>
Thanks.