<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <!-- BOOTSTRAP CDN - CSS only -->
    <link
      href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css"
      rel="stylesheet"
      integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl"
      crossorigin="anonymous"
    />

    <!-- GOOGLE FONTS CDN -->
    <link
      href="https://fonts.googleapis.com/css2?family=Encode+Sans+Expanded:wght@400;700&display=swap"
      rel="stylesheet"
    />

    <title>Blog</title>
  </head>

  <!-- INTERNAL CSS -->
  <style>
    * {
      font-family: 'Encode Sans Expanded', sans-serif;
    }

    img {
      width: 100%;
    }
  </style>

  <body>
    <div class="container py-4">
      <div class="row mt-4">
        <div class="mb-6 col-md-8">
          <h1 class="mb-4 text-uppercase"><%= article.title %></h1>

          <div class="card">
            <img
              class="card-img-top"
              src="<%= article.image %>"
              alt="<%= article.title %>"
            />

            <div class="card-body">
              <p class="text-muted fs-6">
                <%= article.createdAt.toLocaleDateString('en-US', { weekday:
                'long', year: 'numeric', month: 'long', day: 'numeric' }) %>
              </p>
              <p class="card-text"><%- article.sanitizedHTML %></p>
            </div>
          </div>

          <div class="mt-4">
            <a href="/" class="btn btn-secondary me-2">Back</a>
            <a
              href="/article/edit/<%= article._id %> "
              class="btn btn-outline-primary"
              >Update</a
            >
          </div>
        </div>
      </div>
    </div>
  </body>
</html>
