Displaying the contents of a folder with a shortcode

Hi all,

I have folders for each year of the last century ( 1900, 1901 … 1999). In the folders I have a index.md with a short summary of what happend in this year. It it display by default when you access the folder like this:

www.example.com/1968/

In the folder I collect shortstories which refers to the year.

1968/index.md 1968/shortstory1.md 1968/shortstory2.md

I would like to display the contents of folder 1968 on the page rendered by index.md

Would you do it with a shortcode.

In index.md:

{{< toc >}}

How can I access the contents of the current folder in the shortcode itself?

TIA

What you want CAN be done, but I wouldn’t, so I’m not going into details (it should be documented).

There are better way to index and list your data in Hugo.

Oh, please… :wink:

Another way that came to my mind would be to use the data folder to store the general information about the year in a YAML-file and access it from the default template together with the contents of the current folder.

But I cannot figure out how to get the contents of the current folder.

I’ll look into the documentation again later the day.