dev #3
16
main.go
16
main.go
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue