Thanks @tomrutgers, that might work to update my setup field. Haven’t used netlify-cms or netlify-cms-app before. Is this how I might go about implementing that?
I found a couple of articles that say the beginning and end of your frontmatter code block needs to be enclosed in triple dashes --- if YAML or triple semicolons ;;; if JSON.
I’m not seeing the triple dashes in the code block you pasted. Did you just not copy/paste them or are they indeed not there?
@elden, yes I only included the frontmatter field that I wanted to generate through Netlify CMS. My (working) frontmatter looks like this (I use Astro).
---
layout: src/layouts/PostLayout.astro
title: Post title
date: 2022-07-03T17:14:50.190Z
description: Post description
categories:
- post
img: images/uploads/post.png
setup: |
import STS from '@components/STS';
---
Also, my full index.html file (public/admin/index.html) looks like this:
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<link href="/admin/config.yml" rel="cms-config-url" type="text/yaml"/>
<!-- Netlify CMS -->
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js" type="text/javascript"></script>
<title>Content Manager</title>
</head>
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="https://unpkg.com/netlify-cms@2.10.192/dist/netlify-cms.js"></script>
<script>
import CMS from "netlify-cms"
CMS.registerEventListener({
name: "postSave",
handler: ({entry}) => {
return entry.get("data").set("setup", "|\nimport STS from \'@components/STS\';");
}
});
</script>
</body>
</body>