теперь посты сортируются по времени создания, убрал суффикс .md в url постов
parent
e1e95848fa
commit
21ce6944f8
|
@ -57,8 +57,7 @@ func LoadPosts(dir string) (PostsMap, error) {
|
|||
// Ошибка парсинга timestamp
|
||||
log.Fatal(`post name parse error`)
|
||||
}
|
||||
|
||||
link := fmt.Sprintf("/%s", name[lowLineIndex+1:])
|
||||
link := fmt.Sprintf("/%s", strings.TrimSuffix(name[lowLineIndex+1:], ".md"))
|
||||
posts[PostLink(link)] = createPost(link, html, timestamp)
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div>
|
||||
{{ .data }}
|
||||
<p>
|
||||
<code>mod time: {{ .modTimestamp }}</code>
|
||||
<code>create time: {{ .modTimestamp }}</code>
|
||||
</p>
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<main>
|
||||
<div>
|
||||
<p>
|
||||
<code>posts sorted by last mod time</code>
|
||||
<code>posts sorted by create time</code>
|
||||
</p>
|
||||
</div>
|
||||
{{ range $ind, $post := .posts }}
|
||||
|
@ -18,7 +18,7 @@
|
|||
<a href="{{ $post.Link }}">read more</a>
|
||||
</p>
|
||||
<p>
|
||||
<code>mod time: {{ $post.Timestamp }}</code>
|
||||
<code>create time: {{ $post.Timestamp }}</code>
|
||||
</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue