From 8b4bdf625f3c9080a0ba7baa2401fe528c8e828d Mon Sep 17 00:00:00 2001 From: Captain ALM Date: Wed, 15 Jan 2025 15:38:36 +0000 Subject: [PATCH] Update content variable support. --- index.go.yml | 2 +- pageHandler/pages/index/about.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.go.yml b/index.go.yml index 86ca85e..49ebe9c 100644 --- a/index.go.yml +++ b/index.go.yml @@ -56,7 +56,7 @@ about: Here is my GPG Key for my email address.

- My CV is available in the following formats: ( DOCX | PDF ) + My CV is available in the following formats: ( DOCX | PDF )

thumbnailLocation: "resources/assets/imageofyou_t.jpg" imageLocation: "resources/assets/imageofyou.jpg" diff --git a/pageHandler/pages/index/about.go b/pageHandler/pages/index/about.go index 0fe9070..638bd0d 100644 --- a/pageHandler/pages/index/about.go +++ b/pageHandler/pages/index/about.go @@ -18,7 +18,8 @@ type AboutYaml struct { } func (ay AboutYaml) GetContent() template.HTML { - return template.HTML(strings.ReplaceAll(strings.ReplaceAll(ay.Content, "#age#", strconv.Itoa(ay.GetAge())), "#birth#", strconv.Itoa(ay.BirthYear))) + r := strings.NewReplacer("#age#", strconv.Itoa(ay.GetAge()), "#birth#", strconv.Itoa(ay.BirthYear), "#year#", strconv.Itoa(time.Now().Year())) + return template.HTML(r.Replace(ay.Content)) } func (ay AboutYaml) GetAge() int {