updates
Some checks failed
build / build (push) Failing after 0s

This commit is contained in:
Tijl 2024-08-20 11:49:05 +02:00
parent b354e78bfa
commit 4c640fb3b3
Signed by: tijl
GPG Key ID: DAE24BFCD722F053
18 changed files with 103 additions and 75 deletions

View File

@ -2,8 +2,8 @@ root = "."
tmp_dir = ".air-tmp" tmp_dir = ".air-tmp"
[build] [build]
bin = "./.air-tmp/main" bin = "./tijl.dev"
cmd = "just build && go build -o ./.air-tmp/main cmd/server/main.go" cmd = "just build"
delay = 1000 delay = 1000
exclude_dir = ["node_modules"] exclude_dir = ["node_modules"]
exclude_unchanged = false exclude_unchanged = false

View File

@ -15,17 +15,17 @@ jobs:
with: with:
github-server-url: 'https://git.tijl.dev' github-server-url: 'https://git.tijl.dev'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Build css - name: Build css
run: npm run build:css run: npm run build:css
- name: Build js - name: Build js
run: npm run build run: npm run build
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Build - name: Build
run: go build -v ./... run: go build -v ./...

View File

@ -1,11 +1,16 @@
package main package main
import ( import (
"html/template"
"log" "log"
"net/http"
"git.tijl.dev/tijl/tijl.dev/internal/assets" "git.tijl.dev/tijl/tijl.dev/internal/assets"
"git.tijl.dev/tijl/tijl.dev/internal/i18n" "git.tijl.dev/tijl/tijl.dev/internal/i18n"
"git.tijl.dev/tijl/tijl.dev/static"
"git.tijl.dev/tijl/tijl.dev/views"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/filesystem"
"github.com/gofiber/template/html/v2" "github.com/gofiber/template/html/v2"
) )
@ -13,20 +18,30 @@ func main() {
assets.LoadSVGs() assets.LoadSVGs()
i18n.LoadTranslations() i18n.LoadTranslations()
engine := html.New("/home/tijl/projects/tijldev-next/web", ".html") engine := html.NewFileSystem(http.FS(views.Embed), ".html")
engine.AddFunc("icon", assets.Svg) engine.AddFunc("icon", assets.Svg)
engine.AddFunc("translate", i18n.TranslateFunc())
// Todo better language system
engine.AddFunc("translate", func(key string) template.HTML {
translations := i18n.GetTranslations()["en"] // for now we just fix it to english
if translation, ok := translations[key]; ok {
return template.HTML(translation)
}
return ""
})
app := fiber.New(fiber.Config{ app := fiber.New(fiber.Config{
Views: engine, Views: engine,
}) })
app.Get("/", func(c *fiber.Ctx) error { app.Get("/", func(c *fiber.Ctx) error {
return c.Render("pages/index", fiber.Map{}) return c.Render("index", fiber.Map{})
}) })
app.Static("/static", "./static") app.Use("/static", filesystem.New(filesystem.Config{
Root: http.FS(static.Embed),
}))
log.Fatal(app.Listen(":3000")) log.Fatal(app.Listen(":3000"))
} }

15
go.mod
View File

@ -3,22 +3,27 @@ module git.tijl.dev/tijl/tijl.dev
go 1.22.5 go 1.22.5
require ( require (
github.com/gofiber/embed v0.1.2
github.com/gofiber/fiber/v2 v2.52.5 github.com/gofiber/fiber/v2 v2.52.5
github.com/gofiber/fiber/v3 v3.0.0-beta.3
github.com/gofiber/template/html/v2 v2.1.2 github.com/gofiber/template/html/v2 v2.1.2
) )
require ( require (
github.com/andybalholm/brotli v1.0.5 // indirect github.com/andybalholm/brotli v1.1.0 // indirect
github.com/gofiber/fiber v1.13.3 // indirect
github.com/gofiber/template v1.8.3 // indirect github.com/gofiber/template v1.8.3 // indirect
github.com/gofiber/utils v1.1.0 // indirect github.com/gofiber/utils v1.1.0 // indirect
github.com/google/uuid v1.5.0 // indirect github.com/gofiber/utils/v2 v2.0.0-beta.4 // indirect
github.com/klauspost/compress v1.17.0 // indirect github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/schema v1.1.0 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/rivo/uniseg v0.2.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect github.com/valyala/fasthttp v1.55.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect
golang.org/x/sys v0.15.0 // indirect golang.org/x/sys v0.21.0 // indirect
) )

45
go.sum
View File

@ -1,21 +1,36 @@
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gofiber/embed v0.1.2 h1:nWzY3j37ACXfxo1SAYQ6X2yn20wAi/H6fU2ppAQQpZk=
github.com/gofiber/embed v0.1.2/go.mod h1:TLJmk/4uU1+rqtrqln6gMM4dJSvDd0D7RyqHkeEdxIc=
github.com/gofiber/fiber v1.13.3 h1:14kBTW1+n5mNIJZqibsbIdb+yQdC5argcbe9vE7Nz+o=
github.com/gofiber/fiber v1.13.3/go.mod h1:KxRvVkqzfZOO6A7mBu+j7ncX2AcT6Sm6F7oeGR3Kgmw=
github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo= github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo=
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
github.com/gofiber/fiber/v3 v3.0.0-beta.3 h1:7Q2I+HsIqnIEEDB+9oe7Gadpakh6ZLhXpTYz/L20vrg=
github.com/gofiber/fiber/v3 v3.0.0-beta.3/go.mod h1:kcMur0Dxqk91R7p4vxEpJfDWZ9u5IfvrtQc8Bvv/JmY=
github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc= github.com/gofiber/template v1.8.3 h1:hzHdvMwMo/T2kouz2pPCA0zGiLCeMnoGsQZBTSYgZxc=
github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8= github.com/gofiber/template v1.8.3/go.mod h1:bs/2n0pSNPOkRa5VJ8zTIvedcI/lEYxzV3+YPXdBvq8=
github.com/gofiber/template/html/v2 v2.1.2 h1:wkK/mYJ3nIhongTkG3t0QgV4ADdgOYJYVSAF2AHnh8Y= github.com/gofiber/template/html/v2 v2.1.2 h1:wkK/mYJ3nIhongTkG3t0QgV4ADdgOYJYVSAF2AHnh8Y=
github.com/gofiber/template/html/v2 v2.1.2/go.mod h1:E98Z/FzvpaSib06aWEgYk6GXNf3ctoyaJH8yW5ay5ak= github.com/gofiber/template/html/v2 v2.1.2/go.mod h1:E98Z/FzvpaSib06aWEgYk6GXNf3ctoyaJH8yW5ay5ak=
github.com/gofiber/utils v0.0.9/go.mod h1:9J5aHFUIjq0XfknT4+hdSMG6/jzfaAgCu4HEbWDeBlo=
github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM= github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM=
github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0= github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= github.com/gofiber/utils/v2 v2.0.0-beta.4 h1:1gjbVFFwVwUb9arPcqiB6iEjHBwo7cHsyS41NeIW3co=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gofiber/utils/v2 v2.0.0-beta.4/go.mod h1:sdRsPU1FXX6YiDGGxd+q2aPJRMzpsxdzCXo9dz+xtOY=
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/schema v1.1.0 h1:CamqUDOFUBqzrvxuz2vEwo8+SUdwsluFh7IlzJh30LY=
github.com/gorilla/schema v1.1.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU=
github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
@ -29,13 +44,23 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= github.com/valyala/fasthttp v1.15.1/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl6TwOBhHCA=
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g= github.com/valyala/fasthttp v1.55.0 h1:Zkefzgt6a7+bVKHnu/YaYSOPfNYNisSVBo/unVCf8k8=
github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM=
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -0,0 +1 @@
package config

View File

@ -12,7 +12,6 @@ var translations map[string]map[string]string
const DefaultLang = "en" const DefaultLang = "en"
// LoadTranslations loads translations from JSON files
func LoadTranslations() { func LoadTranslations() {
translations = make(map[string]map[string]string) translations = make(map[string]map[string]string)
@ -42,7 +41,6 @@ func LoadTranslations() {
} }
} }
// Translate returns the translated message for the given key and context
func Translate(c *fiber.Ctx, key string) string { func Translate(c *fiber.Ctx, key string) string {
lang := c.Locals("lang").(string) lang := c.Locals("lang").(string)
if messages, ok := translations[lang]; ok { if messages, ok := translations[lang]; ok {
@ -58,14 +56,6 @@ func Translate(c *fiber.Ctx, key string) string {
return key return key
} }
// TranslateFunc returns a function for use in templates
func TranslateFunc() func(*fiber.Ctx, string) string {
return func(c *fiber.Ctx, key string) string {
return Translate(c, key)
}
}
// GetTranslations returns the translations map
func GetTranslations() map[string]map[string]string { func GetTranslations() map[string]map[string]string {
return translations return translations
} }

View File

@ -1,21 +1 @@
package middleware package middleware
import (
"git.tijl.dev/tijl/tijl.dev/internal/i18n"
"github.com/gofiber/fiber/v2"
)
func LanguageMiddleware() fiber.Handler {
return func(c *fiber.Ctx) error {
lang := c.Cookies("lang")
if lang == "" {
lang = i18n.DefaultLang
}
if _, exists := i18n.GetTranslations()[lang]; !exists {
lang = i18n.DefaultLang
}
c.Locals("lang", lang)
return c.Next()
}
}

1
internal/oidc/oidc.go Normal file
View File

@ -0,0 +1 @@
package oidc

View File

@ -8,7 +8,7 @@ npm-build:
npm run build npm run build
go-build: go-build:
go build cmd/server/main.go -o tijl.dev go build -o tijl.dev cmd/server/main.go
build: npm-build-css npm-build go-build build: npm-build-css npm-build go-build

BIN
main

Binary file not shown.

View File

6
static/static.go Normal file
View File

@ -0,0 +1,6 @@
package static
import "embed"
//go:embed *
var Embed embed.FS

View File

@ -1,8 +1,6 @@
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
module.exports = { module.exports = {
content: ["./web/**/*.{html,js,ts}"], content: ["./views/**/*.html", "./web/**/*.{js,ts,css}"],
//purge: ["./templates/**/*.html"],
darkMode: false,
theme: { theme: {
extend: {}, extend: {},
}, },

View File

@ -1,6 +1,10 @@
{{ template "layouts/base" . }} {{ template "layouts/base" . }}
{{define "title"}}Home{{end}} {{define "title"}}{{translate "home"}}{{end}}
{{define "header"}}
{{template "partials/menu" .}}
{{end}}
{{ define "content" }} {{ define "content" }}
<h2>Welcome to My Go App</h2> <h2>Welcome to My Go App</h2>

View File

@ -13,14 +13,13 @@
<body class="lg:w-4/5 xl:w-3/4 mx-auto"> <body class="lg:w-4/5 xl:w-3/4 mx-auto">
<header> <header>
{{block "nav" .}}{{end}} {{block "header" .}}{{end}}
</header> </header>
<main class="mx-8 mt-4"> <main class="mx-8 mt-4">
{{block "content" .}}{{end}} {{block "content" .}}{{end}}
</main> </main>
<footer> <footer>
</footer> </footer>
</body> </body>
</html> </html>

View File

@ -1,4 +1,3 @@
{{define "nav"}}
<nav class="flex"> <nav class="flex">
<div class="mt-4 mx-4 rounded-2xl shadow-2xl bg-base-300 navbar"> <div class="mt-4 mx-4 rounded-2xl shadow-2xl bg-base-300 navbar">
<div class="flex-1"> <div class="flex-1">
@ -17,16 +16,16 @@
<li><a class="flex gap-4" href="/"> <li><a class="flex gap-4" href="/">
<span class="w-5 text-center"> <span class="w-5 text-center">
{{ icon "home" }} {{icon "home" }}
</span> </span>
<span class="text-base">Home</span> <span class="text-base">{{translate "home"}}</span>
</a></li> </a></li>
<li><a class="flex gap-4" href="/blog"> <li><a class="flex gap-4" href="/blog">
<span class="w-5 text-center"> <span class="w-5 text-center">
{{ icon "blog" }} {{icon "blog"}}
</span> </span>
<span class="text-base">Blog</span> <span class="text-base">{{translate "blog"}}</span>
</a></li> </a></li>
@ -34,9 +33,9 @@
<details class="dropdown"> <details class="dropdown">
<summary><a class="flex gap-4"> <summary><a class="flex gap-4">
<span class="w-5 text-center"> <span class="w-5 text-center">
{{ icon "language" }} {{icon "language"}}
</span> </span>
<span class="text-base">Language</span> <span class="text-base">{{translate "language"}}</span>
</a> </a>
</summary> </summary>
@ -46,7 +45,7 @@
🇬🇧 🇬🇧
</span> </span>
<span class="text-base"> <span class="text-base">
English {{translate "english"}}
</span> </span>
</a></li> </a></li>
<li><a class="flex gap-4" href="/settings?lang=nl"> <li><a class="flex gap-4" href="/settings?lang=nl">
@ -54,7 +53,7 @@
🇳🇱 🇳🇱
</span> </span>
<span class="text-base"> <span class="text-base">
Dutch {{translate "dutch"}}
</span> </span>
</a></li> </a></li>
</ul> </ul>
@ -62,9 +61,9 @@
</li> </li>
<li><a class="active flex gap-4" href="/login"> <li><a class="active flex gap-4" href="/login">
<span class="w-5 text-center"> <span class="w-5 text-center">
{{ icon "login" }} {{icon "login"}}
</span> </span>
<span class="text-base">Login</span> <span class="text-base">{{translate "login"}}</span>
</a> </a>
</li> </li>
@ -73,4 +72,3 @@
</div> </div>
</div> </div>
</nav> </nav>
{{end}}

6
views/views.go Normal file
View File

@ -0,0 +1,6 @@
package views
import "embed"
//go:embed *
var Embed embed.FS