demonstrates variable

This commit is contained in:
Stephen McQuay 2017-01-26 20:15:18 -08:00
parent 3c2003767e
commit e9edaf13ee
No known key found for this signature in database
GPG Key ID: 1ABF428F71BAFC3D
3 changed files with 9 additions and 1 deletions

View File

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

View File

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

3
web.go
View File

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