gohugoio / hugoDocs

The source for https://gohugo.io/
Apache License 2.0
1.05k stars 1.48k forks source link

Document restricted first character for content files without front matter #2703

Open McShelby opened 2 days ago

McShelby commented 2 days ago

As a follow up of https://github.com/gohugoio/hugo/issues/12855, I kindly ask to document the limitations of Markdown if no front matter is defined:

Front matter is optional, but can't begin with a character that matches the characters in front matter delimiters: -, +, {.

I am not sure, if this is only the case for page resources or pages in general. At the moment I think, a good location to add this would be https://gohugo.io/content-management/formats/#markdown

jmooring commented 2 days ago

The content format is irrelevant. If a content file does not include front matter, the first character must not be +, -, or {.

The only situation in which it might make sense to exclude front matter is when the content file is a page resource.

This page... https://gohugo.io/content-management/page-resources/

...needs a section titled "Resource types" where we refer to the ResourceType method and provide a tree structure example with annotations. Then include a note about front matter when ResourceType is page.

We can potentially address https://github.com/gohugoio/hugoDocs/issues/2428 at the same time.