fix(wiki): proper display names in tree #536
+23
-11
@@ -854,13 +854,17 @@ func buildWikiTree(commit *git.Commit) []*WikiTreeNode {
|
||||
IsDir: true,
|
||||
})
|
||||
} else if strings.HasSuffix(childName, ".md") {
|
||||
wpName := strings.TrimSuffix(childName, ".md")
|
||||
if wpName == "_Sidebar" || wpName == "_Footer" {
|
||||
wpChild, err := wiki_service.GitPathToWebPath(childName)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
_, childDisplay := wiki_service.WebPathToUserTitle(wpChild)
|
||||
if childDisplay == "_Sidebar" || childDisplay == "_Footer" {
|
||||
continue
|
||||
}
|
||||
node.Children = append(node.Children, &WikiTreeNode{
|
||||
Name: wpName,
|
||||
SubURL: name + "/" + wpName,
|
||||
Name: childDisplay,
|
||||
SubURL: name + "/" + string(wpChild),
|
||||
IsDir: false,
|
||||
})
|
||||
}
|
||||
@@ -869,13 +873,17 @@ func buildWikiTree(commit *git.Commit) []*WikiTreeNode {
|
||||
root[name] = node
|
||||
topLevel = append(topLevel, node)
|
||||
} else if strings.HasSuffix(name, ".md") {
|
||||
wpName := strings.TrimSuffix(name, ".md")
|
||||
if wpName == "_Sidebar" || wpName == "_Footer" {
|
||||
wpName, err := wiki_service.GitPathToWebPath(name)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
_, displayName := wiki_service.WebPathToUserTitle(wpName)
|
||||
if displayName == "_Sidebar" || displayName == "_Footer" {
|
||||
continue
|
||||
}
|
||||
node := &WikiTreeNode{
|
||||
Name: wpName,
|
||||
SubURL: wpName,
|
||||
Name: displayName,
|
||||
SubURL: string(wpName),
|
||||
IsDir: false,
|
||||
}
|
||||
topLevel = append(topLevel, node)
|
||||
@@ -908,12 +916,16 @@ func listWikiFolderEntries(commit *git.Commit, treePath string) []PageMeta {
|
||||
GitEntryName: name,
|
||||
})
|
||||
} else if strings.HasSuffix(name, ".md") {
|
||||
wpName := strings.TrimSuffix(name, ".md")
|
||||
if wpName == "_Sidebar" || wpName == "_Footer" {
|
||||
wpName, err := wiki_service.GitPathToWebPath(name)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
_, displayName := wiki_service.WebPathToUserTitle(wpName)
|
||||
if displayName == "_Sidebar" || displayName == "_Footer" {
|
||||
continue
|
||||
}
|
||||
pages = append(pages, PageMeta{
|
||||
Name: wpName,
|
||||
Name: displayName,
|
||||
SubURL: treePath + "/" + wpName,
|
||||
GitEntryName: name,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user