posts.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. {{ $ := .root }}
  2. {{ $page := .page }}
  3. {{ $posts_len := len (where (where $.Data.Pages "Type" "post") ".Params.notonhomepage" nil) }}
  4. {{ if gt $posts_len 0 }}
  5. <!-- Blog Posts widget -->
  6. <section id="posts" class="home-section">
  7. <div class="container">
  8. <div class="row">
  9. <div class="col-xs-12 col-md-4 section-heading">
  10. <h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
  11. {{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
  12. {{ if gt $posts_len $page.Params.count }}
  13. <p class="view-all">
  14. <a href="{{ "/post/" | relURL }}">
  15. {{ with $page.Params.str_all }}{{ . | markdownify }}{{ end }}
  16. <i class="fa fa-angle-double-right"></i>
  17. </a>
  18. </p>
  19. {{ end }}
  20. </div>
  21. <div class="col-xs-12 col-md-8">
  22. {{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
  23. {{ range first $page.Params.count (where (where $.Data.Pages "Type" "post") ".Params.notonhomepage" nil) }}
  24. <div class="article-list-item" itemscope itemprop="blogPost">
  25. {{ if .Params.image }}
  26. <a href="{{ .Permalink }}">
  27. <img src="{{ "/img/" | relURL }}{{ .Params.image }}" class="article-banner"
  28. itemprop="image">
  29. </a>
  30. {{end}}
  31. <h3 class="article-title" itemprop="name">
  32. <a href="{{ .Permalink }}" itemprop="url">{{.Title }}</a>
  33. </h3>
  34. {{ partial "article_metadata" (dict "content" . "is_list" 1) }}
  35. <p class="article-style" itemprop="articleBody">
  36. {{ if .Params.summary }}
  37. {{ printf "%s" .Params.summary | markdownify }}
  38. {{ else if .Truncated }}
  39. {{ printf "%s" .Summary | markdownify }}
  40. {{ else }}
  41. {{ .Content }}
  42. {{ end }}
  43. </p>
  44. <p class="read-more">
  45. <a href="{{ .Permalink }}" class="btn btn-primary btn-outline">
  46. {{ with $page.Params.str_read_more }}{{ . | markdownify }}{{ end }}
  47. </a>
  48. </p>
  49. </div>
  50. {{ end }}
  51. </div>
  52. </div>
  53. </div>
  54. </section>
  55. {{ end }}