From 11272c4a85876aaba2af29b8e8b22614f102bea3 Mon Sep 17 00:00:00 2001 From: Zeni Kim Date: Fri, 27 Sep 2024 02:31:45 -0500 Subject: [PATCH] add theme system --- main.go | 5 +++++ templates/sample.html | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 templates/sample.html diff --git a/main.go b/main.go index cc02e00..afbad2c 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ package main import ( + "embed" "log" "os" "path" @@ -18,6 +19,9 @@ import ( "github.com/julienschmidt/httprouter" ) +//go:embed all:templates +var resources embed.FS + // The main function func main() { app := core.New() @@ -43,6 +47,7 @@ func main() { app.SetGormConfig(config.GetGormConfig()) app.SetCacheConfig(config.GetCacheConfig()) app.Bootstrap() + app.RegisterTemplates(resources) registerGlobalHooks() registerRoutes() registerEvents() diff --git a/templates/sample.html b/templates/sample.html new file mode 100644 index 0000000..0ccd602 --- /dev/null +++ b/templates/sample.html @@ -0,0 +1,10 @@ + + + {{template "head" "Sample"}} + + {{template "title" .TheTitle}} +
+ Sample page! +
+ + \ No newline at end of file -- 2.39.2