Front Matter Formatting

Hi all

I have what feels like a bit of a silly question, but alas, here I am. :blush:

I want to tidy up my front matter declarations—purely from an aesthetic point of view.

However, unsurprisingly, things break as soon as I introduce a new line or tabs within a string value.

For example, I’ve recently started using the Summary option in my front matter like so:

However, as shown at the location indicated by the arrow, the string wraps due to its continuous nature, making it appear messy.

Is there a way to prevent this? I know that in other languages, such as PowerShell, you can insert a ‘new line’ character without breaking the string. However, I’m struggling to find the equivalent for this case.

Ideally, I’d like to format it like this:

+++
date            = '2025-06-01T06:01:32+01:00'
author          = "Lee Brownhill"
title           = 'Parallelism Problems within SQL Server'
draft           = false
summary         = 'lorem ipsum dolor sit amet, consectetur adipiscing elit
                   lorem ipsum dolor sit amet, consectetur adipiscing elit
                   lorem ipsum dolor sit amet, consectetur adipiscing elit.'
+++

I have since answered my own question, so thought i would put the answer here in case anybody else has the same issue.

Ultimately, the use of triple quotes will allow the behavior i was after.

Using the same example as per my question, I can use it like this:

+++
date            = '2025-06-01T06:01:32+01:00'
author          = "Lee Brownhill"
title           = 'Parallelism Problems within SQL Server'
draft           = false
summary         = """lorem ipsum dolor sit amet, consectetur adipiscing elit
                   lorem ipsum dolor sit amet, consectetur adipiscing elit
                   lorem ipsum dolor sit amet, consectetur adipiscing elit."""
+++


2 Likes

By default Hugo’s config and frontmatter uses TOML. So its rules apply and it looks like you learned one. If you have any similar questions in the future, if you just look up how to do it in TOML, you may be able to figure it out.

Optionally, it can be converted to YAML or JSON as well (using different characters to wrap the frontmatter for instance), so if you do so for your sites or you’re modifying a theme that uses either of those serialization or config languages instead, you’ll have to research and follow said rules for those as well.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.