diff --git a/.gitignore b/.gitignore index 4c5f206..63a7890 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .claude/ +wiki/ diff --git a/assets/page.html b/assets/page.html new file mode 100644 index 0000000..2879bde --- /dev/null +++ b/assets/page.html @@ -0,0 +1,47 @@ + + + + + + {{.Title}} + + + +
+ + {{if .CanEdit}}EDIT{{end}} +
+
+ {{if .EditMode}} +
+ +
+ + Cancel +
+
+ {{else}} {{if .Content}} +
{{.Content}}
+ {{end}} {{if .Entries}} +
+
Contents
+ {{range .Entries}} +
+ {{.Icon}} + {{.Name}} + {{.Meta}} +
+ {{end}} +
+ {{else if not .Content}} +

+ Empty folder — create index.md +

+ {{end}} {{end}} +
+ + diff --git a/main.go b/main.go index 4dc8cd5..8362056 100644 --- a/main.go +++ b/main.go @@ -30,49 +30,7 @@ var md = goldmark.New( goldmark.WithRendererOptions(html.WithUnsafe()), ) -var tmpl = template.Must(template.New("").Parse(` - - - - -{{.Title}} — datascape - - - -
- - {{if .CanEdit}}EDIT{{end}} -
-
-{{if .EditMode}} -
- -
- - Cancel -
-
-{{else}} -{{if .Content}}
{{.Content}}
{{end}} -{{if .Entries}} -
-
Contents
- {{range .Entries}} -
- {{.Icon}} - {{.Name}} - {{.Meta}} -
- {{end}} -
-{{else if not .Content}}

Empty folder — create index.md

{{end}} -{{end}} -
- -`)) +var tmpl = template.Must(template.New("page.html").ParseFS(assets, "assets/page.html")) type crumb struct{ Name, URL string } type entry struct{ Icon, Name, URL, Meta string } @@ -301,7 +259,7 @@ func buildCrumbs(urlPath string) []crumb { func pageTitle(urlPath string) string { if urlPath == "/" { - return "home" + return "Datascape" } parts := strings.Split(strings.Trim(urlPath, "/"), "/") return parts[len(parts)-1]