mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
node to page: Use _index as identificator for the list nodes
Updates #2297
This commit is contained in:
parent
3ff25b37a3
commit
c175407fa4
2 changed files with 8 additions and 8 deletions
|
@ -372,11 +372,11 @@ func sectionsFromFilename(filename string) []string {
|
||||||
// TODO(bep) np node identificator
|
// TODO(bep) np node identificator
|
||||||
func nodeTypeFromFilename(filename string) NodeType {
|
func nodeTypeFromFilename(filename string) NodeType {
|
||||||
|
|
||||||
if !strings.Contains(filename, "_node") {
|
if !strings.Contains(filename, "_index") {
|
||||||
return NodePage
|
return NodePage
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(filename, "_node") {
|
if strings.HasPrefix(filename, "_index") {
|
||||||
return NodeHome
|
return NodeHome
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,37 +51,37 @@ func TestNodesAsPage(t *testing.T) {
|
||||||
|
|
||||||
writeLayoutsForNodeAsPageTests(t)
|
writeLayoutsForNodeAsPageTests(t)
|
||||||
|
|
||||||
writeSource(t, filepath.Join("content", "_node.md"), `---
|
writeSource(t, filepath.Join("content", "_index.md"), `---
|
||||||
title: Home Sweet Home!
|
title: Home Sweet Home!
|
||||||
---
|
---
|
||||||
Home **Content!**
|
Home **Content!**
|
||||||
`)
|
`)
|
||||||
|
|
||||||
writeSource(t, filepath.Join("content", "sect1", "_node.md"), `---
|
writeSource(t, filepath.Join("content", "sect1", "_index.md"), `---
|
||||||
title: Section1
|
title: Section1
|
||||||
---
|
---
|
||||||
Section1 **Content!**
|
Section1 **Content!**
|
||||||
`)
|
`)
|
||||||
|
|
||||||
writeSource(t, filepath.Join("content", "sect2", "_node.md"), `---
|
writeSource(t, filepath.Join("content", "sect2", "_index.md"), `---
|
||||||
title: Section2
|
title: Section2
|
||||||
---
|
---
|
||||||
Section2 **Content!**
|
Section2 **Content!**
|
||||||
`)
|
`)
|
||||||
|
|
||||||
writeSource(t, filepath.Join("content", "categories", "hugo", "_node.md"), `---
|
writeSource(t, filepath.Join("content", "categories", "hugo", "_index.md"), `---
|
||||||
title: Taxonomy Hugo
|
title: Taxonomy Hugo
|
||||||
---
|
---
|
||||||
Taxonomy Hugo **Content!**
|
Taxonomy Hugo **Content!**
|
||||||
`)
|
`)
|
||||||
|
|
||||||
writeSource(t, filepath.Join("content", "categories", "web", "_node.md"), `---
|
writeSource(t, filepath.Join("content", "categories", "web", "_index.md"), `---
|
||||||
title: Taxonomy Web
|
title: Taxonomy Web
|
||||||
---
|
---
|
||||||
Taxonomy Web **Content!**
|
Taxonomy Web **Content!**
|
||||||
`)
|
`)
|
||||||
|
|
||||||
writeSource(t, filepath.Join("content", "categories", "_node.md"), `---
|
writeSource(t, filepath.Join("content", "categories", "_index.md"), `---
|
||||||
title: Taxonomy Term Categories
|
title: Taxonomy Term Categories
|
||||||
---
|
---
|
||||||
Taxonomy Term Categories **Content!**
|
Taxonomy Term Categories **Content!**
|
||||||
|
|
Loading…
Reference in a new issue