Update template

This commit is contained in:
2025-05-24 08:52:11 +02:00
parent ca8b1a2e46
commit 542d28e7a9
18 changed files with 293 additions and 235 deletions

View File

@@ -1,34 +0,0 @@
package components
templ Page(content templ.Component) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="description" content="A sane golang website template."/>
<link rel="preload" as="style" href="static/css/fonts.css" media="screen,print"/>
<link rel="preload" as="style" href="static/css/site.screen.css" media="screen"/>
<link rel="preload" as="font" href="static/css/fonts/poppins-western.woff2" media="screen,print" crossorigin/>
<link rel="preload" as="font" href="static/css/fonts/poppins-western-bold.woff2" media="screen,print" crossorigin/>
<link rel="preload" as="font" href="static/css/fonts/interface-Regular.woff2" media="screen,print" crossorigin/>
<link rel="stylesheet" href="static/css/fonts.css" media="screen,print"/>
<link rel="stylesheet" href="static/css/site.screen.css" media="screen"/>
<link rel="stylesheet" href="static/css/site.print.css" media="print"/>
<link rel="apple-touch-icon" href="static/apple-touch-icon.png"/>
<link rel="icon" href="static/favicon.ico"/>
<link rel="icon" href="static/favicon.svg" type="image/svg+xml"/>
<title>Awesome content</title>
</head>
<body>
<div id="fauxBody">
@Header()
<main>
@content
</main>
<a href="#top" id="backToTop"><span>Back To Top</span></a>
@Footer()
</div>
</body>
</html>
}

View File

@@ -1,5 +0,0 @@
package components
templ Page404() {
<div>Page not found</div>
}

View File

@@ -1,37 +0,0 @@
package components
templ Footer() {
<footer>
<section>
<h2 class="optional">Legal Disclaimer</h2>
<p>
&copy; Jason M. Knight, <span>All Rights Reserved.</span>
</p>
</section>
<section id="socialMedia">
<h2 class="optional">Visit Me On Social Media</h2>
<ul class="socialMenu">
<li>
<a href="#" class="icon_facebook">
<span>Facebook</span>
</a>
</li>
<li>
<a href="#" class="icon_linkedIn">
<span>LinkedIn</span>
</a>
</li>
<li>
<a href="#" class="icon_x">
<span>The Artist Formerly Known As Twitter</span>
</a>
</li>
<li>
<a href="#" class="icon_medium">
<span>Medium</span>
</a>
</li>
</ul>
</section>
</footer>
}

View File

@@ -1,29 +0,0 @@
package components
templ Header() {
<header id="top">
<a href="./">
<h1>Website template</h1>
<p>A Golang Templ based skeleton</p>
</a>
<a href="#mainMenu" class="mainMenuOpen" hidden>
<span>Open Main Menu</span>
</a>
<nav id="mainMenu">
<a href="#" class="modalClose" hidden tabindex="-1">
<span>Close Main Menu</span>
</a>
<div data-modalTitle="Main Menu">
<a href="#" class="modalClose icon_close" hidden>
<span>Close Main Menu</span>
</a>
<ul>
<li><a href="./">Home</a></li>
<li><a href="#whatIDo">What I Do</a></li>
<li><a href="#testimonials">Testimonials</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</div>
</nav>
</header>
}

View File

@@ -1,16 +0,0 @@
package components
templ IndexPage() {
<section class="hero" id="semanticEasy">
<div>
<header>
<h2>Semantic Accessible <span>Markup Is Easy</span></h2>
<p>Stop Making It Hard</p>
</header>
<p>
I have spent the past decade and a half helping site owners out of deep legal troubles for accessibility woes, improve workplace conditions, gain essential leadership skills, by way of promoting good practices. I can help you learn to leverage caching models, write accessibible HTML, keep your style within guidelines such as the WCAG, and aid in lawsuits involving the US ADA, UQ EQA, and a plethora of other accessibility laws from around the globe.
</p>
<a class="action" href="#">Learn More</a>
</div>
</section>
}

View File

@@ -1,22 +0,0 @@
package web
import (
"net/http"
"time"
"git.clustercockpit.org/moebiusband/go-http-skeleton/web/components"
"github.com/a-h/templ"
"github.com/benbjohnson/hashfs"
"github.com/gorilla/sessions"
)
func setupRoutes(r *http.ServeMux) error {
r.Handle("GET /static/", hashfs.FileServer(staticSys))
r.Handle("GET /{$}", templ.Handler(components.Page(components.IndexPage())))
r.Handle("GET /404", templ.Handler(components.Page(components.Page404()), templ.WithStatus(http.StatusNotFound)))
sessionStore := sessions.NewCookieStore([]byte("datastar-session-secret"))
sessionStore.MaxAge(int(24 * time.Hour / time.Second))
return nil
}

View File

@@ -1,36 +0,0 @@
package web
import (
"context"
"embed"
"fmt"
"net/http"
"git.clustercockpit.org/moebiusband/go-http-skeleton/internal/util"
"github.com/benbjohnson/hashfs"
)
//go:embed static/*
var staticFS embed.FS
var staticSys = hashfs.NewFS(staticFS)
func RunBlocking(port int) util.CtxErrFunc {
return func(ctx context.Context) error {
r := http.NewServeMux()
setupRoutes(r)
srv := &http.Server{
Addr: fmt.Sprintf(":%d", port),
Handler: r,
}
go func() {
<-ctx.Done()
srv.Shutdown(context.Background())
}()
return srv.ListenAndServe()
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 14 KiB

7
web/static/robots.txt Normal file
View File

@@ -0,0 +1,7 @@
User-agent: Googlebot
Disallow: /nogooglebot/
User-agent: *
Allow: /
Sitemap: https://www.example.com/sitemap.xml

8
web/templates.go Normal file
View File

@@ -0,0 +1,8 @@
package web
import (
"embed"
)
//go:embed templates
var Templates embed.FS

7
web/templates/index.html Normal file
View File

@@ -0,0 +1,7 @@
<!DOCTYPE html>
<html lang="en" class="h-screen">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>{{.Title}}</title>
<!-- ... -->