Hello Community.
A few days ago I was introduced to the amazing software GoHogo by a friend who is into development of websites. I good hooked up and started reading the documentation and to be honest, I found it interesting, easy and fun.
However, I soon have run into problems when I tried building some test stuff with it. I do hope that joining this forum will not only help me understand GoHugo better, but also help me grow in my capacities of developing static websites with it for my clients in the near future.
Okay so being a novice, who has just started off, this might sound lame but here is what I want to do -
I have a folder called “fruits” in the content folder. And this folder has about 50 files about fruits named in the format - fruitname.md
Each of these files have a Front Matter entry - fruitcolor: value - where value is the generic color of the fruit. So basically, it has values like red, green, yellow etc.
Now I have been trying to write some code where I would like the output on the page rendered in this format -
Red:
Total Fruits with Red Color: xx
Apples
Pomegranates
… [List of fruits which have the Value Red for the front matter fruitcolor.
For the Total Fruits with Red Color - I have been trying out the len function using the where and ideally it should be something as -
<p>Total Fruits with Red Color: {{ len (where .Site.RegularPages "fruitcolor" "==" "red") }}.</p>
Unfortunately I am unable to figure out the how. I understand the issue is somewhere here - “.Site.RegularPages” as these md files are not regular pages (I hope this is for pages/files that are directly in the content folder, not a subfolder inside content).
And, if this would help - the code is placed in an HTML file (list.html) in the folder /layouts/fruits
Thanking you community for reading out the post and it would be great if you could also let me understand and/or resolve the problem.
On another note, I am sorry if I posted it in the wrong section or there was some other info that was needed and I missed out. I am still getting used to this forum. So I hope, I would be excused and even corrected where I commit mistakes.
Have a great time.
Sid.