A web blog and personal homepage engine written in Go.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

85 lines
2.3 KiB

{{ range $i, $Post := .V.posts }}
{{ if gt $i 0 }}<hr class="mb-4">{{ end }}
<div class="card mb-4">
<div class="card-header">
<h1>
<a href="/{{ $Post.Fragment }}" class="blog-title">{{ $Post.Title }}</a>
</h1>
</div>
<div class="card-body">
<small class="text-muted blog-meta"><em>
{{ if $Post.Sticky }}<span class="blog-sticky">[sticky]</span>{{ end }}
{{ if ne $Post.Privacy "public" }}
<span class="blog-{{ $Post.Privacy }}">[{{ $Post.Privacy }}]</span>
{{ end }}
<span title="{{ $Post.CreatedAt.Format "Jan 2 2006 15:04:05 MST" }}">
{{ $Post.CreatedAt.Format "January 2, 2006" }}
</span>
{{ if ($Post.UpdatedAt.After $Post.CreatedAt) }}
<span title="{{ $Post.UpdatedAt.Format "Jan 2 2006 15:04:05 MST" }}">
(updated {{ $Post.UpdatedAt.Format "January 2, 2006" }})
</span>
{{ end }}
{{ if $Post.Author.Name }}
by {{ $Post.Author.Name }}
{{ end }}
</em></small>
<br><br>
{{ $Post.PreviewHTML }}
<div class="mt-4">
<small class="text-muted"><em>
Tags:
{{ range $tag := $Post.Tags }}
<a href="/tagged/{{ $tag.Tag }}" class="ml-2">#{{ $tag.Tag }}</a>
{{ end }}
</em></small>
</div>
<div class="mt-2">
<small class="text-muted"><em>
<a href="/{{ $Post.Fragment }}#comments">{{ $Post.CommentCount }} comment{{ if ne $Post.CommentCount 1 }}s{{ end }}</a>
|
<a href="/{{ $Post.Fragment }}">Permalink</a>
</em></small>
</div>
</div>
</div>
{{ if $.CurrentUser.IsAdmin }}
<div class="alert alert-secondary">
<small>
<strong>Admin:</strong>
[
<a href="/blog/edit?id={{ $Post.ID }}">edit</a> |
<a href="/blog/delete?id={{ $Post.ID }}">delete</a>
]
</small>
</div>
{{ end }}
{{ end }}
{{ if .V.paging }}
<div class="row">
<div class="col">
<span class="badge badge-secondary" title="{{ .V.paging.Total }} total posts">
Page {{ .V.paging.Page }} of {{ .V.paging.Pages }}
</span>
</div>
<div class="col text-right">
{{ if .V.paging.PreviousPage }}
<a href="?page={{ .V.paging.PreviousPage }}" class="btn btn-sm btn-light">Newer posts</a>
{{ end }}
{{ if .V.paging.NextPage }}
<a href="?page={{ .V.paging.NextPage }}" class="btn btn-sm btn-primary">Older posts</a>
{{ end }}
</div>
</div>
{{ end }}