# Migrating from another blog engine: zola could be more lenient with the frontmatter, especially around taxonomies

**URL:** <https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591>\
**Category:** Feature requests\
**Created:** [January 6, 2023, 2:01pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591 "2023-01-06T14:01:19Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpcaruana](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jpcaruana/32/894_2.png) [@jpcaruana](https://zola.discourse.group/u/jpcaruana)\
**Post date:** [January 6, 2023, 2:01pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/1 "2023-01-06T14:01:19Z")

</div>

Hi!  
I don’t know if anyone faced this issue (or is it a feature reqest?). Zola behaves very different from the other blog engines (Jekyll, Hugo to name the ones I know well).

My front matter looks like this in my (over 1000) md files:

```auto
+++
date = 2020-09-08T16:18:51+02:00
title = "Lire le cycle de l'Assassin Royal, c'est compliqué"
tags = ["livre"]
copy = "https://twitter.com/jpcaruana/status/1303356472705921026"
really_any_key_I_want = "any value"
+++

```

But I have to introduce taxonomies and extras, it seems unnecessary (and will prevent me from transitionning to zola as I’d have to update over 1000 frontmatters)

```auto
+++
date = 2020-09-08T16:18:51+02:00
title = "Lire le cycle de l'Assassin Royal, c'est compliqué"
[taxonomies]
tags = ["livre"]
[extra]
copy = "https://twitter.com/jpcaruana/status/1303356472705921026"
really_any_key_I_want = "any value"
+++

```

Did I miss something here? If not, why is zola so different here when compared to jekyll or hugo?

Thanks

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [January 6, 2023, 4:00pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/2 "2023-01-06T16:00:39Z")

</div>

It just happened initially to keep things simple but overall I would keep it that way. It’s cleaner imo to look at and easier internally in the codebase: everything is typed (except for the `extra` section obviously) immediately and you get the errors directly from parsing rather than zola trying to guess what it is. I’ve seen some sites with 100s of taxonomies, including common words, that were sometimes reused in `extra` as keys. With Jekyll/Hugo you would need to rename the extra field.

---

<div class="post-metadata">

**Author:** ![jpcaruana](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jpcaruana/32/894_2.png) [@jpcaruana](https://zola.discourse.group/u/jpcaruana)\
**Post date:** [January 6, 2023, 4:09pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/3 "2023-01-06T16:09:36Z")

</div>

I understand  
It makes migrating bigger code bases more challenging: I can’t imagine myself browsing over all my “hugo” content to fix the frontmatter.

I don’t know if there is some tool/script that would help me in doing that?

```auto
$ find content/ -name "*.md" | wc -l
    2638

```

---

<div class="post-metadata">

**Author:** ![dustinknopoff](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@dustinknopoff](https://zola.discourse.group/u/dustinknopoff)\
**Post date:** [January 6, 2023, 8:03pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/4 "2023-01-06T20:03:44Z")

</div>

This is a simplified version of a Deno script I’ve written which edits in place, moving keys into the extra and taxonomies tables

> <https://gist.github.com/dustinknopoff/0913e25d059f111f57045c904de25980>

---

<div class="post-metadata">

**Author:** ![jpcaruana](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jpcaruana/32/894_2.png) [@jpcaruana](https://zola.discourse.group/u/jpcaruana)\
**Post date:** [January 7, 2023, 3:10pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/5 "2023-01-07T15:10:59Z")

</div>

Great @dustinknopoff ! Thank you so much for sharing.

Sadly it does not detect TOML frontmatter contained within `+++` and not `---` (as described in [Front Matter |Hugo](https://gohugo.io/content-management/front-matter/#front-matter-formats)), and I don’t see where I could change your script to make it _read_ between `+++` (easy to make it write `+++` again)

---

<div class="post-metadata">

**Author:** ![dustinknopoff](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@dustinknopoff](https://zola.discourse.group/u/dustinknopoff)\
**Post date:** [January 7, 2023, 3:50pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/6 "2023-01-07T15:50:06Z")

</div>

I don’t know if you saw, but I commented an adjustment to that script which should work

---

<div class="post-metadata">

**Author:** ![jpcaruana](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jpcaruana/32/894_2.png) [@jpcaruana](https://zola.discourse.group/u/jpcaruana)\
**Post date:** [January 7, 2023, 4:17pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/7 "2023-01-07T16:17:53Z")

</div>

Thank you, I will give it a try (even if I now prefer TOML over YAML for frontmatter, for no reason)

---

<div class="post-metadata">

**Author:** ![adrianboston](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/adrianboston/32/907_2.png) [@adrianboston](https://zola.discourse.group/u/adrianboston)\
**Post date:** [January 17, 2023, 12:41am UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/8 "2023-01-17T00:41:39Z")

</div>

a solution is to use `sed` with `find`

it will be along the lines of the following:

> find . -name “\*.md” -exec sed -i saved ‘s/tags =/[taxanomies]\ntags =/’ {} ;

> find . -name “\*.md” -exec sed -i saved ‘s/copy =/[extra]\ncopy =/’ {} ;

i would run this only in a backup, gitted or copied folder to ensure it doesnt corrupt the original.  
even though `sed -i` saves a copy with the `saved` extension.

sed does the new line using `\n`

---

<div class="post-metadata">

**Author:** ![jpcaruana](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jpcaruana/32/894_2.png) [@jpcaruana](https://zola.discourse.group/u/jpcaruana)\
**Post date:** [January 25, 2023, 3:27pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/9 "2023-01-25T15:27:16Z")

</div>

Hi @adrianboston

thanks for the hint (and sorry for the late reply). I tried it, but as my frontmatter is not ordered (because, it is only a key/value context for hugoi), this simple sed command is not enough ☹

---

<div class="post-metadata">

**Author:** ![adrianboston](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/adrianboston/32/907_2.png) [@adrianboston](https://zola.discourse.group/u/adrianboston)\
**Post date:** [January 25, 2023, 10:02pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/10 "2023-01-25T22:02:49Z")

</div>

This is a basic substitution jitsu. All frontmatter has to be in the exact order/style/format you posted.

Basically it placed the string `[taxonomies]` before the string `'tags` and `[extra]` before `copy`

If it is as posted then it should work depending on your system OS.

One could do a more complex REGEX but you would need to post further examples. Are you still even interested in swapping to zola. As a hint, I’ve had no problem with zola. I would never use any ruby,python,node based ones that fills your machine with gems and perls.

---

<div class="post-metadata">

**Author:** ![jpcaruana](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jpcaruana/32/894_2.png) [@jpcaruana](https://zola.discourse.group/u/jpcaruana)\
**Post date:** [January 27, 2023, 10:54am UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/11 "2023-01-27T10:54:14Z")

</div>

> [@adrianboston](#):
>
> Are you still even interested in swapping to zola.

I am! 🙂

> [@adrianboston](#):
>
> I would never use any ruby,python,node based ones that fills your machine with gems and perls.

Sorry, I didn’t get what you mean here.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [January 27, 2023, 12:57pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/12 "2023-01-27T12:57:36Z")

</div>

I would write a script (python) that goes through your pages, extract the front-matter with a regex and load it using a toml library. You would have to hardcode the basic fields (date, title etc) and taxonomies in your script, everything else goes to `extra`. Then it can just regenerate the page with the new front-matter.

---

<div class="post-metadata">

**Author:** ![jpcaruana](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jpcaruana/32/894_2.png) [@jpcaruana](https://zola.discourse.group/u/jpcaruana)\
**Post date:** [January 27, 2023, 1:08pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/13 "2023-01-27T13:08:36Z")

</div>

ok, that what was on my mind too 🙂

---

<div class="post-metadata">

**Author:** ![adrianboston](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/adrianboston/32/907_2.png) [@adrianboston](https://zola.discourse.group/u/adrianboston)\
**Post date:** [January 27, 2023, 7:55pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/14 "2023-01-27T19:55:12Z")

</div>

try this which puts `[taxonomies]` before `tags` and `[extra]` after it. of course the assumption is that tags is the last entry prior to the non standard frontmatter.

```auto
sed -E 's/(tags .+)/[taxonomies]\n\1\n[extra]/' content/test.md

```

just copy paste your example above into a file called test.md. if it works as expected on the output then you can go about saving files.

im on macos. not sure what you are running.

Try this site out its great for testing regex

> **[regex101: build, test, and debug regex](https://regex101.com/r/b67Cxy/1)**
>
> Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.

---

<div class="post-metadata">

**Author:** ![jpcaruana](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/jpcaruana/32/894_2.png) [@jpcaruana](https://zola.discourse.group/u/jpcaruana)\
**Post date:** [January 28, 2023, 10:53am UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/15 "2023-01-28T10:53:58Z")

</div>

I ended up writting a python script [GitHub - jpcaruana/frontmatter\_switcher](https://github.com/jpcaruana/frontmatter_switcher). Works great for me 🙂 I had of 2500 md files to convert, so it had to do everything at once.  
Thank you for your help.

---

<div class="post-metadata">

**Author:** ![adrianboston](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/adrianboston/32/907_2.png) [@adrianboston](https://zola.discourse.group/u/adrianboston)\
**Post date:** [January 29, 2023, 10:45pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/16 "2023-01-29T22:45:15Z")

</div>

> [@jpcaruana](#):
>
> GitHub - jpcaruana/frontmatter\_switcher

ok

---

<div class="post-metadata">

**Author:** ![BobRocke](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/bobrocke/32/1439_2.png) [@BobRocke](https://zola.discourse.group/u/BobRocke)\
**Post date:** [April 1, 2025, 12:25pm UTC](https://zola.discourse.group/t/migrating-from-another-blog-engine-zola-could-be-more-lenient-with-the-frontmatter-especially-around-taxonomies/1591/17 "2025-04-01T12:25:03Z")

</div>

I’m coming into this conversation pretty late, and I’m a little bit sorry. But I’m glad I found it. The portability of markdown files has been on my mind lately as I consider switching my blog platform yet again (from Hugo to maybe Zola, this time).

Using scripts to convert ‘standard’ front matter to Zola front matter and potentially back to ‘standard’ format one day in the future has really cooled my jets.

A year later, have better solutions been developed?
