I'm developing a static site using 11ty with Nunjucks. It's for a company that provides training for certification exams (AWS etc.) and they have ~25 Certification Training Courses each having its own data.
I have made it work but I have a strong feeling that there's a simpler and convenient way to organize this data. The data is something like this for each course:
Title:
Subtext:
Date:
Duration:
So far, so good. The tricky part is the course syllabus. It is organized something like this:
1. Topic Title
1.1 Subtopic Title
1.1 Subtopic Description
1.2 Subtopic Title
1.2 Subtopic Description
2. Topic Title
2.1 Subtopic Title
2.1 Subtopic Description
2.2 Subtopic Title
2.2 Subtopic Description
Around 4-8 topics for each course. I am currently denoting each of these variables with their standalone names which is making this very messy.
agenda_1:
a1_1:
a1_1_text:
a1_2:
a1_2_text:
agenda_1:
a1_1:
a1_1_text:
a1_2:
a1_2_text:
Please help me organize this data better (probably by using objects here or maybe a JSON file?). I am essentially looking for a way to nest these as objects so it's more accessible at a later date. Any help would be deeply appreciated. Thanks!
If you are using a separate data file, or putting it in the front-matter of each course, I would prefer to organize it like this in YAML:
topics:
- title: Topic Title 1
subtopics:
- title: Subtopic Title 1
desc: Subtopic Description 1
- title: Subtopic Title 2
desc: Subtopic Description 2
- title: Topic Title 2
subtopics:
- title: Subtopic Title 1
desc: Subtopic Description 1
- title: Subtopic Title 2
desc: Subtopic Description 2