Markdown batch import


I have a gatsby blog which has about 1000 markdown files right now and I would like to migrate everything to Cockpit. How can I batch-import markdown files into cockpit?


Afaik there is no markdown file import functionality.
Import is only possible for CSV or JSON exports.

But Cockpit is “markdown-ready”, as it has a field type markdown and also the html field type supports markdown as input if you configurate it accordingly.

So you’d be able to

  • generate a collection for your pages
  • with a content field of type markdown (or html)

and now you can
A) write a script that outputs your markdown files as a long JSON or CSV formed file which you can then use for the supported import methods (via CLI, admin interface)


B) write a function that reads in your markdown files and pushes their content (maybe together with e.g. a title, slug, some-previous-id) via the API into your Cockpit DB