From 8ee9af94e0bdf0006be563b4225d130a8516619b Mon Sep 17 00:00:00 2001 From: Philemon Ukane Date: Thu, 6 Jun 2024 12:17:13 +0100 Subject: [PATCH] use template func for footer year Signed-off-by: Philemon Ukane --- cmd/dcrdata/internal/explorer/templates.go | 5 ++++- cmd/dcrdata/views/extras.tmpl | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/dcrdata/internal/explorer/templates.go b/cmd/dcrdata/internal/explorer/templates.go index 562a919aa..79800b95f 100644 --- a/cmd/dcrdata/internal/explorer/templates.go +++ b/cmd/dcrdata/internal/explorer/templates.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022, The Decred developers +// Copyright (c) 2018-2024, The Decred developers // Copyright (c) 2017, The dcrdata developers // See LICENSE for details. @@ -369,6 +369,9 @@ func makeTemplateFuncMap(params *chaincfg.Params) template.FuncMap { "intMultiply": func(a, b int) int { return a * b }, + "currentYear": func() string { + return strconv.Itoa(time.Now().Year()) + }, "timezone": func() string { t, _ := time.Now().Zone() return t diff --git a/cmd/dcrdata/views/extras.tmpl b/cmd/dcrdata/views/extras.tmpl index 002df4127..873b7fa5e 100644 --- a/cmd/dcrdata/views/extras.tmpl +++ b/cmd/dcrdata/views/extras.tmpl @@ -174,7 +174,7 @@ href="{{.Links.License}}" target="_blank" rel="noopener noreferrer" - >© 2024 The Decred developers (ISC) + >© {{currentYear}} The Decred developers (ISC)