diff options
| author | Mitja Felicijan <m@mitjafelicijan.com> | 2023-07-12 18:33:04 +0200 |
|---|---|---|
| committer | Mitja Felicijan <m@mitjafelicijan.com> | 2023-07-12 18:33:04 +0200 |
| commit | 452d86ad1af61af7475914f3afcb5dfb2945e4c7 (patch) | |
| tree | a2ed739ebbdea5b51e8fbfb85426a0cea8123389 /main.go | |
| parent | 318e10ff609757b3e5676eb2caf4903bdb1b9cbc (diff) | |
| download | jbmafp-452d86ad1af61af7475914f3afcb5dfb2945e4c7.tar.gz | |
Added ability to put content markdown files in sub folders
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -144,9 +144,22 @@ func buildProject(projectRoot string) { } // Gets the list of all markdown files. - files, err := filepath.Glob(path.Join(projectRoot, "content/*.md")) + var files []string + err = filepath.Walk(path.Join(projectRoot, "content/"), func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + if !info.IsDir() && strings.ToLower(filepath.Ext(path)) == ".md" { + files = append(files, path) + } + + return nil + }) + if err != nil { - panic(err) + fmt.Printf("No markdown files found with error `%s`.\n", err) + os.Exit(1) } md := goldmark.New( |
