Merge branch 'dev' into feature/blog

THAT WAS PAINFUL!
This commit is contained in:
ari melody 2025-11-06 21:24:52 +00:00
commit 3e5ecb9372
Signed by: ari
GPG key ID: CF99829C92678188
99 changed files with 2029 additions and 1010 deletions

View file

@ -1,42 +1,45 @@
package templates
import (
"html/template"
"path/filepath"
_ "embed"
"html/template"
"strings"
)
var IndexTemplate = template.Must(template.ParseFiles(
filepath.Join("view", "layout.html"),
filepath.Join("view", "header.html"),
filepath.Join("view", "footer.html"),
filepath.Join("view", "prideflag.html"),
filepath.Join("view", "index.html"),
))
var MusicTemplate = template.Must(template.ParseFiles(
filepath.Join("view", "layout.html"),
filepath.Join("view", "header.html"),
filepath.Join("view", "footer.html"),
filepath.Join("view", "prideflag.html"),
filepath.Join("view", "music.html"),
))
var MusicGatewayTemplate = template.Must(template.ParseFiles(
filepath.Join("view", "layout.html"),
filepath.Join("view", "header.html"),
filepath.Join("view", "footer.html"),
filepath.Join("view", "prideflag.html"),
filepath.Join("view", "music-gateway.html"),
))
var BlogTemplate = template.Must(template.ParseFiles(
filepath.Join("view", "layout.html"),
filepath.Join("view", "header.html"),
filepath.Join("view", "footer.html"),
filepath.Join("view", "prideflag.html"),
filepath.Join("view", "blog.html"),
))
var BlogPostTemplate = template.Must(template.ParseFiles(
filepath.Join("view", "layout.html"),
filepath.Join("view", "header.html"),
filepath.Join("view", "footer.html"),
filepath.Join("view", "prideflag.html"),
filepath.Join("view", "blogpost.html"),
))
//go:embed "html/layout.html"
var layoutHTML string
//go:embed "html/header.html"
var headerHTML string
//go:embed "html/footer.html"
var footerHTML string
//go:embed "html/prideflag.html"
var prideflagHTML string
//go:embed "html/index.html"
var indexHTML string
//go:embed "html/music.html"
var musicHTML string
//go:embed "html/music-gateway.html"
var musicGatewayHTML string
// //go:embed "html/404.html"
// var error404HTML string
//go:embed "html/blog.html"
var blogHTML string
//go:embed "html/blogpost.html"
var blogPostHTML string
var BaseTemplate = template.Must(
template.New("base").Funcs(
template.FuncMap{
"add": func (a int, b int) int { return a + b },
},
).Parse(strings.Join([]string{
layoutHTML,
headerHTML,
footerHTML,
prideflagHTML,
}, "\n")))
var IndexTemplate = template.Must(template.Must(BaseTemplate.Clone()).Parse(indexHTML))
var MusicTemplate = template.Must(template.Must(BaseTemplate.Clone()).Parse(musicHTML))
var MusicGatewayTemplate = template.Must(template.Must(BaseTemplate.Clone()).Parse(musicGatewayHTML))
var BlogTemplate = template.Must(template.Must(BaseTemplate.Clone()).Parse(blogHTML))
var BlogPostTemplate = template.Must(template.Must(BaseTemplate.Clone()).Parse(blogPostHTML))