HUGO

Taxonomy terms in data file

Dear all,

First of all sorry about the long post, and since I am on my phone I have limited copy/paste/insert code support.

I am (still :frowning: ) working on a website and have been banging my head around a few issues:

  1. I love the way hugo handles taxonomies, easy, elegant, awesome. But for this project I would like to separate my content (photos and captions) from general information found in the front matter. Is there an nice way to have the terms in a data file? The post title would be the element in common between content and data.

  2. Counting stuff. My no. of posts is fixed and known, but not all is published from the beginning. How can I count all draft posts and all published posts and have some statistics of the progress (draft:true/draft:false ratio)? If I build with - - buildDrafts the numbers are correct.

Here is a minimal working example:

https://github.com/thelightstain/hugo-color-playground

And the result:

https://festive-babbage-0510a6.netlify.com/

Thanks for your help!

You can’t count draft pages as far as i know. But you can count non draft pages. For example:

{{ len site.RegularPages }}

Also see https://gohugo.io/functions/len/#len-example-2-counting-pages-with-where

Hi, that was quick! Thanks! I know, this is why I am looking for an easier way to count (id in datafile). I hope the repo clears thing up.

Update, changed working example hosting from netlify to github pages.

https://thelightstain.github.io/hugo-color-playground/