Compare commits
2 Commits
53eb272070
...
8eeb02eafa
Author | SHA1 | Date |
---|---|---|
Nico | 8eeb02eafa | |
Nico | 593a8410ec |
18
main.go
18
main.go
|
@ -16,7 +16,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO replace these hardcoded paths with config
|
// TODO replace these hardcoded paths with config
|
||||||
var root string = "home/nico/website/wiki"
|
var root string = "/home/nico/website/wiki"
|
||||||
var geminiPrefix string = "gemini://breadpunk.club/~bagel"
|
var geminiPrefix string = "gemini://breadpunk.club/~bagel"
|
||||||
var htmlPrefix string = "https://itwont.work"
|
var htmlPrefix string = "https://itwont.work"
|
||||||
var geminiOutputDir string = filepath.Join(root, "public_gemini")
|
var geminiOutputDir string = filepath.Join(root, "public_gemini")
|
||||||
|
@ -364,24 +364,24 @@ func main() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
f, err := os.Create(filepath.Join(geminiOutputDir, "index.gmi"))
|
f, err := os.Create(filepath.Join(geminiOutputDir, "_tags/_tags.gmi"))
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
err = templates.ExecuteTemplate(f, "index.gmi", tagData)
|
err = templates.ExecuteTemplate(f, "_tags.gmi", tagData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
f.Sync()
|
f.Sync()
|
||||||
|
|
||||||
// Write out HTML index page
|
// Write out HTML _tags page
|
||||||
hf, err := os.Create(filepath.Join(htmlOutputDir, "index.html"))
|
hf, err := os.Create(filepath.Join(htmlOutputDir, "_tags.html"))
|
||||||
defer hf.Close()
|
defer hf.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
err = templates.ExecuteTemplate(hf, "index.html", tagData)
|
err = templates.ExecuteTemplate(hf, "_tags.html", tagData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ func main() {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write Feeds
|
// Write Feeds
|
||||||
gemFeed := &feeds.Feed{
|
gemFeed := &feeds.Feed{
|
||||||
Title: feed.Title,
|
Title: feed.Title,
|
||||||
|
@ -465,11 +465,11 @@ func main() {
|
||||||
err = ioutil.WriteFile(tagFile, j, 0644)
|
err = ioutil.WriteFile(tagFile, j, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
j, err = json.Marshal(feed)
|
j, err = json.Marshal(feed)
|
||||||
err = ioutil.WriteFile(feedFile, j, 0644)
|
err = ioutil.WriteFile(feedFile, j, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue