Browse Source

added title in each blog post page

master
arnaucode 7 years ago
parent
commit
6639024ed0
3 changed files with 9 additions and 1 deletions
  1. +5
    -0
      README.md
  2. BIN
      blogo
  3. +4
    -1
      main.go

+ 5
- 0
README.md

@ -90,3 +90,8 @@ Types of blogo tags:
[blogo-content] [blogo-content]
[blogo-index-post-template] [blogo-index-post-template]
``` ```
---
Blogo is used in https://arnaucode.com/blog

BIN
blogo


+ 4
- 1
main.go

@ -43,8 +43,11 @@ func main() {
mdcontent := readFile(directory + "/" + post.Md) mdcontent := readFile(directory + "/" + post.Md)
htmlcontent := string(blackfriday.Run([]byte(mdcontent))) htmlcontent := string(blackfriday.Run([]byte(mdcontent)))
firstline := strings.Split(mdcontent, "\n")[0]
title := strings.Replace(firstline, "# ", "", -1)
m := make(map[string]string) m := make(map[string]string)
m["[blogo-title]"] = config.Title
m["[blogo-title]"] = title + " - " + config.Title
m["[blogo-content]"] = htmlcontent m["[blogo-content]"] = htmlcontent
r := putHTMLToTemplate(indexTemplate, m) r := putHTMLToTemplate(indexTemplate, m)

Loading…
Cancel
Save