mirror of
https://github.com/jackyzha0/hugo-obsidian.git
synced 2024-06-14 11:42:35 +03:00
default title
This commit is contained in:
parent
55ee3ce9c7
commit
e45dd6c7c8
9
walk.go
9
walk.go
@ -60,10 +60,17 @@ func walk(root, ext string, index bool, ignorePaths map[string]struct{}) (res []
|
||||
info, _ := os.Stat(s)
|
||||
source := processSource(trim(s, root, ".md"))
|
||||
|
||||
// default title
|
||||
title := matter.Title
|
||||
if title == "" {
|
||||
fileName := d.Name()
|
||||
title = strings.TrimSuffix(filepath.Base(fileName), filepath.Ext(fileName))
|
||||
}
|
||||
|
||||
// add to content and link index
|
||||
i[source] = Content{
|
||||
LastModified: info.ModTime(),
|
||||
Title: matter.Title,
|
||||
Title: title,
|
||||
Content: body,
|
||||
}
|
||||
res = append(res, parse(s, root)...)
|
||||
|
Loading…
Reference in New Issue
Block a user