# Markdown batch import

**URL:** <https://discourse.getcockpit.com/t/markdown-batch-import/2086>\
**Category:** Support\
**Created:** [October 1, 2021, 12:25pm UTC](https://discourse.getcockpit.com/t/markdown-batch-import/2086 "2021-10-01T12:25:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![equinoxel](https://avatars.discourse-cdn.com/v4/letter/e/6de8d8/32.png) [@equinoxel](https://discourse.getcockpit.com/u/equinoxel)\
**Post date:** [October 1, 2021, 12:25pm UTC](https://discourse.getcockpit.com/t/markdown-batch-import/2086/1 "2021-10-01T12:25:14Z")

</div>

Hi,

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?

Cheers,

---

<div class="post-metadata">

**Author:** ![abernh](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/abernh/32/859_2.png) [@abernh](https://discourse.getcockpit.com/u/abernh)\
**Post date:** [October 1, 2021, 2:05pm UTC](https://discourse.getcockpit.com/t/markdown-batch-import/2086/2 "2021-10-01T14:05:17Z")

</div>

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)

OR

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
