Posts frontmatter and image display

I’ve looked for a help topic covering my doubt but couldn’t find one, so I’ll try to explain what I’d like to achieve.

English is not my mother language and sometimes I write in Brazilian Portuguese. Now, I’ve used Hugo in some blogs in the past and I know every post has a front matter, suppose:

title = 'My Brazilian Portuguese post'
date = '2021-04-06'

My first question is very basic: can I include a frontmatter in my posts? Supposing I can, I’d like to include an additional field in it, say, language so that everytime I set it to Portuguese, I can get the corresponding value in my theme and display a Brazilian flag in SVG format beside the post title.

Now, is there any way I can achieve this?

Any help or tips are much appreciated.
Thanks!

Daniel

This isn’t possible right now because Micro.blog manages the frontmatter for you. If all your posts are in Portuguese, you can use a custom theme to set the language everywhere, but not on a per-post basis.

This is something we need to fix. We’ve talked about having some kind of interface for adding custom fields to the frontmatter.

Another work-around would be to use categories like “English” and “Portuguese”. Then you could edit the templates in your theme to show the flag if the category was set. Let us know if you want to try that and someone here (or me) can offer some tips.

Hey, @manton! Thanks for the answer!

I guess the second approach would favor me most. Could you please elaborate a little more on how could I tinker with my templates in order to define whether I have a post on the “Portuguese” category?

From this starting point I’m sure I’ll be able to go ahead on my own.

Thanks again!