Add OutsideArticle option
arnaucube root@arnaucube.com
Thu, 24 Nov 2022 16:12:32 +0100
5 files changed,
17 insertions(+),
9 deletions(-)
M
main.go
→
main.go
@@ -12,7 +12,7 @@ "github.com/gomarkdown/markdown"
"github.com/gomarkdown/markdown/parser" ) -const version = "v0_20220514" +const version = "v0_20221124" const directory = "blogo-input" const defaultOutputDir = "public"@@ -65,8 +65,12 @@ //put the htmlpostthumb in the blogo-index-post-template
m := make(map[string]string) m["[blogo-index-post-template]"] = string(htmlpostthumb) r := putHTMLToTemplate(indexPostTemplate, m) - filename := strings.Split(post.Md, ".")[0] - r = "<a href='" + config.RelativePath + "/" + filename + ".html'>" + r + "</a>" + if post.OutsideArticle != "" { + r = "<a href='" + post.OutsideArticle + "'>" + r + "</a>" + } else { + filename := strings.Split(post.Md, ".")[0] + r = "<a href='" + config.RelativePath + "/" + filename + ".html'>" + r + "</a>" + } blogoIndex = blogoIndex + r } //put the blogoIndex in the index.html@@ -82,6 +86,9 @@
// generate posts pages for _, post := range config.Posts { + if post.OutsideArticle != "" { + continue + } mdcontent := readFile(directory + "/" + config.PostsDir + post.Md) mdParser := parser.NewWithExtensions(mdExtensions) htmlcontent := markdown.ToHTML([]byte(mdcontent), mdParser, nil)
M
readConfig.go
→
readConfig.go
@@ -5,15 +5,16 @@ "encoding/json"
"io/ioutil" ) -//Post is the struct for each post of the blog +// Post is the struct for each post of the blog type Post struct { - Thumb string `json:"thumb"` - Md string `json:"md"` - MetaImg string `json:"metaimg"` - MetaDescr string `json:"metadescr"` + Thumb string `json:"thumb"` + Md string `json:"md"` + MetaImg string `json:"metaimg"` + MetaDescr string `json:"metadescr"` + OutsideArticle string `json:"outsideArticle"` } -//Config gets the config.json file into struct +// Config gets the config.json file into struct type Config struct { Title string `json:"title"` MetaImg string `json:"metaimg"`