add last modified

This commit is contained in:
Jacky Zhao 2021-12-27 16:58:21 -05:00
parent edb1bccae7
commit 9a48624656
3 changed files with 7 additions and 234 deletions

View File

@ -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

View File

@ -2,12 +2,12 @@ package main
import (
"flag"
"fmt"
"github.com/BurntSushi/toml"
wikilink "github.com/abhinav/goldmark-wikilink"
"github.com/yuin/goldmark"
"io/ioutil"
"path/filepath"
"time"
)
var md goldmark.Markdown
@ -33,6 +33,7 @@ type Index struct {
type Content struct {
Title string
Content string
LastModified time.Time
}
type ContentIndex = map[string]Content
@ -61,7 +62,6 @@ func getIgnoredFiles(base string) (res map[string]struct{}) {
}
}
fmt.Printf("%v\n", res)
return res
}

View File

@ -5,6 +5,7 @@ import (
"github.com/gernest/front"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"strings"
)
@ -24,6 +25,7 @@ func walk(root, ext string, index bool, ignorePaths map[string]struct{}) (res []
}
if _, ignored := ignorePaths[s]; ignored {
fmt.Printf("[Ignored] %s\n", d.Name())
nPrivate++
} else if filepath.Ext(d.Name()) == ext {
res = append(res, parse(s, root)...)
if index {
@ -44,12 +46,15 @@ func walk(root, ext string, index bool, ignorePaths map[string]struct{}) (res []
// check if page is private
if parsedPrivate, ok := frontmatter["draft"]; !ok || !parsedPrivate.(bool) {
info, _ := os.Stat(s)
adjustedPath := strings.Replace(hugoPathTrim(trim(s, root, ".md")), " ", "-", -1)
i[adjustedPath] = Content{
LastModified: info.ModTime(),
Title: title,
Content: body,
}
} else {
fmt.Printf("[Ignored] %s\n", d.Name())
nPrivate++
}
}