diff --git a/pageHandler/pages/index/about.go b/pageHandler/pages/index/about.go index 7c1c834..0fe9070 100644 --- a/pageHandler/pages/index/about.go +++ b/pageHandler/pages/index/about.go @@ -8,13 +8,13 @@ import ( ) type AboutYaml struct { - Title string `yaml:"title"` - Content string `yaml:"content"` - ThumbnailLocation string `yaml:"thumbnailLocation"` - ImageLocation string `yaml:"imageLocation"` - ImageAltText string `yaml:"imageAltText"` - BirthYear int `yaml:"birthYear"` - ContactEmail string `yaml:"contactEmail"` + Title string `yaml:"title"` + Content string `yaml:"content"` + ThumbnailLocation template.URL `yaml:"thumbnailLocation"` + ImageLocation template.URL `yaml:"imageLocation"` + ImageAltText string `yaml:"imageAltText"` + BirthYear int `yaml:"birthYear"` + ContactEmail string `yaml:"contactEmail"` } func (ay AboutYaml) GetContent() template.HTML { diff --git a/pageHandler/pages/index/data.go b/pageHandler/pages/index/data.go index bac0b4c..45d31da 100644 --- a/pageHandler/pages/index/data.go +++ b/pageHandler/pages/index/data.go @@ -1,13 +1,15 @@ package index +import "html/template" + type DataYaml struct { - HeaderLinks map[string]string `yaml:"headerLinks"` - CSSBaseURL string `yaml:"cssBaseURL"` - CSSLightURL string `yaml:"cssLightURL"` - CSSDarkURL string `yaml:"cssDarkURL"` - JScriptURL string `yaml:"jScriptURL"` - About AboutYaml `yaml:"about"` - Entries []EntryYaml `yaml:"entries"` + HeaderLinks map[string]template.URL `yaml:"headerLinks"` + CSSBaseURL template.URL `yaml:"cssBaseURL"` + CSSLightURL template.URL `yaml:"cssLightURL"` + CSSDarkURL template.URL `yaml:"cssDarkURL"` + JScriptURL template.URL `yaml:"jScriptURL"` + About AboutYaml `yaml:"about"` + Entries []EntryYaml `yaml:"entries"` } func (dy DataYaml) GetHeaderLabels() []string { @@ -23,7 +25,7 @@ func (dy DataYaml) GetHeaderLabels() []string { return toReturn } -func (dy DataYaml) GetHeaderLink(headerLabel string) string { +func (dy DataYaml) GetHeaderLink(headerLabel string) template.URL { if dy.HeaderLinks == nil { return "" } diff --git a/pageHandler/pages/index/entry.go b/pageHandler/pages/index/entry.go index 03d68be..881db5a 100644 --- a/pageHandler/pages/index/entry.go +++ b/pageHandler/pages/index/entry.go @@ -10,20 +10,20 @@ import ( const dateFormat = "01-2006" type EntryYaml struct { - Name string `yaml:"name"` - Content string `yaml:"content"` - StartDate yaml.DateType `yaml:"startDate"` - EndDate yaml.DateType `yaml:"endDate"` - VideoLocation string `yaml:"videoLocation"` - VideoContentType string `yaml:"videoContentType"` - ThumbnailLocations []string `yaml:"thumbnailLocations"` - ImageLocations []string `yaml:"imageLocations"` - ImageAltTexts []string `yaml:"imageAltTexts"` + Name string `yaml:"name"` + Content string `yaml:"content"` + StartDate yaml.DateType `yaml:"startDate"` + EndDate yaml.DateType `yaml:"endDate"` + VideoLocation template.URL `yaml:"videoLocation"` + VideoContentType string `yaml:"videoContentType"` + ThumbnailLocations []template.URL `yaml:"thumbnailLocations"` + ImageLocations []template.URL `yaml:"imageLocations"` + ImageAltTexts []string `yaml:"imageAltTexts"` } type ImageReference struct { - ThumbnailLocation string - ImageLocation string + ThumbnailLocation template.URL + ImageLocation template.URL ImageAltText string } diff --git a/pageHandler/pages/index/index-page.go b/pageHandler/pages/index/index-page.go index bd126df..878dd29 100644 --- a/pageHandler/pages/index/index-page.go +++ b/pageHandler/pages/index/index-page.go @@ -90,7 +90,7 @@ func (p *Page) GetContents(urlParameters url.Values) (contentType string, conten theMarshal := &Marshal{ Data: *theData, Light: urlParameters.Has("light"), - Parameters: p.getNonThemedCleanQuery(urlParameters), + Parameters: template.URL(p.getNonThemedCleanQuery(urlParameters)), } switch strings.ToLower(urlParameters.Get("order")) { case "end": diff --git a/pageHandler/pages/index/template-marshal.go b/pageHandler/pages/index/template-marshal.go index a0758a0..32cfdea 100644 --- a/pageHandler/pages/index/template-marshal.go +++ b/pageHandler/pages/index/template-marshal.go @@ -1,10 +1,13 @@ package index -import "sort" +import ( + "html/template" + "sort" +) type Marshal struct { Data DataYaml - Parameters string + Parameters template.URL OrderStartDate int8 OrderEndDate int8 OrderName int8