recent_posts.html 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {{ if isset .Site.Params "recent_posts" }}
  2. {{ if .Site.Params.recent_posts.enable }}
  3. <section class="bar background-white no-mb">
  4. <div class="container">
  5. <div class="col-md-12">
  6. <div class="heading text-center">
  7. <h2>{{ .Site.Params.recent_posts.title | markdownify }}</h2>
  8. </div>
  9. <p class="lead">
  10. {{ .Site.Params.recent_posts.subtitle | markdownify }}
  11. </p>
  12. <!-- *** BLOG HOMEPAGE *** -->
  13. <div class="row">
  14. {{ $posts := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) }}
  15. {{ range first 4 $posts.Pages }}
  16. <div class="col-md-3 col-sm-6">
  17. <div class="box-image-text blog">
  18. <div class="top">
  19. <div class="image" style="overflow:hidden">
  20. {{ if isset .Params "banner" }}
  21. <img src="{{ .Params.banner | relURL }}" class="img-responsive" alt="" >
  22. {{ else }}
  23. <img src="{{ "img/placeholder.png" | relURL }}" class="img-responsive" alt="">
  24. {{ end }}
  25. </div>
  26. <div class="bg"></div>
  27. <div class="text">
  28. <p class="buttons">
  29. <a href="{{ .Permalink }}" class="btn btn-template-transparent-primary"><i class="fas fa-link"></i> {{ i18n "readMore" }}</a>
  30. </p>
  31. </div>
  32. </div>
  33. <div class="content">
  34. <h4><a href="{{ .Permalink }}">{{ .Title }}</a></h4>
  35. <p class="author-category">
  36. {{ if isset .Params "authors" }}
  37. {{ i18n "authorBy" }} {{ range $index, $author := .Params.authors }}{{ if $index }}, {{ end }}<a href="{{ (printf "%s/%s" ("authors" | relLangURL) ($author | urlize)) }}">{{ $author }}</a>{{ end }}
  38. {{ end }}
  39. {{ if .Params.date }}
  40. {{ $createdAt := .Date.Format .Site.Params.date_format }}
  41. {{ range $index, $month := slice "January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December" }}
  42. {{ $createdAt = replace $createdAt $month (i18n $month) }}
  43. {{ end }}
  44. {{ i18n "publishedOn" }} {{ $createdAt }}
  45. {{ end }}
  46. </p>
  47. {{ if not .Site.Params.recent_posts.hide_summary }}
  48. <p class="intro">{{ .Summary }}</p>
  49. <p class="read-more">
  50. <a href="{{ .Permalink }}" class="btn btn-template-main">{{ i18n "continueReading" }}</a>
  51. </p>
  52. {{ end }}
  53. </div>
  54. </div>
  55. <!-- /.box-image-text -->
  56. </div>
  57. {{ end }}
  58. </div>
  59. <!-- /.row -->
  60. <!-- *** BLOG HOMEPAGE END *** -->
  61. </div>
  62. </div>
  63. <!-- /.container -->
  64. </section>
  65. <!-- /.bar -->
  66. {{ end }}
  67. {{ end }}