apps/posts/templates/admin_import.html 1.4 K raw
1
{{define "admin_import.html"}}{{template "admin_base.html" .}}{{end}}
2
{{define "title"}}Admin — Import{{end}}
3
{{define "content"}}
4
  <div class="admin-toolbar">
5
    <h2>Import posts</h2>
6
  </div>
7
  {{if .Error}}<p class="error">{{.Error}}</p>{{end}}
8
  {{if .Imported}}
9
    <p class="success">Imported {{.Imported}} posts, skipped {{if .Skipped}}{{.Skipped}}{{else}}0{{end}}.</p>
10
  {{end}}
11
  <form method="POST" action="/admin/import" enctype="multipart/form-data" class="form">
12
    <label for="zip">upload zip of markdown files (max 50MB)</label>
13
    <input type="file" id="zip" name="zip" accept=".zip" required>
14
    <button type="submit">import</button>
15
  </form>
16
  <section>
17
    <h3>Format</h3>
18
    <p>The zip can contain any number of <code>.md</code> or <code>.markdown</code> files. Each file may begin with YAML-style frontmatter:</p>
19
    <pre><code>---
20
title: My Post
21
slug: my-post
22
status: published
23
published_date: 2025-01-15T10:00:00Z
24
tags: rust, sqlite
25
description: A short summary
26
lang: en
27
---
28
29
# Hello
30
31
Post body in markdown.
32
</code></pre>
33
    <p>Supported keys: <code>title</code>, <code>slug</code>, <code>status</code> (<code>draft</code> or <code>published</code>), <code>published_date</code>, <code>tags</code>, <code>description</code>, <code>meta_image</code>, <code>alias</code>, <code>lang</code>. Files without frontmatter are imported with the title derived from the filename. Posts whose slug already exists are skipped.</p>
34
  </section>
35
{{end}}