list.html 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <!DOCTYPE html>
  2. <html lang="{{ .Site.LanguageCode }}">
  3. {{ partial "head.html" . }}
  4. <body>
  5. <div id="all">
  6. {{ partial "nav.html" . }}
  7. {{ partial "breadcrumbs.html" . }}
  8. <div id="content">
  9. <div class="container">
  10. <div class="row">
  11. <div class="col-md-9" id="blog-listing-medium">
  12. {{ $paginator := .Paginate (where .Data.Pages "Type" "blog") }}
  13. {{ range $paginator.Pages }}
  14. <section class="post">
  15. <div class="row">
  16. <div class="col-md-4">
  17. <div class="image">
  18. <a href="{{ .Permalink }}">
  19. {{ if .Params.banner }}
  20. <img src="{{ .Params.banner | relURL }}" class="img-responsive" alt="">
  21. {{ else }}
  22. <img src="{{ " img/placeholder.png" | relURL }}" class="img-responsive" alt="">
  23. {{ end }}
  24. </a>
  25. </div>
  26. </div>
  27. <div class="col-md-8">
  28. <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
  29. <div class="clearfix">
  30. <p class="author-category">
  31. {{ if isset .Params "author" }}
  32. {{ i18n "authorBy" }} <a href="#">{{ .Params.author }}</a>
  33. {{ end }}
  34. {{ if isset .Params "categories" }}
  35. {{ if gt (len .Params.categories) 0 }}
  36. in <a href="{{ "categories/" | relURL }}{{ index .Params.categories 0 | urlize | lower }}">{{
  37. index .Params.categories 0 }}</a>
  38. {{ end }}
  39. {{ end }}
  40. </p>
  41. {{ if isset .Params "date" }}
  42. <p class="date-comments">
  43. <a href="{{ .Permalink }}"><i class="far fa-calendar"></i> {{ .Date.Format
  44. .Site.Params.date_format }}</a>
  45. </p>
  46. {{ end }}
  47. </div>
  48. <!-- <p class="intro">{{ .Summary }}</p> -->
  49. {{ $maxSummaryLength := 200 }} <!-- 設定顯示的最大字數 -->
  50. <!-- 判斷是否需要省略 Summary -->
  51. {{ if gt (len .Summary) $maxSummaryLength }}
  52. <!-- 若 Summary 超過顯示的最大字數則省略 -->
  53. <p class="intro">{{ substr .Summary 0 $maxSummaryLength }}...</p>
  54. {{ else }}
  55. <!-- 未超過則直接顯示 -->
  56. <p class="intro">{{ .Summary }}</p>
  57. {{ end }}
  58. <p class="read-more"><a href="{{ .Permalink }}" class="btn btn-template-main">{{ i18n
  59. "continueReading" }}</a>
  60. </p>
  61. </div>
  62. </div>
  63. </section>
  64. {{ end }}
  65. <ul class="pager">
  66. {{ if .Paginator.HasPrev }}
  67. <li class="previous"><a href="{{ .Paginator.Prev.URL | relURL }}">&larr; {{ i18n "newer" }}</a></li>
  68. {{ else }}
  69. <li class="previous disabled"><a href="#">&larr; {{ i18n "newer" }}</a></li>
  70. {{ end }}
  71. {{ if .Paginator.HasNext }}
  72. <li class="next"><a href="{{ .Paginator.Next.URL | relURL }}">{{ i18n "older" }} &rarr;</a></li>
  73. {{ else }}
  74. <li class="next disabled"><a href="#">{{ i18n "older" }} &rarr;</a></li>
  75. {{ end }}
  76. </ul>
  77. </div>
  78. <div class="col-md-3">
  79. {{ partial "sidebar.html" . }}
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. {{ partial "LP_components/Footer.html" . }}
  85. </div>
  86. {{ partial "scripts.html" . }}
  87. </body>
  88. </html>