From 7d230eb7d5f326035993ea6a811dae367f2583ad Mon Sep 17 00:00:00 2001 From: Jacob Hartmann Date: Tue, 9 Mar 2021 21:10:26 +0100 Subject: [PATCH] updated blog with new layout --- css/style.css | 36 +++++++++++++++++++++++++------ templates/blog.tmpl | 52 ++++++++++++++++++++++++++------------------- templates/past.tmpl | 12 +++++++++-- websiteTemplate.go | 6 ++++-- 4 files changed, 74 insertions(+), 32 deletions(-) diff --git a/css/style.css b/css/style.css index 3cdb041..df50637 100644 --- a/css/style.css +++ b/css/style.css @@ -11,7 +11,9 @@ html, body { } .title { - padding: 20px; + //padding: 20px; + justify-content: flex-end; + color: #ff8f00; } .title:hover { @@ -57,10 +59,12 @@ article { h1 { letter-spacing: 5px; + margin-right: -5px; font-size: 40px; //color: #97c5e0; color: #506692; - text-align: center; + text-align: right; + justify-content: flex-end; padding-top: 30px; } @@ -104,13 +108,20 @@ ul { //color: #97c5e0; } -.menu{ +.section{ display: flex; justify-content: center; padding-bottom: 20px; color: #35465D; } +.menu{ + display: flex; + justify-content: flex-end; + padding-bottom: 20px; + color: #35465D; +} + .menuselect{ color: #529ecc; } @@ -118,6 +129,7 @@ ul { .menuElement{ border: 20px; padding: 10px; + padding-right: 0px; font-size: 20px; text-decoration: none; } @@ -125,7 +137,6 @@ ul { .menuElement:hover { //background-color: #687fad; color: lightblue; - background-color: #d6e2fa; } .bottomMenu { @@ -147,15 +158,28 @@ ul { //background-color: #d6e2fa; } -#menu ul{ +#section ul>li{ display: block; margin: auto; float: center; + text-align: right; + list-style: none; +} + +#section li{ + display: inline-block; + vertical-align: top; +} + +#menu ul{ + //display: block; + margin: auto; + float: center; text-align: center; list-style: none; } #menu li{ - display: inline-block; + //display: inline-block; } diff --git a/templates/blog.tmpl b/templates/blog.tmpl index 6f9dbc0..a345158 100644 --- a/templates/blog.tmpl +++ b/templates/blog.tmpl @@ -7,28 +7,36 @@ -

{{.Title}}

-
-

Develop games, play games, talk games

-
- -
- {{if eq .CurrentPage "blog"}} -
{{template "content" .}}
- {{else if eq .CurrentPage "about"}} -
{{template "about" .}}
- {{else if eq .CurrentPage "past"}} -
{{template "past" .}}
- {{else if eq .CurrentPage "contact"}} -
{{template "contact" .}}
- {{end}} +
+
    +
  • +

    {{.Title}}

    +
    +

    Develop games, play games, talk games

    +
    + +
  • +
  • +
    + {{if eq .CurrentPage "blog"}} +
    {{template "content" .}}
    + {{else if eq .CurrentPage "about"}} +
    {{template "about" .}}
    + {{else if eq .CurrentPage "past"}} +
    {{template "past" .}}
    + {{else if eq .CurrentPage "contact"}} +
    {{template "contact" .}}
    + {{end}} +
    +
  • +
diff --git a/templates/past.tmpl b/templates/past.tmpl index 6c78776..5b5bd18 100644 --- a/templates/past.tmpl +++ b/templates/past.tmpl @@ -1,9 +1,17 @@ {{define "past"}}
-
    +
      {{with .Posts}} {{range .}} -
    • {{.Title}} - {{.NormalDate}}
    • {{end}}{{end}} +
    • +
      + +
      + {{.NormalDate}} +
      +
      {{end}}{{end}}
{{end}} diff --git a/websiteTemplate.go b/websiteTemplate.go index addb80e..62a65ee 100644 --- a/websiteTemplate.go +++ b/websiteTemplate.go @@ -28,7 +28,8 @@ func main() { http.HandleFunc("/past/", pastHandler) http.HandleFunc("/contact/", contactHandler) http.HandleFunc("/post/", postHandler) - http.HandleFunc("/", blogHandler) + http.HandleFunc("/", pastHandler) + //http.HandleFunc("/", blogHandler) http.Handle("/images/", http.StripPrefix("/images/", http.FileServer(http.Dir("images")))) http.Handle("/css/", http.StripPrefix("/css/", http.FileServer(http.Dir("css")))) @@ -64,7 +65,8 @@ func blogHandler(w http.ResponseWriter, req *http.Request) { length := len(posts) posts = posts[:3] //posts = getNewestPosts(3) - page := Page{name, posts, "blog"} + page := Page{name, posts, "past"} + //page := Page{name, posts, "blog"} renderTemplates(w, page) posts = posts[:length] }