diff options
| author | Fuwn <[email protected]> | 2021-07-19 19:14:25 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-07-19 19:14:25 +0000 |
| commit | 2095e1da14b3e6570d6cb2f1c93e1ba025e1635f (patch) | |
| tree | 2454aae601c7baa7e6d5a649e7ee55d5854845c5 | |
| parent | feat(blog): sort blog by article creation dates (diff) | |
| download | space-2095e1da14b3e6570d6cb2f1c93e1ba025e1635f.tar.xz space-2095e1da14b3e6570d6cb2f1c93e1ba025e1635f.zip | |
feat(route): blog description files
| -rw-r--r-- | content/pages/blog/tech/description.gmi | 1 | ||||
| -rw-r--r-- | route.go | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/content/pages/blog/tech/description.gmi b/content/pages/blog/tech/description.gmi new file mode 100644 index 0000000..af8383b --- /dev/null +++ b/content/pages/blog/tech/description.gmi @@ -0,0 +1 @@ +Currently for testing @@ -78,7 +78,9 @@ func createBlogRoute(baseRoute string, postPath string, name string) { contents, _ := contentFilesystem.ReadDir("content/" + postPath) - files := fmt.Sprintf("# %s (%d)\n\n", strings.ToUpper(name), len(contents)) + files := fmt.Sprintf("# %s (%d)\n\n", strings.ToUpper(name), len(contents)-1) + + var description string // Reverse contents so that the oldest file is at the bottom // @@ -89,6 +91,12 @@ func createBlogRoute(baseRoute string, postPath string, name string) { // Could be useful later: // https://golangcode.com/sorting-an-array-of-numeric-items/ for _, file := range contents { + if file.Name() == "description.gmi" { + description = GetContent("pages" + baseRoute + "/" + file.Name()) + files += description + "\n" + continue + } + // Temporary, until it causes problems... fileNameNoExt := strings.ReplaceAll(file.Name(), ".gmi", "") @@ -102,6 +110,7 @@ func createBlogRoute(baseRoute string, postPath string, name string) { ) createRoute(baseRoute+"/"+fileNameNoExt, "default.gmi", "pages"+baseRoute+"/"+file.Name()) } + files = utilities.TrimLastChar(files) blogs[baseRoute] = name |