You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
1.4 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  8. <title>Main page</title>
  9. </head>
  10. <body>
  11. <div class="container">
  12. <h1>Blog Articles Page <%= page %></h1>
  13. <%
  14. let pg = Number(page)
  15. for(let i = articles.length - 1 - (pg-1)*col; i >= Math.max(0, articles.length - pg*col); --i)
  16. { %>
  17. <div class="card mt-4">
  18. <div class="card-body">
  19. <h2 class="card-title"> <%= articles[i].title %> </h4>
  20. <h7 class="card-subtitle text-muted mb-2"> <%= articles[i].username %> </h7>
  21. <p class="card-text"> <%= articles[i].arttext %> </p>
  22. </div>
  23. </div>
  24. <% } %>
  25. <div class="mt-5">
  26. <a class="btn btn-primary <% if(pg <= 1){ %> disabled <% } %>" href="/articles?page=<%= pg-1 %>" > Previous Page</a>
  27. <a class="btn btn-primary <% if(pg >= (articles.length)/2) { %> disabled <% } %>" href="/articles?page=<%= pg+1 %>" > Next Page</a>
  28. </div>
  29. </div>
  30. </body>
  31. </html>