Fixed more meta data

This commit is contained in:
Patrick Hatsune 2024-07-26 05:53:10 -07:00
parent 7db29469e3
commit ff55c2d888
Signed by: keyemail
GPG key ID: 6FD1A0FDB0D914C2
3 changed files with 15 additions and 7 deletions

16
main.go
View file

@ -14,6 +14,7 @@ type Index struct {
WebpageIcon string WebpageIcon string
WebpageKeywords string WebpageKeywords string
WebpageDescription string WebpageDescription string
WebpageURL string
GalleryItems []GalleryItems GalleryItems []GalleryItems
SocialItems []SocialItems SocialItems []SocialItems
VideoItems []VideoItems VideoItems []VideoItems
@ -22,6 +23,11 @@ type Index struct {
Nav bool Nav bool
} }
type responseWriter struct {
http.ResponseWriter
status int
}
type GalleryItems struct { type GalleryItems struct {
URL string URL string
ID int ID int
@ -49,6 +55,7 @@ var data = &Index {
WebpageIcon: "/src/assets/main/favicon.ico", WebpageIcon: "/src/assets/main/favicon.ico",
WebpageKeywords: "keyemail", WebpageKeywords: "keyemail",
WebpageDescription: "Welcome to keyemail.dev! A profile based on Keyemail.", WebpageDescription: "Welcome to keyemail.dev! A profile based on Keyemail.",
WebpageURL: "https://keyemail.dev",
GalleryItems: galleryItems, GalleryItems: galleryItems,
SocialItems: socialItems, SocialItems: socialItems,
VideoItems: videoItems, VideoItems: videoItems,
@ -170,19 +177,19 @@ func videoContentHandler(w http.ResponseWriter, req *http.Request) {
} }
func videoHandler(w http.ResponseWriter, req *http.Request) { func videoHandler(w http.ResponseWriter, req *http.Request) {
renderTemplate(w, "video", data, true); renderTemplate(w, "video", data, true)
} }
func socialsHandler(w http.ResponseWriter, req *http.Request) { func socialsHandler(w http.ResponseWriter, req *http.Request) {
renderTemplate(w, "socials", data, true); renderTemplate(w, "socials", data, true)
} }
func galleryHandler(w http.ResponseWriter, req *http.Request) { func galleryHandler(w http.ResponseWriter, req *http.Request) {
renderTemplate(w, "gallery", data, true); renderTemplate(w, "gallery", data, true)
} }
func indexHandler(w http.ResponseWriter, req *http.Request) { func indexHandler(w http.ResponseWriter, req *http.Request) {
renderTemplate(w, "home", data, true); renderTemplate(w, "home", data, true)
} }
func main() { func main() {
@ -201,6 +208,7 @@ func main() {
http.HandleFunc("/videos", videoHandler) http.HandleFunc("/videos", videoHandler)
http.HandleFunc("/gallery/", galleryContentHandler) http.HandleFunc("/gallery/", galleryContentHandler)
http.HandleFunc("/videos/", videoContentHandler) http.HandleFunc("/videos/", videoContentHandler)
log.Println("Server running at http://localhost" + port) log.Println("Server running at http://localhost" + port)
http.ListenAndServe(port, nil) http.ListenAndServe(port, nil)
} }

View file

@ -1,7 +1,7 @@
<head> <head>
{{ define "head" }} {{ define "head" }}
<link rel="stylesheet" href="/src/styles/gallery.css"> <link rel="stylesheet" href="/src/styles/gallery.css">
<meta property="og:image" content="https://keyemail.dev/{{ .GalleryPhoto.URL }}"/> <meta property="og:image" content="{{ .WebpageURL }}{{ .GalleryPhoto.URL }}"/>
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image"/>
{{ end }} {{ end }}
</head> </head>

View file

@ -1,7 +1,7 @@
<head> <head>
{{ define "head" }} {{ define "head" }}
<link rel="stylesheet" href="/src/styles/video.css"/> <link rel="stylesheet" href="/src/styles/video.css"/>
<link property=og:image" content="https://keyemail.dev/{{ .VideoContent.URL }}"/> <meta property="og:image" content="{{ .WebpageURL }}{{ .VideoContent.Thumbnail }}"/>
<meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:card" content="summary_large_image"/>
{{ end }} {{ end }}
</head> </head>