<!DOCTYPE html>
<html>
<head>
  <title>Edit Blog - <%= blog.title %></title>
  <meta charset="UTF-8">
</head>
<body>
  <h1>Edit Blog</h1>

  <form method="POST" action="/admin/edit/<%= blog.id %>" enctype="multipart/form-data">
    <label>Title:<br>
      <input name="title" value="<%= blog.title %>" required>
    </label><br>

    <label>Slug:<br>
      <input name="slug" value="<%= blog.slug %>" required>
    </label><br>

    <label>Background Image:<br>
      <% if (blog.Imgbg) { %>
        <img src="/uploads/<%= blog.Imgbg %>" width="100"><br>
      <% } %>
      <input type="file" name="imgbg">
    </label><br>
    <label>Alt text:<br>
      <input name="imgbg_alt" value="<%= blog.imgbg_alt || '' %>">
    </label><br>

    <label>Page 1:<br>
      <textarea name="pg1"><%= blog.pg1 || '' %></textarea>
    </label><br>

    <label>Page 2:<br>
      <textarea name="pg2"><%= blog.pg2 || '' %></textarea>
    </label><br>

    <label>Image 1:<br>
      <% if (blog.Img1) { %>
        <img src="/uploads/<%= blog.Img1 %>" width="100"><br>
      <% } %>
      <input type="file" name="Img1">
    </label><br>
    <label>Alt text:<br>
      <input name="img1_alt" value="<%= blog.img1_alt || '' %>">
    </label><br>

    <label>Image 2:<br>
      <% if (blog.Img2) { %>
        <img src="/uploads/<%= blog.Img2 %>" width="100"><br>
      <% } %>
      <input type="file" name="Img2">
    </label><br>
    <label>Alt text:<br>
      <input name="img2_alt" value="<%= blog.img2_alt || '' %>">
    </label><br>

    <label>Image 3:<br>
      <% if (blog.Img3) { %>
        <img src="/uploads/<%= blog.Img3 %>" width="100"><br>
      <% } %>
      <input type="file" name="Img3">
    </label><br>
    <label>Alt text:<br>
      <input name="img3_alt" value="/uploads/<%= blog.img3_alt || '' %>">
    </label><br>

    <label>Tags:<br>
      <input name="tags" value="<%= blog.tags || '' %>">
    </label><br>

    <label>Heading 1:<br>
      <input name="hed1" value="<%= blog.hed1 || '' %>">
    </label><br>

    <label>H1 Paragraph:<br>
      <textarea name="hpg1"><%= blog.hpg1 || '' %></textarea>
    </label><br>

    <label>Heading 2:<br>
      <input name="hed2" value="<%= blog.hed2 || '' %>">
    </label><br>

    <label>H2 Paragraph:<br>
      <textarea name="hpg2"><%= blog.hpg2 || '' %></textarea>
    </label><br>

    <h3>SEO Settings</h3>
    <label>SEO Title:<br>
      <input name="seo_title" value="<%= blog.seo_title || '' %>">
    </label><br>

    <label>Meta Description:<br>
      <input name="seo_description" value="<%= blog.seo_description || '' %>">
    </label><br>

    <label>Canonical URL:<br>
      <input name="seo_canonical" value="<%= blog.seo_canonical || '' %>">
    </label><br>

    <label>Focus Keyphrase<br>
      <input name="focus_keyphrase" value="<%= blog.focus_keyphrase || '' %>">
    </label><br>

    <label>Robots Index:<br>
      <select name="seo_robots_index">
        <option value="index" <%= blog.seo_robots_index === 'index' ? 'selected' : '' %>>index</option>
        <option value="noindex" <%= blog.seo_robots_index === 'noindex' ? 'selected' : '' %>>noindex</option>
      </select>
    </label><br>

    <label>Robots Follow:<br>
      <select name="seo_robots_follow">
        <option value="follow" <%= blog.seo_robots_follow === 'follow' ? 'selected' : '' %>>follow</option>
        <option value="nofollow" <%= blog.seo_robots_follow === 'nofollow' ? 'selected' : '' %>>nofollow</option>
      </select>
    </label><br>

    <h4>Open Graph</h4>
    <label>OG Title:<br>
      <input name="og_title" value="<%= blog.og_title || '' %>">
    </label><br>

    <label>OG Description:<br>
      <input name="og_description" value="<%= blog.og_description || '' %>">
    </label><br>

    <label>OG Type:<br>
      <input name="og_type" value="<%= blog.og_type || '' %>">
    </label><br>

    <label>OG URL:<br>
      <input name="og_url" value="<%= blog.og_url || '' %>">
    </label><br>

    <label>OG Site Name:<br>
      <input name="og_site_name" value="<%= blog.og_site_name || '' %>">
    </label><br>

    <label>OG Locale:<br>
      <input name="og_locale" value="<%= blog.og_locale || '' %>">
    </label><br>

    <label>OG Image:<br>
      <% if (blog.og_image_url) { %>
        <img src="/uploads/<%= blog.og_image_url %>" width="100"><br>
      <% } %>
      <input type="file" name="og_image_url">
    </label><br>
    <label>Alt text:<br>
      <input name="og_image_alt" value="<%= blog.og_image_alt || '' %>">
    </label><br>

    <label>OG Image Width:<br>
      <input name="og_image_width" value="<%= blog.og_image_width || '' %>">
    </label><br>

    <label>OG Image Height:<br>
      <input name="og_image_height" value="<%= blog.og_image_height || '' %>">
    </label><br>

    <label>OG Image Type:<br>
      <input name="og_image_type" value="<%= blog.og_image_type || '' %>">
    </label><br>

    <label>Modified Time:<br>
      <input name="article_modified_time" value="<%= blog.article_modified_time || '' %>">
    </label><br>

    <label>Twitter Card:<br>
      <input name="twitter_card" value="<%= blog.twitter_card || '' %>">
    </label><br>

    <label>Published?<br>
      <select name="is_published">
        <option value="1" <%= blog.is_published ? 'selected' : '' %>>Yes</option>
        <option value="0" <%= !blog.is_published ? 'selected' : '' %>>No</option>
      </select>
    </label><br><br>

    <button type="submit">Update Blog</button>
  </form>

  <a href="/admin/dashboard">← Back to Dashboard</a>
</body>
</html>
