diff options
| author | a73x <[email protected]> | 2024-09-08 18:55:40 +0100 |
|---|---|---|
| committer | a73x <[email protected]> | 2024-09-08 18:55:40 +0100 |
| commit | 71995ed10e69c4675e9fda50d43f3523af48d86c (patch) | |
| tree | dcce1ec17b5630b6f0c4031ac7815add9905682a | |
| parent | 933ef3568992802a565d2e6a8d1c7fb231139663 (diff) | |
chore(template): refactor how paths are made
| -rw-r--r-- | markdown/markdown.go | 8 | ||||
| -rw-r--r-- | pages/pages.go | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/markdown/markdown.go b/markdown/markdown.go index 1a529f6..cc2abf1 100644 --- a/markdown/markdown.go +++ b/markdown/markdown.go @@ -60,11 +60,13 @@ func parseMarkdownFile(embedded fs.FS, path string) (Content, error) { if err != nil { return Content{}, fmt.Errorf("failed to parse frontmatter: %v", err) } - path = "/" + strings.Replace(path, ".md", "", 1) - if path == "/index" { - path = "/" + path = strings.Replace(path, ".md", "", 1) + if path == "index" { + path = "" } + path = "/" + path + mc := Content{ Body: string(rest), Path: path, diff --git a/pages/pages.go b/pages/pages.go index 610444c..8adb9e1 100644 --- a/pages/pages.go +++ b/pages/pages.go @@ -96,6 +96,7 @@ func Collect() ([]Page, error) { } sortNavBar(gs.Nav) + pages := []Page{} for _, content := range contents { page, err := renderTemplate(gs, content) |
