htmgo/htmgo-site/pages/base/root.go

72 lines
1.7 KiB
Go
Raw Normal View History

2024-09-20 16:45:23 +00:00
package base
import (
2024-09-24 18:05:38 +00:00
"github.com/google/uuid"
2024-09-20 16:45:23 +00:00
"github.com/maddalax/htmgo/framework/h"
"htmgo-site/partials"
)
2024-09-24 18:05:38 +00:00
var Version = uuid.NewString()[0:6]
2024-09-27 02:15:04 +00:00
func RootPage(ctx *h.RequestContext, children ...h.Ren) *h.Element {
2024-09-25 16:00:31 +00:00
title := "htmgo"
description := "build simple and scalable systems with go + htmx"
2024-09-20 16:45:23 +00:00
return h.Html(
h.HxExtension(
h.BaseExtensions(),
),
2024-09-20 16:45:23 +00:00
h.Head(
h.Meta("viewport", "width=device-width, initial-scale=1"),
2024-09-25 16:00:31 +00:00
h.Meta("title", title),
h.Link("/public/favicon.ico", "icon"),
h.Link("/public/apple-touch-icon.png", "apple-touch-icon"),
2024-09-25 16:00:31 +00:00
h.Meta("charset", "utf-8"),
h.Meta("author", "htmgo"),
h.Meta("description", description),
h.Meta("og:title", title),
h.Meta("og:url", "https://htmgo.dev"),
h.Link("canonical", "https://htmgo.dev"),
2024-10-15 15:26:30 +00:00
h.Link("https://cdn.jsdelivr.net/npm/@docsearch/css@3", "stylesheet"),
2024-09-25 16:00:31 +00:00
h.Meta("og:description", description),
2024-09-24 18:05:38 +00:00
h.LinkWithVersion("/public/main.css", "stylesheet", Version),
h.ScriptWithVersion("/public/htmgo.js", Version),
2024-09-23 19:41:43 +00:00
h.Style(`
html {
scroll-behavior: smooth;
}
`),
2024-09-20 16:45:23 +00:00
),
2024-09-20 20:15:12 +00:00
h.Body(
2024-10-13 13:24:23 +00:00
h.Class("bg-stone-50 h-screen"),
2024-09-20 20:15:12 +00:00
h.Fragment(children...),
2024-10-15 15:26:30 +00:00
h.Script("https://cdn.jsdelivr.net/npm/@docsearch/js@3"),
h.UnsafeRawScript(`
docsearch({
2024-10-15 15:51:32 +00:00
insights: true,
appId: "9IO2WZA8L1",
apiKey: "d8cd8b6f8f8a0c961ce971e09dbde90a",
indexName: "htmgo",
container: "#search-container",
debug: false
2024-10-15 15:26:30 +00:00
});
`),
2024-09-20 20:15:12 +00:00
),
2024-09-20 16:45:23 +00:00
)
}
2024-10-13 13:24:23 +00:00
func PageWithNav(ctx *h.RequestContext, children ...h.Ren) *h.Element {
return RootPage(
ctx,
2024-10-13 13:24:23 +00:00
h.Fragment(
partials.NavBar(ctx, partials.NavBarProps{
2024-10-14 14:49:48 +00:00
Expanded: false,
ShowPreRelease: true,
2024-10-13 13:24:23 +00:00
}),
h.Div(
children...,
),
),
)
}