list.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. {{ define "main" }}
  2. <section class="page-title3 bg-2">
  3. <div class="container">
  4. <div class="row">
  5. <div class="col-md-12 text-center">
  6. <h1>設計專欄</h1>
  7. </div>
  8. </div>
  9. </div>
  10. </section>
  11. <div class="page-wrapper" style="padding-top: 50px;">
  12. <div class="container">
  13. <div class="row">
  14. <div class="col-md-8">
  15. {{ $paginator := .Paginate .Data.Pages }}
  16. {{ range $paginator.Pages }}
  17. <div class="mb-5 post">
  18. <div class="mb-4">
  19. <a href="{{ .RelPermalink }}">
  20. <amp-img
  21. alt="{{ .Title }}"
  22. src="{{ .Params.Image | relURL }}"
  23. width="2664"
  24. height="956"
  25. layout="responsive">
  26. </amp-img>
  27. </a>
  28. </div>
  29. <a href="{{ .RelPermalink }}" style="color:#444444;" data-vars-event="accuhit" data-vars-event-type="6" data-vars-event-col1="{{ .Params.Col1 }}" data-vars-event-col2="{{ .Params.col2 }}" data-vars-event-col4="{{ .Params.title }}">
  30. <div class="title-size"><b>{{ .Title }}</b></div>
  31. </a>
  32. <p class="blog-content" style="font-size:0.8rem;">{{ .PublishDate.Format "January 2, 2006" }}</p>
  33. <div class="blog-content">
  34. <p class="card-text" style="color:#4D4D4D;">{{ .Summary }}</p>
  35. <a href="{{ .RelPermalink }}" class="btn btn-light">繼續閱讀</a>
  36. </div>
  37. </div>
  38. <!-- <div class="mb-5 post">
  39. <div class="mb-4">
  40. <a href="{{ .Permalink }}">
  41. <amp-img
  42. alt="{{ .Title }}"
  43. src="{{ .Params.Image | relURL }}"
  44. width="2664"
  45. height="956"
  46. layout="responsive">
  47. </amp-img>
  48. </a>
  49. </div>
  50. <h3><a href="{{ .Permalink }}" style="color:black;"><b>{{ .Title }}</b></a></h3>
  51. <p class="blog-content" style="font-size:0.8rem;">{{ .PublishDate.Format "January 2, 2006" }}</p>
  52. <div class="blog-content">
  53. <p>{{ .Summary }}</p>
  54. <a href="{{ .Permalink }}" class="btn btn-light">繼續閱讀</a>
  55. </div>
  56. </div> -->
  57. {{ end }}
  58. <!-- pagination -->
  59. {{ $paginator := .Paginator }}
  60. {{ $adjacent_links := 2 }}
  61. {{ $max_links := (add (mul $adjacent_links 2) 1) }}
  62. {{ $lower_limit := (add $adjacent_links 1) }}
  63. {{ $upper_limit := (sub $paginator.TotalPages $adjacent_links) }}
  64. {{ if gt $paginator.TotalPages 1 }}
  65. <nav class="text-center">
  66. <ul class="pagination post-pagination">
  67. <!-- Previous page. -->
  68. {{ if $paginator.HasPrev }}
  69. <li>
  70. <a href="{{ $paginator.Prev.URL }}" class="page-link">上一頁</a>
  71. </li>
  72. {{ end }}
  73. <!-- Page numbers. -->
  74. {{ range $paginator.Pagers }}
  75. {{ $.Scratch.Set "page_number_flag" false }}
  76. <!-- Advanced page numbers. -->
  77. {{ if gt $paginator.TotalPages $max_links }}
  78. <!-- Lower limit pages. -->
  79. <!-- If the user is on a page which is in the lower limit. -->
  80. {{ if le $paginator.PageNumber $lower_limit }}
  81. <!-- If the current loop page is less than max_links. -->
  82. {{ if le .PageNumber $max_links }}
  83. {{ $.Scratch.Set "page_number_flag" true }}
  84. {{ end }}
  85. <!-- Upper limit pages. -->
  86. <!-- If the user is on a page which is in the upper limit. -->
  87. {{ else if ge $paginator.PageNumber $upper_limit }}
  88. <!-- If the current loop page is greater than total pages minus $max_links -->
  89. {{ if gt .PageNumber (sub $paginator.TotalPages $max_links) }}
  90. {{ $.Scratch.Set "page_number_flag" true }}
  91. {{ end }}
  92. <!-- Middle pages. -->
  93. {{ else }}
  94. {{ if and ( ge .PageNumber (sub $paginator.PageNumber $adjacent_links) ) ( le .PageNumber (add $paginator.PageNumber $adjacent_links) ) }}
  95. {{ $.Scratch.Set "page_number_flag" true }}
  96. {{ end }}
  97. {{ end }}
  98. <!-- Simple page numbers. -->
  99. {{ else }}
  100. {{ $.Scratch.Set "page_number_flag" true }}
  101. {{ end }}
  102. <!-- Output page numbers. -->
  103. {{ if eq ($.Scratch.Get "page_number_flag") true }}
  104. <li class="{{ if eq . $paginator }} active {{ end }}">
  105. <a href="{{ .URL }}">
  106. {{ .PageNumber }}
  107. </a>
  108. </li>
  109. {{ end }}
  110. {{ end }}
  111. <!-- Next page. -->
  112. {{ if $paginator.HasNext }}
  113. <li>
  114. <a href="{{ $paginator.Next.URL }}">下一頁</a>
  115. </li>
  116. {{ end }}
  117. </ul>
  118. </nav>
  119. {{ end }}
  120. </div>
  121. <div class="col-md-4">
  122. {{ partial "blog-sidebar.html" . }}
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. {{ end }}