Browse Source

demonstrates variable

templ
Stephen McQuay 4 years ago
parent
commit
e9edaf13ee
No known key found for this signature in database GPG Key ID: 1ABF428F71BAFC3D
  1. 4
      static/css/sm.css
  2. 3
      templates/home.html
  3. 3
      web.go

4
static/css/sm.css

@ -50,3 +50,7 @@ a {
padding-top: 30px;
}
}
.tiny {
font-size: 10px;
}

3
templates/home.html

@ -10,6 +10,9 @@
<p>
My name is <a href="http://stephen.mcquay.me">Stephen McQuay</a>.
</p>
<p class="tiny">
Your visit occured {{ .time }}.
</p>
</div>
</div>
{{ end }}

3
web.go

@ -4,6 +4,7 @@ import (
"fmt"
"net/http"
"path/filepath"
"time"
assetfs "github.com/elazarl/go-bindata-assetfs"
)
@ -49,7 +50,7 @@ func NewSite(sm *http.ServeMux, static, templates string) *Site {
func (s *Site) Home(w http.ResponseWriter, req *http.Request) {
c := map[string]string{
"time": "asdf",
"time": time.Now().Format(time.Stamp),
}
tmpl, err := s.tmpl.Get("home")
if err != nil {

Loading…
Cancel
Save