Przeglądaj źródła

Support setting a custom title

Lucas Stadler 9 lat temu
rodzic
commit
f2842411d2
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      go/blog/blog.go

+ 4 - 2
go/blog/blog.go

@ -28,6 +28,7 @@ var flags struct {
28 28
	writeBack bool
29 29
	reverse   bool
30 30
	css       string
31
	title     string
31 32
}
32 33
var dataPath string = "blog.yaml"
33 34
@ -51,6 +52,7 @@ func init() {
51 52
	flag.BoolVar(&flags.writeBack, "write-back", false, "Rewrite the YAML file with the generated ids")
52 53
	flag.BoolVar(&flags.reverse, "reverse", false, "Reverse the order of the articles in the file")
53 54
	flag.StringVar(&flags.css, "css", defaultStyle, "Custom styles to use")
55
	flag.StringVar(&flags.title, "title", "A blog", "Custom title to use")
54 56
}
55 57
56 58
func main() {
@ -80,12 +82,12 @@ func main() {
80 82
<html>
81 83
<head>
82 84
	<meta charset="utf-8" />
83
	<title>A blog</title>
85
	<title>%s</title>
84 86
	<style>%s</style>
85 87
</head>
86 88
87 89
<body>
88
`, flags.css)
90
`, flags.title, flags.css)
89 91
90 92
	if flags.reverse {
91 93
		l := len(posts)