Separate meta/md content

Hello,

I would like my posts to have two files - a meta file with post/slug/datetime etc and a md file with the post text.

Does Hugo currently support this?

Cheers,

William

No…

@Will_Mckee, now that you know front matter goes at the top of your content files, what were you trying to do with two separate files? I am curious, and I imagine I could find myself speaking to a client in the same situtation, so this is research. What is your use case? :slight_smile:

1 Like

I knew that the front matter goes at the top of content files - I’ve been using Nikola for several years and that’s one way of how Nikola works. Nikola also offers separate md/meta file support.

I would like to switch my blog from Nikola to Hugo. The md/meta files are currently separate.

It makes it easier when I perform a word count to have separate files.

I’ve had a go with writing a script that takes the md/meta file and merge them into one file that Hugo can read. This has been frustrating as Python is unable to append the meta data to the beginning of the file (only at the end). I get awful unicode errors when I attempt to open and read the md files. If the files opened I could rewrite them with the meta data at the beginning.

Overall I would rather keep the separate md/meta file, I guess best option is to put in a feature request and work on it myself.

Thanks

@Will_Mckee surely a language like python can take the metadata file and append the content file to the end of it; python is super versatile. As long as it’s consistent naming, you should also be able to write a quick bash script to cat them together.

If word count is the only driver, it seems like a pretty massive undertaking to add an option to allow separate metadata to hugo, when this is just a matter of finding an editor that will allow you to do that.

You should be able to count words after the second frontmatter marker easily, using whatever scripting language you like. Also I’ve seen editor functions that let you get the word count of a selection. You just select the content and run the command.

  • In vim, it’s select, then g, ctrl-g. (acts on the current buffer, so if you don’t select, it’s finding the count for the whole doc)
  • Atom has a word count package.