From d5350b0b5bed9c41b03c2c176752b1237fbafa5e Mon Sep 17 00:00:00 2001 From: Ben Croker Date: Sun, 1 Dec 2024 19:20:45 -0600 Subject: [PATCH] Add canonical meta tag --- code/go/site/router.go | 4 ++++ code/go/site/routes_bundler.templ | 2 +- code/go/site/routes_home.templ | 1 + code/go/site/routes_memes.templ | 2 +- code/go/site/shared.templ | 9 +++++---- code/go/site/static/images/rocket.svg | 1 + 6 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 code/go/site/static/images/rocket.svg diff --git a/code/go/site/router.go b/code/go/site/router.go index 359f23fec..420d4cdf7 100644 --- a/code/go/site/router.go +++ b/code/go/site/router.go @@ -34,6 +34,10 @@ func staticAbsolutePath(path string) string { return "https://data-star.dev/" + staticSys.HashName("static/"+path) } +func canonicalUrl(uri string) string { + return "https://data-star.dev" + uri +} + func RunBlocking(port int, readyCh chan struct{}) toolbelt.CtxErrFunc { return func(ctx context.Context) error { diff --git a/code/go/site/routes_bundler.templ b/code/go/site/routes_bundler.templ index 2e0b311a6..94f7fee57 100644 --- a/code/go/site/routes_bundler.templ +++ b/code/go/site/routes_bundler.templ @@ -10,7 +10,7 @@ import ( ) templ PageBundler(r *http.Request, manifest PluginManifest, store *BundlerStore) { - @Page("Bundler", "Bundle only the plugins you need to reduce the size of Datastar even further.") { + @Page("Bundler", "Bundle only the plugins you need to reduce the size of Datastar even further.", "/bundler") { @header(r)
diff --git a/code/go/site/routes_home.templ b/code/go/site/routes_home.templ index a1c8b531d..f9cf4039f 100644 --- a/code/go/site/routes_home.templ +++ b/code/go/site/routes_home.templ @@ -14,6 +14,7 @@ templ Home() { @Page( "Datastar - A real-time hypermedia framework", "Datastar helps you build real-time web applications with the simplicity of server-side rendering and the power of a full-stack SPA framework.", + "/", ) {
diff --git a/code/go/site/routes_memes.templ b/code/go/site/routes_memes.templ index 9b6db4969..e4481b7a8 100644 --- a/code/go/site/routes_memes.templ +++ b/code/go/site/routes_memes.templ @@ -3,7 +3,7 @@ package site import "net/http" templ PageMemes(r *http.Request, memes ...string) { - @Page("Hot fresh memes", "The most wasted of all days is one without laughter.") { + @Page("Hot fresh memes", "The most wasted of all days is one without laughter.", "/memes") { @header(r)
Memes
diff --git a/code/go/site/shared.templ b/code/go/site/shared.templ index 9a2b25e07..f7d5666bb 100644 --- a/code/go/site/shared.templ +++ b/code/go/site/shared.templ @@ -8,17 +8,18 @@ import ( "strings" ) -templ Page(title, description string) { +templ Page(title, description string, uri string) { { title } - + + - + @@ -154,7 +155,7 @@ templ SidebarPage( r *http.Request, sidebarGroups []*SidebarGroup, current *SidebarLink, title, description, contents string, ) { - @Page(title, description) { + @Page(title, description, r.URL.String()) { @highlightCSS
diff --git a/code/go/site/static/images/rocket.svg b/code/go/site/static/images/rocket.svg new file mode 100644 index 000000000..19d35478e --- /dev/null +++ b/code/go/site/static/images/rocket.svg @@ -0,0 +1 @@ + \ No newline at end of file