Needing help with titles in Netlify CMS

Titles in Netlify CMS

Under normal circumstances, the metadata of, for example, a title, is saved by adding this to the start of the file:

 ---
 title: This is the title of my document
 ---

However, for my particular setup, I would like the title to be added to the beginning of the document as a markdown (H1) header.

# This is the title of my document

Adjusting the title field would make it so that the first H1 markdown header of the document changes to the title that has been specified in that field.

Is there any way to accomplish this?


On that note…

Currently, when no name is specified, the file will show up in the Netlify CMS as having no title at all, which doesn’t look quite right to me.

If it isn’t possible for Netlify CMS to add the title as # This is the title of my document to the document, it would be great if Netlify CMS could at least display the file name as the title of the document instead of no title at all. This would also solve my issue.

If anyone were to go fancy, an option to either display or hide the file extension in this case would make this bug fix / feature even greater!


Thanks to everyone wanting to help me! :slight_smile:

Hi @jelle619 and welcome to the community.

The CMS expects every entry to have a title field as an identifier.
You should see an error log if you check the browser console.

If a collection doesn’t have one you can use identifier_field to specify it and that will show up in the list view. Getting just a part of a field is not supported at the moment, but you can comment/up vote this issue with your use case.

There is an option to customize the view using a summary configuration (Configuration Options | Netlify CMS | Open-Source Content Management System), but I don’t think it supports the filename as a template variable.

If having just the filename as a template variable satisfies your requirement you can open an new issue to extend the summary field. If you need more customization you can up vote the issue I mentioned before.

I understand why grabbing the header from the file and make Netlify CMS use that as the title wouldn’t be ideal, but since the header and file name of each file are the same, using summary: "{{filename}}" would be satisfactory.

It looks like filename is indeed not a supported variable for summary. As such, I will open an issue about this on GitHub. Thank you very much for your help. :grin:


Update: The GitHub issue is available here.

2 Likes