Render pinned post on index template

pull/1/head
Nikita Tokarchuk 3 years ago
parent 823adde655
commit 58c55e4659
Signed by: mainnika
GPG Key ID: A595FB7E3E56911C
  1. 9
      frontend/templates/index.go.tmpl
  2. 24
      frontend/templates/post.go.tmpl
  3. 1
      frontend/templates/templates.go

@ -13,6 +13,15 @@
{{ template "menu.go.tmpl" . }} {{ template "menu.go.tmpl" . }}
</div> </div>
<!-- render pinned -->
<div class="pinned-container">
{{ range .Pinned }}
<div class="pinned-post">
{{ template "post.go.tmpl" . }}
</div>
{{ end }}
</div>
</section> </section>
</body> </body>

@ -0,0 +1,24 @@
<div class="blog-post">
<!-- render post header -->
<div class="blog-post-head">
<h1>{{ .Title }}</h1>
</div>
{{ if .FImage }}
<div class="blog-post-head-image">
<img src="{{ .FImage }}"></img>
</div>
{{ end }}
<!-- render post -->
<div class="blog-post-content">
{{ .HTML }}
</div>
<!-- render post tailer -->
<div class="blog-post-tailer">
<h3>… … …</h3>
</div>
</div>

@ -17,6 +17,7 @@ import (
//go:embed head.go.tmpl //go:embed head.go.tmpl
//go:embed index.go.tmpl //go:embed index.go.tmpl
//go:embed menu.go.tmpl //go:embed menu.go.tmpl
//go:embed post.go.tmpl
var content embed.FS var content embed.FS
// List of compiled go-templates // List of compiled go-templates

Loading…
Cancel
Save