The FAQ page is a collection of frequently asked questions.
Prerequisites
We need to create a page called faq/index.md
in the content
directory.
1+++
2title = "Frequently Asked Questions"
3layout = "faq"
4+++
Data
The data are stored in data
directory, the directory structure is as follows:
1data
2 /en
3 /faq
4 foo.json
5 bar.json
6 /zh-cn
7 /faq
8 foo.json
9 bar.json
As you can see, we classify the questions according to their language. And each file represents a group of questions, that has the same format as follows:
1{
2 "title": "The group title",
3 "weight": 1,
4 "questions": [
5 {
6 "question": "The question",
7 "answer": "The answer"
8 }
9 ]
10}
- The
weight
parameter is used for sorting group in ascending order.
Comments