HUGO

Analyze Front Matter en masse

Hi all. This isn’t a Hugo-specific question per se, but since Hugo content is stored as Markdown, this felt like the right place to start. Does anyone know of a good way (technique or tools) to view the Front Matter of multiple .md files en masse, perhaps in some table format? I realize Front Matter can be of type Array and that would, I suppose, break any sort of flat table visualization like CSV or Excel. My use case is that I want to view properties of certain key-value pairs like Title and Description to check for length, for SEO purposes.

I added a mockup of what I’m after… I can imagine this would be very useful to identify missing key-value pairs if they weren’t created via archetypes or were somehow erroneously deleted.

Any tips and tricks here would be great. Thanks!

You could output such a table by configuring a Custom Output Format and using Hugo functions to iterate over every content file.

As for the missing keys you could use something like: {{ .Params.param | default "n/a" }}

ref: default | Hugo

1 Like