blog_html_file.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package template
  2. var VarBlogHtmlFile = []byte(`{{template "header.html" .}}
  3. <div class="card mb-4">
  4. {{if $.Data.Blog.HavePosts}}
  5. {{range $.Data.Blog.Posts}}
  6. <div class="post">
  7. <div class="card-body">
  8. <h2 class="card-title">
  9. <a href="{{.Permalink}}">
  10. {{.Name}}
  11. </a>
  12. </h2>
  13. <div class="post-content">
  14. {{.Briefly}}
  15. </div>
  16. <div class="post-date">
  17. <div><small>Published on {{.DateTimeFormat "02/01/2006, 15:04:05"}}</small></div>
  18. <div>Author: {{.User.FirstName}} {{.User.LastName}}</div>
  19. </div>
  20. </div>
  21. </div>
  22. {{end}}
  23. {{else}}
  24. <div class="card-body">
  25. Sorry, no posts matched your criteria
  26. </div>
  27. {{end}}
  28. </div>
  29. {{if $.Data.Blog.HavePosts}}
  30. {{if gt $.Data.Blog.PostsMaxPage 1 }}
  31. <nav>
  32. <ul class="pagination mb-4">
  33. {{if $.Data.Blog.PaginationPrev}}
  34. <li class="page-item{{if $.Data.Blog.PaginationPrev.Current}} disabled{{end}}">
  35. <a class="page-link" href="{{$.Data.Blog.PaginationPrev.Link}}">Previous</a>
  36. </li>
  37. {{end}}
  38. {{range $.Data.Blog.Pagination}}
  39. {{if .Dots}}
  40. <li class="page-item disabled"><a class="page-link" href="">...</a></li>
  41. {{else}}
  42. <li class="page-item{{if .Current}} active{{end}}">
  43. <a class="page-link" href="{{.Link}}">{{.Num}}</a>
  44. </li>
  45. {{end}}
  46. {{end}}
  47. {{if $.Data.Blog.PaginationNext}}
  48. <li class="page-item{{if $.Data.Blog.PaginationNext.Current}} disabled{{end}}">
  49. <a class="page-link" href="{{$.Data.Blog.PaginationNext.Link}}">Next</a>
  50. </li>
  51. {{end}}
  52. </ul>
  53. </nav>
  54. {{end}}
  55. {{end}}
  56. {{template "footer.html" .}}`)