mirror of
https://github.com/jackyzha0/hugo-obsidian.git
synced 2024-06-14 11:42:35 +03:00
add last modified
This commit is contained in:
parent
edb1bccae7
commit
9a48624656
232
linkIndex.yaml
232
linkIndex.yaml
@ -1,232 +0,0 @@
|
|||||||
# THIS FILE WAS GENERATED USING github.com/jackyzha0/hugo-obsidian
|
|
||||||
# DO NOT EDIT
|
|
||||||
index:
|
|
||||||
links:
|
|
||||||
/:
|
|
||||||
- source: /
|
|
||||||
target: /notes/setup
|
|
||||||
text: Setup your own digital garden using Quartz
|
|
||||||
- source: /
|
|
||||||
target: /moc/showcase
|
|
||||||
text: community digital gardens
|
|
||||||
- source: /
|
|
||||||
target: /notes/philosophy
|
|
||||||
text: why I made Quartz
|
|
||||||
- source: /
|
|
||||||
target: /notes
|
|
||||||
text: All Notes
|
|
||||||
- source: /
|
|
||||||
target: /tags/setup
|
|
||||||
text: Setup-related Notes
|
|
||||||
- source: /
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: Troubleshooting and FAQ
|
|
||||||
/notes/Obsidian:
|
|
||||||
- source: /notes/Obsidian
|
|
||||||
target: /notes/setup
|
|
||||||
text: setup
|
|
||||||
/notes/config:
|
|
||||||
- source: /notes/config
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
/notes/editing:
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/ignore-notes
|
|
||||||
text: Excluding pages from being published
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/preview-changes
|
|
||||||
text: Preview Quartz Changes
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/hosting
|
|
||||||
text: Hosting Quartz online!
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
/notes/hosting:
|
|
||||||
- source: /notes/hosting
|
|
||||||
target: /notes/config
|
|
||||||
text: Customizing Quartz
|
|
||||||
- source: /notes/hosting
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
/notes/setup:
|
|
||||||
- source: /notes/setup
|
|
||||||
target: /notes/editing
|
|
||||||
text: Editing Notes in Quartz
|
|
||||||
- source: /notes/setup
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
/notes/troubleshooting:
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/ignore-notes
|
|
||||||
text: excluding pages from being published
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/hosting
|
|
||||||
text: hosting
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/Obsidian
|
|
||||||
text: Obsidian
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/editing
|
|
||||||
text: the 'how to edit' guide
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/hosting
|
|
||||||
text: the hosting guide
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/config
|
|
||||||
text: customization guide
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/editing
|
|
||||||
text: local editing
|
|
||||||
backlinks:
|
|
||||||
/moc/showcase:
|
|
||||||
- source: /
|
|
||||||
target: /moc/showcase
|
|
||||||
text: community digital gardens
|
|
||||||
/notes:
|
|
||||||
- source: /
|
|
||||||
target: /notes
|
|
||||||
text: All Notes
|
|
||||||
/notes/Obsidian:
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/Obsidian
|
|
||||||
text: Obsidian
|
|
||||||
/notes/config:
|
|
||||||
- source: /notes/hosting
|
|
||||||
target: /notes/config
|
|
||||||
text: Customizing Quartz
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/config
|
|
||||||
text: customization guide
|
|
||||||
/notes/editing:
|
|
||||||
- source: /notes/setup
|
|
||||||
target: /notes/editing
|
|
||||||
text: Editing Notes in Quartz
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/editing
|
|
||||||
text: the 'how to edit' guide
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/editing
|
|
||||||
text: local editing
|
|
||||||
/notes/hosting:
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/hosting
|
|
||||||
text: Hosting Quartz online!
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/hosting
|
|
||||||
text: hosting
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/hosting
|
|
||||||
text: the hosting guide
|
|
||||||
/notes/ignore-notes:
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/ignore-notes
|
|
||||||
text: Excluding pages from being published
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/ignore-notes
|
|
||||||
text: excluding pages from being published
|
|
||||||
/notes/philosophy:
|
|
||||||
- source: /
|
|
||||||
target: /notes/philosophy
|
|
||||||
text: why I made Quartz
|
|
||||||
/notes/preview-changes:
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/preview-changes
|
|
||||||
text: Preview Quartz Changes
|
|
||||||
/notes/setup:
|
|
||||||
- source: /
|
|
||||||
target: /notes/setup
|
|
||||||
text: Setup your own digital garden using Quartz
|
|
||||||
- source: /notes/Obsidian
|
|
||||||
target: /notes/setup
|
|
||||||
text: setup
|
|
||||||
/notes/troubleshooting:
|
|
||||||
- source: /
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: Troubleshooting and FAQ
|
|
||||||
- source: /notes/config
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
- source: /notes/hosting
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
- source: /notes/setup
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
/tags/setup:
|
|
||||||
- source: /
|
|
||||||
target: /tags/setup
|
|
||||||
text: Setup-related Notes
|
|
||||||
links:
|
|
||||||
- source: /
|
|
||||||
target: /notes/setup
|
|
||||||
text: Setup your own digital garden using Quartz
|
|
||||||
- source: /
|
|
||||||
target: /moc/showcase
|
|
||||||
text: community digital gardens
|
|
||||||
- source: /
|
|
||||||
target: /notes/philosophy
|
|
||||||
text: why I made Quartz
|
|
||||||
- source: /
|
|
||||||
target: /notes
|
|
||||||
text: All Notes
|
|
||||||
- source: /
|
|
||||||
target: /tags/setup
|
|
||||||
text: Setup-related Notes
|
|
||||||
- source: /
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: Troubleshooting and FAQ
|
|
||||||
- source: /notes/Obsidian
|
|
||||||
target: /notes/setup
|
|
||||||
text: setup
|
|
||||||
- source: /notes/config
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/ignore-notes
|
|
||||||
text: Excluding pages from being published
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/preview-changes
|
|
||||||
text: Preview Quartz Changes
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/hosting
|
|
||||||
text: Hosting Quartz online!
|
|
||||||
- source: /notes/editing
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
- source: /notes/hosting
|
|
||||||
target: /notes/config
|
|
||||||
text: Customizing Quartz
|
|
||||||
- source: /notes/hosting
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
- source: /notes/setup
|
|
||||||
target: /notes/editing
|
|
||||||
text: Editing Notes in Quartz
|
|
||||||
- source: /notes/setup
|
|
||||||
target: /notes/troubleshooting
|
|
||||||
text: FAQ and Troubleshooting guide
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/ignore-notes
|
|
||||||
text: excluding pages from being published
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/hosting
|
|
||||||
text: hosting
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/Obsidian
|
|
||||||
text: Obsidian
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/editing
|
|
||||||
text: the 'how to edit' guide
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/hosting
|
|
||||||
text: the hosting guide
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/config
|
|
||||||
text: customization guide
|
|
||||||
- source: /notes/troubleshooting
|
|
||||||
target: /notes/editing
|
|
||||||
text: local editing
|
|
4
main.go
4
main.go
@ -2,12 +2,12 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
wikilink "github.com/abhinav/goldmark-wikilink"
|
wikilink "github.com/abhinav/goldmark-wikilink"
|
||||||
"github.com/yuin/goldmark"
|
"github.com/yuin/goldmark"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var md goldmark.Markdown
|
var md goldmark.Markdown
|
||||||
@ -33,6 +33,7 @@ type Index struct {
|
|||||||
type Content struct {
|
type Content struct {
|
||||||
Title string
|
Title string
|
||||||
Content string
|
Content string
|
||||||
|
LastModified time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
type ContentIndex = map[string]Content
|
type ContentIndex = map[string]Content
|
||||||
@ -61,7 +62,6 @@ func getIgnoredFiles(base string) (res map[string]struct{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("%v\n", res)
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
walk.go
5
walk.go
@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/gernest/front"
|
"github.com/gernest/front"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -24,6 +25,7 @@ func walk(root, ext string, index bool, ignorePaths map[string]struct{}) (res []
|
|||||||
}
|
}
|
||||||
if _, ignored := ignorePaths[s]; ignored {
|
if _, ignored := ignorePaths[s]; ignored {
|
||||||
fmt.Printf("[Ignored] %s\n", d.Name())
|
fmt.Printf("[Ignored] %s\n", d.Name())
|
||||||
|
nPrivate++
|
||||||
} else if filepath.Ext(d.Name()) == ext {
|
} else if filepath.Ext(d.Name()) == ext {
|
||||||
res = append(res, parse(s, root)...)
|
res = append(res, parse(s, root)...)
|
||||||
if index {
|
if index {
|
||||||
@ -44,12 +46,15 @@ func walk(root, ext string, index bool, ignorePaths map[string]struct{}) (res []
|
|||||||
|
|
||||||
// check if page is private
|
// check if page is private
|
||||||
if parsedPrivate, ok := frontmatter["draft"]; !ok || !parsedPrivate.(bool) {
|
if parsedPrivate, ok := frontmatter["draft"]; !ok || !parsedPrivate.(bool) {
|
||||||
|
info, _ := os.Stat(s)
|
||||||
adjustedPath := strings.Replace(hugoPathTrim(trim(s, root, ".md")), " ", "-", -1)
|
adjustedPath := strings.Replace(hugoPathTrim(trim(s, root, ".md")), " ", "-", -1)
|
||||||
i[adjustedPath] = Content{
|
i[adjustedPath] = Content{
|
||||||
|
LastModified: info.ModTime(),
|
||||||
Title: title,
|
Title: title,
|
||||||
Content: body,
|
Content: body,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
fmt.Printf("[Ignored] %s\n", d.Name())
|
||||||
nPrivate++
|
nPrivate++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user