Use index.gmi for index templates instead of directory.gmi

This commit is contained in:
adnano 2020-09-23 14:12:07 -04:00
parent 6b781dd414
commit 6cfc9e9e1f
2 changed files with 6 additions and 6 deletions

View file

@ -60,10 +60,10 @@ Templates are located in the `templates` directory.
There are currently two supported templates:
- `page.gmi`: The template used for pages
- `directory.gmi`: The template used for directories
- `index.gmi`: The template used for directory index files
If `page.gmi` does not exist, page files will not be created.
If `directory.gmi` does not exist, directory index files will not be created.
If `index.gmi` does not exist, directory index files will not be created.
### Page templates
@ -98,16 +98,16 @@ Content:
This is some content.
```
### Directory templates
### Directory index templates
Directory templates are provided with the following information:
Directory index templates are provided with the following information:
- `Path`: Relative path to the directory
- `Permalink`: Permalink to the directory
- `Pages`: The pages in this directory
- `Directories`: The subdirectories of this directory
Directory templates are written to `index.gmi` in the corresponding directory.
Directory index templates are written to `index.gmi` in the corresponding directory.
Example:

View file

@ -81,7 +81,7 @@ func (s *Site) Manipulate(dir *Directory) error {
if dir.Index == nil {
path := filepath.Join(dir.Path, "index.gmi")
builder := &strings.Builder{}
tmpl := s.Templates.Lookup("directory.gmi")
tmpl := s.Templates.Lookup("index.gmi")
if err := tmpl.Execute(builder, dir); err != nil {
return err
}