data in header
This commit is contained in:
parent
35561aa97f
commit
849e8a945e
@ -2,6 +2,9 @@
|
|||||||
Meta:
|
Meta:
|
||||||
Title: Home
|
Title: Home
|
||||||
|
|
||||||
|
Data:
|
||||||
|
Image: /schönes_Bild.jpg
|
||||||
|
Subtitle: und Weiteres
|
||||||
---
|
---
|
||||||
|
|
||||||
# Home
|
# Home
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
<html>
|
<html>
|
||||||
<meta>
|
<meta>
|
||||||
<title>{{ Meta.Title }}</title>
|
<title>{{ Meta.Title }}</title>
|
||||||
|
<meta name="description" content="{{ Meta.Description }}" />
|
||||||
|
<meta name="keywords" content="{{ Meta.Keywords }}" />
|
||||||
</meta>
|
</meta>
|
||||||
<body>
|
<body>
|
||||||
{{{ Body }}}
|
{{{ Body }}}
|
||||||
|
<pre>
|
||||||
|
|
||||||
|
{{{ Data }}}
|
||||||
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
18
main.go
18
main.go
@ -10,7 +10,6 @@ import (
|
|||||||
|
|
||||||
"github.com/aymerick/raymond"
|
"github.com/aymerick/raymond"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/imdario/mergo"
|
|
||||||
"github.com/op/go-logging"
|
"github.com/op/go-logging"
|
||||||
"gopkg.in/russross/blackfriday.v2"
|
"gopkg.in/russross/blackfriday.v2"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
@ -68,6 +67,8 @@ type PathConfig struct {
|
|||||||
Ignore *string `yaml:"Ignore"`
|
Ignore *string `yaml:"Ignore"`
|
||||||
OutputExtension *string `yaml:"OutputExtension"`
|
OutputExtension *string `yaml:"OutputExtension"`
|
||||||
} `yaml:"Filename"`
|
} `yaml:"Filename"`
|
||||||
|
|
||||||
|
Data interface{} `yaml:"Data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PathConfigTree is complete config tree of content dir
|
// PathConfigTree is complete config tree of content dir
|
||||||
@ -325,9 +326,10 @@ func processContent(conf *PathConfigTree) {
|
|||||||
|
|
||||||
// read yaml header as data for template
|
// read yaml header as data for template
|
||||||
ctx := make(map[string]interface{})
|
ctx := make(map[string]interface{})
|
||||||
mergo.Map(&ctx, newConfig)
|
ctx["Meta"] = newConfig.Meta
|
||||||
|
ctx["Data"] = newConfig.Data
|
||||||
ctx["Body"] = string(html)
|
ctx["Body"] = string(html)
|
||||||
//log.Warning(spew.Sdump(ctx))
|
log.Warning(spew.Sdump(ctx))
|
||||||
|
|
||||||
result, err := template.Exec(ctx)
|
result, err := template.Exec(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -466,14 +468,4 @@ func main() {
|
|||||||
|
|
||||||
processContent(contentConfig)
|
processContent(contentConfig)
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
input, err := ioutil.ReadFile("README.md")
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
//html := blackfriday.Run(input, blackfriday.WithRenderer(bfchroma.NewRenderer()))
|
|
||||||
html := blackfriday.Run(input)
|
|
||||||
fmt.Println(string(html))
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user