mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
77fc74a5b2
commit
52ea07d2eb
2 changed files with 44 additions and 3 deletions
|
@ -268,7 +268,10 @@ func (p *pageState) Pages() page.Pages {
|
||||||
case page.KindSection, page.KindHome:
|
case page.KindSection, page.KindHome:
|
||||||
pages = p.getPagesAndSections()
|
pages = p.getPagesAndSections()
|
||||||
case page.KindTerm:
|
case page.KindTerm:
|
||||||
pages = p.bucket.getTaxonomyEntries()
|
b := p.treeRef.n
|
||||||
|
viewInfo := b.viewInfo
|
||||||
|
taxonomy := p.s.Taxonomies()[viewInfo.name.plural].Get(viewInfo.termKey)
|
||||||
|
pages = taxonomy.Pages()
|
||||||
case page.KindTaxonomy:
|
case page.KindTaxonomy:
|
||||||
pages = p.bucket.getTaxonomies()
|
pages = p.bucket.getTaxonomies()
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -60,7 +60,6 @@ YAML frontmatter with tags and categories taxonomy.`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
func TestTaxonomiesWithAndWithoutContentFile(t *testing.T) {
|
func TestTaxonomiesWithAndWithoutContentFile(t *testing.T) {
|
||||||
for _, uglyURLs := range []bool{false, true} {
|
for _, uglyURLs := range []bool{false, true} {
|
||||||
uglyURLs := uglyURLs
|
uglyURLs := uglyURLs
|
||||||
|
@ -694,3 +693,42 @@ abcdefgs: {{ template "print-page" $abcdefgs }}|IsAncestor: {{ $abcdefgs.IsAnces
|
||||||
abcdefgs: /abcdefgs/|Abcdefgs|taxonomy|Parent: /|CurrentSection: /|FirstSection: /|IsAncestor: true|IsDescendant: false
|
abcdefgs: /abcdefgs/|Abcdefgs|taxonomy|Parent: /|CurrentSection: /|FirstSection: /|IsAncestor: true|IsDescendant: false
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestTaxonomiesWeightSort(t *testing.T) {
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- layouts/index.html --
|
||||||
|
{{ $a := site.GetPage "tags/a"}}
|
||||||
|
:{{ range $a.Pages }}{{ .RelPermalink }}|{{ end }}:
|
||||||
|
-- content/p1.md --
|
||||||
|
---
|
||||||
|
title: P1
|
||||||
|
weight: 100
|
||||||
|
tags: ['a']
|
||||||
|
tags_weight: 20
|
||||||
|
---
|
||||||
|
-- content/p3.md --
|
||||||
|
---
|
||||||
|
title: P2
|
||||||
|
weight: 200
|
||||||
|
tags: ['a']
|
||||||
|
tags_weight: 30
|
||||||
|
---
|
||||||
|
-- content/p2.md --
|
||||||
|
---
|
||||||
|
title: P3
|
||||||
|
weight: 50
|
||||||
|
tags: ['a']
|
||||||
|
tags_weight: 40
|
||||||
|
---
|
||||||
|
`
|
||||||
|
|
||||||
|
b := NewIntegrationTestBuilder(
|
||||||
|
IntegrationTestConfig{
|
||||||
|
T: t,
|
||||||
|
TxtarString: files,
|
||||||
|
},
|
||||||
|
).Build()
|
||||||
|
|
||||||
|
b.AssertFileContent("public/index.html", `:/p1/|/p3/|/p2/|:`)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue