summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authornavanchauhan <navanchauhan@gmail.com>2022-10-17 23:58:36 -0600
committernavanchauhan <navanchauhan@gmail.com>2022-10-17 23:58:36 -0600
commit2003c8064e7e8209d765eaac4003c47a122c057f (patch)
tree8564ec4c706f9870708737b3efbd4de127756eea /main.go
parent01076278493fd722fc658e7d51b49267c9c37dff (diff)
embed templates
Diffstat (limited to 'main.go')
-rw-r--r--main.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/main.go b/main.go
index 11a96a7..2ac4046 100644
--- a/main.go
+++ b/main.go
@@ -12,6 +12,7 @@ import (
"github.com/joho/godotenv"
"github.com/meilisearch/meilisearch-go"
+ mytemplates "github.com/navanchauhan/dogeknows-go/templates"
)
var globalVariables = GlobalVars{
@@ -59,13 +60,13 @@ func main() {
}
// Classic UI Templates
- classicIndexTemplate := template.Must(template.ParseFiles("templates/search.gtpl"))
- searchResTemplate := template.Must(template.New("results.gtpl").Funcs(funcMap).ParseFiles("templates/results.gtpl"))
+ classicIndexTemplate := template.Must(template.ParseFS(mytemplates.Templates, "search.gtpl"))
+ searchResTemplate := template.Must(template.New("results.gtpl").Funcs(funcMap).ParseFS(mytemplates.Templates, "results.gtpl"))
// v2.0 UI Templates
- indexTemplate := template.Must(template.ParseFiles("templates/home.html", "templates/components/section.html", "templates/components/header.html"))
- searchResultsTemplate2 := template.Must(template.New("search_results.html").Funcs(funcMap).ParseFiles("templates/search_results.html", "templates/components/section.html", "templates/components/header.html"))
- documentDetailsTemplate2 := template.Must(template.New("document_details.html").Funcs(funcMap).ParseFiles("templates/document_details.html", "templates/components/section.html", "templates/components/header.html"))
+ indexTemplate := template.Must(template.ParseFS(mytemplates.Templates, "home.html", "components/section.html", "components/header.html"))
+ searchResultsTemplate2 := template.Must(template.New("search_results.html").Funcs(funcMap).ParseFS(mytemplates.Templates, "search_results.html", "components/section.html", "components/header.html"))
+ documentDetailsTemplate2 := template.Must(template.New("document_details.html").Funcs(funcMap).ParseFS(mytemplates.Templates, "document_details.html", "components/section.html", "components/header.html"))
index := client.Index("510k")