aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-02-17 01:09:08 +0100
committerDimitri Sokolyuk <demon@dim13.org>2016-02-17 01:09:08 +0100
commit82ff6ae2a289c7fc00c2007961d70994af51d1fb (patch)
treece17a603cfcd17c1b9aab59a0f52bbcae3de2754
parentcaf2c67a6eabef6167c9c8007763c78af90a040f (diff)
Show modtime
-rw-r--r--index.go2
-rw-r--r--tmpl/index3
-rw-r--r--wiki.go2
3 files changed, 4 insertions, 3 deletions
diff --git a/index.go b/index.go
index a9613fd..14f0ca9 100644
--- a/index.go
+++ b/index.go
@@ -20,7 +20,7 @@ func indexHandler(w http.ResponseWriter, r *http.Request) {
for _, entry := range files {
file := entry.Name()
if !entry.IsDir() && file[0] != '.' {
- p.Pages = append(p.Pages, file)
+ p.Pages = append(p.Pages, entry)
}
}
p.render(w, template.Must(template.ParseFiles("tmpl/root", "tmpl/index")))
diff --git a/tmpl/index b/tmpl/index
index d95deca..bd9472a 100644
--- a/tmpl/index
+++ b/tmpl/index
@@ -2,7 +2,8 @@
{{define "content"}}
<ul>
{{range .Pages}}
-<li><a href="/view/{{.}}">{{.}}</a></li>
+ <li><a href="/view/{{.Name}}">{{.Name}}</a>
+ ({{.ModTime.Format "2 Jan 2006"}})</li>
{{end}}
</ul>
{{end}}
diff --git a/wiki.go b/wiki.go
index 6d22bba..cdb49c2 100644
--- a/wiki.go
+++ b/wiki.go
@@ -10,7 +10,7 @@ import (
type Page struct {
Title string
Body []byte
- Pages []string
+ Pages []os.FileInfo
}
func (p *Page) fileName() string {