add more meta to html

This commit is contained in:
2025-05-11 00:08:20 +01:00
parent 5b11ad9f4b
commit 10647ab0a3
4 changed files with 19 additions and 7 deletions

View File

@@ -45,8 +45,9 @@ type pageTemplate struct {
// summaryTemplateData stores template data for summary.html // summaryTemplateData stores template data for summary.html
type summaryTemplateData struct { type summaryTemplateData struct {
Summary string Summary string
Location string Location string
LocationName string
} }
// updateSubscription is the request body for creating/updating registration // updateSubscription is the request body for creating/updating registration
@@ -368,7 +369,8 @@ func handleHTTPRequest(state *state) http.HandlerFunc {
summary, ok := state.summaries.Load(path) summary, ok := state.summaries.Load(path)
if ok { if ok {
state.template.summary.Execute(writer, summaryTemplateData{summary.(string), path}) loc := supportedLocations[path]
state.template.summary.Execute(writer, summaryTemplateData{summary.(string), path, loc.displayName})
} else { } else {
f, err := webDir.ReadFile("web/" + path) f, err := webDir.ReadFile("web/" + path)
if err != nil { if err != nil {

BIN
web/hero.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -2,7 +2,12 @@
<html lang="en"> <html lang="en">
<head> <head>
<title>7am Weather</title> <title>7am - Daily weather summary</title>
<meta name="twitter:card" content="summary" />
<meta property="og:title" content="7am Weather">
<meta property="og:description" content="Daily weather summary delivered to you at 7am.">
<meta property="og:image" content="/hero.png">
<link rel="icon" type="image/png" href="/favicon.png"> <link rel="icon" type="image/png" href="/favicon.png">
<link rel="manifest" href="/manifest.json"> <link rel="manifest" href="/manifest.json">
@@ -19,7 +24,7 @@
<div class="container"> <div class="container">
<header> <header>
<h1>7am</h1> <h1>7am</h1>
<h2>Daily weather updates delivered to you at 7am.</h2> <h2>Daily weather summary delivered to you at 7am.</h2>
</header> </header>
<main> <main>

View File

@@ -2,7 +2,12 @@
<html lang="en"> <html lang="en">
<head> <head>
<title>7am Weather</title> <title>7am weather for {{.LocationName}}</title>
<meta name="twitter:card" content="summary" />
<meta property="og:title" content="7am Weather">
<meta property="og:description" content="Weather summary for {{.LocationName}}">
<meta property="og:image" content="/hero.png">
<link rel="icon" type="image/png" href="/favicon.png"> <link rel="icon" type="image/png" href="/favicon.png">
<link rel="manifest" href="/manifest.json"> <link rel="manifest" href="/manifest.json">
@@ -20,7 +25,7 @@
<main> <main>
<a class="back-link" href="/">&lt;- All locations</a> <a class="back-link" href="/">&lt;- All locations</a>
<p class="summary">{{.Summary}}</p> <p class="summary">{{.Summary}}</p>
<button type="button" id="get-summary-btn" data-loc="{{.Location}}">Get daily updates at 7am</button> <button type="button" id="get-summary-btn" data-loc="{{.Location}}">Get daily summary at 7am</button>
</main> </main>
</div> </div>
<script src="/summary.js"></script> <script src="/summary.js"></script>