arnaucube
arnaucube/blogoPublic Self-hosted repository
add output dir
arnaucube root@arnaucube.com
Tue, 21 Jan 2020 12:06:47 +0100
commit

e38e98ce0fa3e2796884e810fdc353bab91f99cf

parent

3eb32c8258aa4d385fcab2501ca8eb3d17711123

5 files changed, 34 insertions(+), 6 deletions(-)

jump to
M README.md → README.md

@@ -1,4 +1,4 @@

-# Blogo [![Go Report Card](https://goreportcard.com/badge/github.com/arnaucode/blogo)](https://goreportcard.com/report/github.com/arnaucode/blogo) +# Blogo [![Go Report Card](https://goreportcard.com/badge/github.com/arnaucube/blogo)](https://goreportcard.com/report/github.com/arnaucube/blogo) Static blog generator, templating engine from markdown and html templates ![blogo](https://raw.githubusercontent.com/arnaucube/blogo/master/blogo.png "blogo")

@@ -9,4 +9,4 @@

--- -Blogo is used in https://arnaucode.com/blog +Blogo is used in https://arnaucube.com/blog
A go.mod

@@ -0,0 +1,9 @@

+module github.com/arnaucube/blogo + +go 1.12 + +require ( + github.com/fatih/color v1.9.0 + github.com/russross/blackfriday v2.0.0+incompatible + github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect +)
A go.sum

@@ -0,0 +1,14 @@

+github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/russross/blackfriday v2.0.0+incompatible h1:cBXrhZNUf9C+La9/YpS+UHpUT8YD6Td9ZMSU9APFcsk= +github.com/russross/blackfriday v2.0.0+incompatible/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
M main.go → main.go

@@ -2,16 +2,21 @@ package main

import ( "fmt" + "os" "strings" - blackfriday "gopkg.in/russross/blackfriday.v2" + // blackfriday "gopkg.in/russross/blackfriday.v2" + "github.com/russross/blackfriday" ) const directory = "blogo-input" +const outputDir = "public" func main() { readConfig(directory + "/blogo.json") fmt.Println(config) + + _ = os.Mkdir(outputDir, os.ModePerm) // generate index page indexTemplate := readFile(directory + "/" + config.IndexTemplate)

@@ -35,7 +40,7 @@ m := make(map[string]string)

m["[blogo-title]"] = config.Title m["[blogo-content]"] = blogoIndex r := putHTMLToTemplate(indexTemplate, m) - writeFile("index.html", r) + writeFile(outputDir+"/"+"index.html", r) // generate posts pages

@@ -54,13 +59,13 @@ r := putHTMLToTemplate(indexTemplate, m)

//fmt.Println(r) filename := strings.Split(post.Md, ".")[0] - writeFile(filename+".html", r) + writeFile(outputDir+"/"+filename+".html", r) } //copy raw fmt.Println("copying raw:") for _, dir := range config.CopyRaw { - copyRaw(directory+"/"+dir, ".") + copyRaw(directory+"/"+dir, outputDir+"/") } }