list.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge, Chrome=1">
  7. <meta http-equiv="Cache-Control" content="no-cache">
  8. <title>Choozmo Marketing Cloud</title>
  9. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
  10. integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  11. <link rel="stylesheet" href="//use.fontawesome.com/releases/v5.11.2/css/all.css">
  12. <link rel="stylesheet" href="/css/style.css">
  13. <link rel="stylesheet" href="/css/custom.css">
  14. </head>
  15. <body>
  16. {{ partial "navbar.html" . }}
  17. <main class="container news-content" style="overflow-x: hidden;">
  18. <ul id="categories">
  19. <li>
  20. <button id="all">
  21. <a href="/main-news/">所有訊息</a>
  22. </button>
  23. </li>
  24. <li>
  25. <button id="focus">
  26. <a href="/main-news/focus/">焦點訊息</a>
  27. </button>
  28. </li>
  29. <li>
  30. <button id="serve">
  31. <a href="/main-news/serve/">最新服務</a>
  32. </button>
  33. </li>
  34. </ul>
  35. {{ if eq (relURL .URL) ("/main-news/focus/") }}
  36. {{ $t := $.Site.GetPage "/main-news" }}
  37. <ul class="list">
  38. {{ range $index, $element := where $t.Pages "Params.categories" "焦點訊息" }}
  39. {{ $t := $.Site.GetPage "/main-news" }}
  40. <li>
  41. <a href="{{ .RelPermalink }}">
  42. <h2>{{ .Title }}</h2>
  43. </a>
  44. <hr>
  45. <section class="d-flex justify-content-between">
  46. <p class="news-category">{{ .Params.categories }}</p>
  47. <p>{{ .PublishDate.Format "2006-01-02" }}</p>
  48. </section>
  49. <a href="{{ .RelPermalink }}" class="content">
  50. <p>{{.Summary}}</p>
  51. </a>
  52. <div class="more-btn">
  53. <a href="{{ .RelPermalink }}">
  54. 閱讀文章
  55. </a>
  56. </div>
  57. </li>
  58. {{ end }}
  59. </ul>
  60. {{ end }}
  61. {{ if eq (relURL .URL) ("/main-news/serve/") }}
  62. {{ $t := $.Site.GetPage "/main-news" }}
  63. <ul class="list">
  64. {{ range $index, $element := where $t.Pages "Params.categories" "最新服務" }}
  65. {{ $t := $.Site.GetPage "/main-news" }}
  66. <li>
  67. <a href="{{ .RelPermalink }}">
  68. <h2>{{ .Title }}</h2>
  69. </a>
  70. <hr>
  71. <section class="d-flex justify-content-between">
  72. <p class="news-category">{{ .Params.categories }}</p>
  73. <p>{{ .PublishDate.Format "2006-01-02" }}</p>
  74. </section>
  75. <a href="{{ .RelPermalink }}" class="content">
  76. <p>{{.Summary}}</p>
  77. </a>
  78. <div class="more-btn">
  79. <a href="{{ .RelPermalink }}">
  80. 閱讀文章
  81. </a>
  82. </div>
  83. </li>
  84. {{ end }}
  85. </ul>
  86. {{ end }}
  87. {{ $paginator := .Paginate .Data.Pages }}
  88. <ul class="list">
  89. {{ range $paginator.Pages }}
  90. {{ $t := $.Site.GetPage "/main-news" }}
  91. {{ if ne .Params.categories "url" }} <!-- 排除分類用的 content -->
  92. <li>
  93. <a href="{{ .RelPermalink }}">
  94. <h2>{{ .Title }}</h2>
  95. </a>
  96. <hr>
  97. <section class="d-flex justify-content-between">
  98. <p class="news-category">{{ .Params.categories }}</p>
  99. <p>{{ .PublishDate.Format "2006-01-02" }}</p>
  100. </section>
  101. <a href="{{ .RelPermalink }}" class="content">
  102. <p>{{.Summary}}</p>
  103. </a>
  104. <div class="more-btn">
  105. <a href="{{ .RelPermalink }}">
  106. 閱讀文章
  107. </a>
  108. </div>
  109. </li>
  110. {{ end }}
  111. {{ end }}
  112. </ul>
  113. </main>
  114. {{ partial "footer.html" . }}
  115. <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"
  116. integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p"
  117. crossorigin="anonymous"></script>
  118. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js"
  119. integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF"
  120. crossorigin="anonymous"></script>
  121. <script src="//code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
  122. crossorigin="anonymous"></script>
  123. <script>
  124. let pathname = window.location.pathname;
  125. $('.news-content button').removeClass('active');
  126. if (pathname.includes('focus')) {
  127. $('.news-content #focus').addClass('active');
  128. } else if (pathname.includes('serve')) {
  129. $('.news-content #serve').addClass('active');
  130. } else {
  131. $('.news-content #all').addClass('active');
  132. }
  133. </script>
  134. </body>
  135. </html>