hugolib: Fix panic for unused taxonomy content files

In Hugo 0.55 we connected the taxonomy nodes with their owning Page.

This failed if you had, say, a content file for a author that did not author anything in the site:

```
content/authors/silent-persin/_index.md
```

Fixes #5847
This commit is contained in:
Bjørn Erik Pedersen
2019-04-15 09:38:14 +02:00
parent 701486728e
commit b799b12f4a
5 changed files with 52 additions and 17 deletions

View File

@@ -117,6 +117,9 @@ permalinkeds:
writeNewContentFile(t, fs.Source, "Category Terms", "2017-01-01", "content/categories/_index.md", 10)
writeNewContentFile(t, fs.Source, "Tag1 List", "2017-01-01", "content/tags/Tag1/_index.md", 10)
// https://github.com/gohugoio/hugo/issues/5847
writeNewContentFile(t, fs.Source, "Unused Tag List", "2018-01-01", "content/tags/not-used/_index.md", 10)
err := h.Build(BuildCfg{})
require.NoError(t, err)
@@ -159,7 +162,7 @@ permalinkeds:
// Make sure that each page.KindTaxonomyTerm page has an appropriate number
// of page.KindTaxonomy pages in its Pages slice.
taxonomyTermPageCounts := map[string]int{
"tags": 2,
"tags": 3,
"categories": 2,
"others": 2,
"empties": 0,