news-main.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <div class="news-main container">
  2. <div class="row">
  3. {{ $pages := first 4 (where .Site.Pages "Params.type" "main") }}
  4. <!-- index 0 -->
  5. <div class="col-lg-6">
  6. {{ with index $pages 0 }}
  7. <div class="border rounded overflow-hidden position-relative h-100">
  8. <a href="{{ .Permalink }}">
  9. <img src="{{ .Params.image | relURL }}" alt="{{ .Params.title }}" class="img-fluid main-img">
  10. </a>
  11. <div class="p-3 title-info">
  12. {{ range (.GetTerms "categories") }}
  13. <a href="{{ .Permalink }}" class="me-2 badge-link">{{ .Params.title }}</a>
  14. {{ end }}
  15. <h2>
  16. <a href="{{ .Params.url }}">{{ .Params.title }}</a>
  17. </h2>
  18. <small class="d-block">{{ .Date | time.Format ":date_long" }}</small>
  19. </div>
  20. </div>
  21. {{ end }}
  22. </div>
  23. <!-- 右側 -->
  24. <div class="col-lg-6">
  25. {{ range $index, $page := $pages }}
  26. {{ if eq $index 1 }}
  27. <!-- index 1 -->
  28. <div class="d-flex mt-3 mt-lg-0 mb-3 border rounded overflow-hidden position-relative">
  29. <a href="{{ $page.Permalink }}" class="w-100">
  30. <img src="{{ $page.Params.image | relURL }}" alt="{{ $page.Params.title }}" class="img-fluid main-img">
  31. </a>
  32. <div class="p-3 title-info">
  33. {{ range ($page.GetTerms "categories") }}
  34. <a href="{{ .Permalink }}" class="me-2 badge-link">{{ .LinkTitle }}</a>
  35. {{ end }}
  36. <h2>
  37. <a href="{{ $page.Params.url }}">{{ $page.Params.title }}</a>
  38. </h2>
  39. <small class="d-block">{{ $page.Date | time.Format ":date_long" }}</small>
  40. </div>
  41. </div>
  42. {{ end }}
  43. {{ if eq $index 2 }}
  44. <!-- index 2 & 3 -->
  45. <div class="row g-3">
  46. {{ end }}
  47. {{ if or (eq $index 2) (eq $index 3) }}
  48. <div class="col-sm-6">
  49. <div class="border rounded overflow-hidden position-relative h-100">
  50. <a href="{{ $page.Permalink }}">
  51. <img src="{{ $page.Params.image | relURL }}" alt="{{ $page.Params.title }}" class="img-fluid">
  52. </a>
  53. <div class="p-3 title-info">
  54. <h2>
  55. <a href="{{ $page.Params.url }}">{{ $page.Params.title }}</a>
  56. </h2>
  57. <small class="td-block">{{ $page.Date | time.Format ":date_long" }}</small>
  58. </div>
  59. </div>
  60. </div>
  61. {{ end }}
  62. {{ if eq $index 3 }}
  63. </div>
  64. {{ end }}
  65. {{ end }}
  66. </div>
  67. </div>
  68. </div>
  69. <!-- <div class="news-main mt-3 mt-lg-0">
  70. {{ range first 2 (where .Site.Pages "Params.type" "main") }}
  71. <div class="col-12 mb-3 d-flex flex-column-reverse flex-lg-column">
  72. <div>
  73. <section class="news-info">
  74. {{ range (.GetTerms "categories") }}
  75. <a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
  76. {{ end }}
  77. <small>{{ .Date | time.Format ":date_long" }}</small>
  78. </section>
  79. <h2 class="post-title my-0 my-lg-3">
  80. <a href="{{ .Params.url }}">{{ .Params.title }}</a>
  81. </h2>
  82. </div>
  83. <a href="{{ .Permalink }}">
  84. <img class="img-fluid" src="{{ .Params.image | relURL }}" alt="" />
  85. </a>
  86. </div>
  87. {{ end }}
  88. </div> -->