Apostrophe in front matter title

Hello all:

I am using:
hugo v0.143.1+extended+withdeploy darwin/arm64 BuildDate=2025-02-04T08:57:38Z VendorInfo=brew

This is my first time running into this, and I am unsure of the fix.
In my front matter, if I have an apostrophe (') in the title field, I get the following error when trying to start the server:

Error: error building site: process: readAndProcessContent: "/Users/originaltrini0/projects/gitlab/hugo/gerardsamuel.me/content/posts/homelab/reverse-proxying-with-cilium-gateway-api-cert-manager/index.md:1:1": failed to unmarshal YAML: yaml: did not find expected key

I found a similar post where they talked about piping Title through safeHTMLAttr, but that didn’t fix the error.
Could anyone shed any light on the error? Is this a bug, or am I mishandling it in my code?

Thanks

Theres nothing speical about escaping Frontmatter

---
title: "P'st's 1"
params:
   "hello's": "hello'"
---

So there’s something around. Would be much easier to post your frontmatter

Brainfart on my part. I just noticed that the title was already enclosed in single quotes.
That is the root cause of my issue.
Thanks for idea!

1 Like

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