Browse Source

Added Easter Egg.

main
Nichole Mattera 2 years ago committed by Nichole Mattera
parent
commit
500b9c659d
  1. 32
      main.go
  2. 18
      templates/main.tmpl

32
main.go

@ -3,11 +3,39 @@ package main
import (
"log"
"net/http"
"text/template"
)
type TemplateData struct {
Title string
Description string
URL string
}
func main() {
mainTemplate, err := template.ParseFiles("./templates/main.tmpl")
if err != nil {
log.Fatal("Error: Unable to parse the template file.")
}
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
if req.URL.Path != "/smatter" {
if req.URL.Path == "/smatter" {
data := TemplateData {
Title: "Do Blue Lives Matter?",
Description: "No",
URL: "https://doblue.live/smatter",
}
mainTemplate.Execute(w, data)
} else if req.URL.Path == "/sreallymatter" {
data := TemplateData {
Title: "Do Blue Lives Really Matter?",
Description: "Still No",
URL: "https://doblue.live/sreallymatter",
}
mainTemplate.Execute(w, data)
} else {
scheme := "http"
if req.TLS != nil {
scheme += "s"
@ -17,8 +45,6 @@ func main() {
return
}
http.ServeFile(w, req, "./static/index.html")
})
log.Fatal(http.ListenAndServe(":8081", nil))

18
static/index.html → templates/main.tmpl

@ -2,18 +2,18 @@
<html lang="en">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="description" content="No" />
<meta name="description" content="{{ .Description }}" />
<meta property="og:title" content="Do Blue Lives Matter?" />
<meta property="og:site_name" content="Do Blue Lives Matter?" />
<meta property="og:url" content="https://doblue.live/smatter" />
<meta property="og:description" content="No" />
<meta property="og:title" content="{{ .Title }}" />
<meta property="og:site_name" content="{{ .Title }}" />
<meta property="og:url" content="{{ .URL }}" />
<meta property="og:description" content="{{ .Description }}" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="Do Blue Lives Matter?" />
<meta name="twitter:description" content="No" />
<meta name="twitter:title" content="{{ .Title }}?" />
<meta name="twitter:description" content="{{ .Description }}" />
<title>Do Blue Lives Matter?</title>
<title>{{ .Title }}</title>
<style>
body {
@ -46,7 +46,7 @@
</head>
<body>
<div>
<h1>No</h1>
<h1>{{ .Description }}</h1>
<p>Blue lives do not exist. Police officers willingly chose their profession. When they finish their shift, they clock out, go home and take their badge off. It's a job, not a race. People of color cannot go home and stop being their race; they did not willingly choose to be their race in this world. Blue lives matter is a mockery of an actual, valuable movement.</p>
</div>
</body>
Loading…
Cancel
Save