feat: add post text slice if too big on threads list

This commit is contained in:
Yanislav Igonin 2022-01-20 20:45:47 +02:00
parent b550c8c16d
commit 16d5fa039e

View File

@ -35,7 +35,14 @@
{{ if ne $Post.Title "" }}
<h5 class="card-title">{{$Post.Title}}</h5>
{{ end }}
{{ $textLength := len $Post.Text }}
{{ if gt $textLength 300 }}
<p class="card-text">{{ slice $Post.Text 0 300 }} ...</p>
{{ else }}
<p class="card-text">{{$Post.Text}}</p>
{{ end }}
<a href="/{{$Post.ID}}" class="btn btn-outline-primary">Open</a>
</div>
</div>