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(
|
2024-09-22 15:46:38 +00:00
|
|
|
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),
|
2024-10-10 14:24:50 +00:00
|
|
|
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),
|
2024-09-25 03:41:03 +00:00
|
|
|
h.Meta("og:url", "https://htmgo.dev"),
|
|
|
|
|
h.Link("canonical", "https://htmgo.dev"),
|
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-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,
|
|
|
|
|
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...,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|