summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-05-28 04:17:11 -0400
committersiddharth ravikumar <s@ricketyspace.net>2022-05-28 04:17:11 -0400
commitf3813503b748eba2877e730c53c91549ca2c6da5 (patch)
tree8bfff80080348ca6e8fc7f0a59485b1182d168fb
parent5605f78daca7db0bb4c22d28a9286c01cc4da0da (diff)
peach: update Weather
Add a Title field.
-rw-r--r--main.go2
-rw-r--r--templates/weather.tmpl2
2 files changed, 3 insertions, 1 deletions
diff --git a/main.go b/main.go
index 574c72f..11cde3b 100644
--- a/main.go
+++ b/main.go
@@ -35,6 +35,7 @@ var peachTemplates = template.Must(template.ParseFS(peachFS, "templates/*.tmpl")
var latLngRegex = regexp.MustCompile(`/(-?[0-9]+\.?[0-9]+?),(-?[0-9]+\.?[0-9]+)`)
type Weather struct {
+ Title string
Location string
Now WeatherNow
Period WeatherPeriod
@@ -137,6 +138,7 @@ func NewWeather(point *nws.NWSPoint, f, fh *nws.NWSForecast) (*Weather, error) {
strings.ToLower(point.Properties.RelativeLocation.Properties.City),
strings.ToLower(point.Properties.RelativeLocation.Properties.State),
)
+ w.Title = w.Location
w.Now = WeatherNow{
Temperature: fh.Properties.Periods[0].Temperature,
TemperatureUnit: fh.Properties.Periods[0].TemperatureUnit,
diff --git a/templates/weather.tmpl b/templates/weather.tmpl
index 5fac41e..05b18a2 100644
--- a/templates/weather.tmpl
+++ b/templates/weather.tmpl
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
- <title>peach - {{.Location}}</title>
+ <title>peach - {{.Title}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="siddharth ravikumar">
<link rel="preload" href="/static/peach.css" as="style" />