feat(http): init golatt
This commit is contained in:
parent
f4da86b98e
commit
b637ff02f6
3 changed files with 58 additions and 1 deletions
18
main.go
18
main.go
|
@ -1,5 +1,21 @@
|
|||
package main
|
||||
|
||||
func main() {
|
||||
import (
|
||||
"embed"
|
||||
"github.com/anhgelus/golatt"
|
||||
)
|
||||
|
||||
//go:embed templates
|
||||
var templates embed.FS
|
||||
|
||||
func main() {
|
||||
g := golatt.New(templates)
|
||||
g.DefaultSeoData = &golatt.SeoData{
|
||||
Image: "",
|
||||
Description: "",
|
||||
Domain: "now.anhgelus.world",
|
||||
}
|
||||
g.Templates = append(g.Templates, "templates/page/*.gohtml")
|
||||
|
||||
g.StartServer(":80")
|
||||
}
|
||||
|
|
23
templates/page/base.gohtml
Normal file
23
templates/page/base.gohtml
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{define "base"}}
|
||||
<!doctype html>
|
||||
<html lang="fr" prefix="og: https://ogp.me/ns#">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="shortcut icon" href="{{getStaticPath "logo.png"}}" type="image/png" />
|
||||
<title>{{ .Title }}</title>
|
||||
<link rel="stylesheet" href="{{getAssetPath "styles.css"}}" />
|
||||
{{template "opengraph-base" .SEO}}
|
||||
</head>
|
||||
<body>
|
||||
{{if .Data.HasNav}}
|
||||
{{template "navbar" .}}
|
||||
{{end}}
|
||||
{{template "body" .}}
|
||||
{{if .Data.HasFooter}}
|
||||
{{template "footer" .}}
|
||||
{{end}}
|
||||
<script type="module" src="{{getAssetPath "index.js"}}" defer></script>
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
18
templates/page/opengraph.gohtml
Normal file
18
templates/page/opengraph.gohtml
Normal file
|
@ -0,0 +1,18 @@
|
|||
{{define "opengraph-base"}}
|
||||
<meta property="description" content="{{.Description}}" />
|
||||
<!-- Open Graph -->
|
||||
<meta property="og:title" content="{{.Title}}" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://{{.Domain}}{{.URL}}" />
|
||||
<meta property="og:image" content="https://{{.Domain}}{{.Image}}" />
|
||||
<meta property="og:description" content="{{.Description}}" />
|
||||
<meta property="og:local" content="fr_FR" />
|
||||
<meta property="og:site_name" content="Architects Land" />
|
||||
<!-- Twitter -->
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta property="twitter:domain" content="{{.Domain}}" />
|
||||
<meta property="twitter:url" content="https://{{.Domain}}{{.URL}}/" />
|
||||
<meta name="twitter:title" content="{{.Title}}" />
|
||||
<meta name="twitter:description" content="{{.Description}}" />
|
||||
<meta name="twitter:image" content="https://{{.Domain}}{{.Image}}" />
|
||||
{{end}}
|
Loading…
Add table
Add a link
Reference in a new issue