Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden templateKey fields not saving to .md file #843

Open
joseph-facta opened this issue May 4, 2022 · 1 comment
Open

Hidden templateKey fields not saving to .md file #843

joseph-facta opened this issue May 4, 2022 · 1 comment

Comments

@joseph-facta
Copy link

Bug report

What is the current behavior?
The hidden fields for new pages I am creating are not being saved to the .md file that Netlify CMS creates, so Gatsby fails to build, as there is no path to a component.

If the current behavior is a bug, please provide the steps to reproduce.
I created a new page in the config.yml file, adding the following under the file collection:
image

I then navigated to the /admin page, and edited the new Sidebar page. I saw a new file appear at /pages/sidebar/index.md. However, the hidden templateKey field was not present, and the compilation failed at this point.

I have pushed my repo to this repository.

What is the expected behavior?
I would expect to see the hidden fields I placed in the config.yml file to appear in the final index.md file.

Other relevant information:

System:
OS: Windows 10 10.0.19043
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Binaries:
Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.1266.0), Chromium (101.0.1210.32)
npmPackages:
gatsby: ^4.12.1 => 4.12.1
gatsby-plugin-image: ^2.0.0 => 2.3.0
gatsby-plugin-netlify: ^4.2.0 => 4.2.0
gatsby-plugin-netlify-cms: ^6.12.1 => 6.12.1
gatsby-plugin-purgecss: ^6.0.0 => 6.1.0
gatsby-plugin-react-helmet: ^5.0.0 => 5.3.0
gatsby-plugin-sass: ^5.0.0 => 5.3.0
gatsby-plugin-sharp: ^4.0.0 => 4.3.0
gatsby-remark-copy-linked-files: ^5.0.0 => 5.3.0
gatsby-remark-images: ^6.0.0 => 6.3.0
gatsby-remark-relative-images: ^0.3.0 => 0.3.0
gatsby-source-filesystem: ^4.0.0 => 4.3.0
gatsby-transformer-remark: ^5.0.0 => 5.3.0
gatsby-transformer-sharp: ^4.0.0 => 4.3.0
npmGlobalPackages:
gatsby-cli: 4.13.0

Node.js version: 16.13.1
NPM/Yarn version: NPM v8.1.2
Operating System: Windows 10
Additional tools:

@joseph-facta
Copy link
Author

joseph-facta commented May 12, 2022

I've found some more issues regarding this (here and here), and apparently the hidden fields simply cannot be saved in the Files collection type.

So my follow-up question now is: How are the hidden templateKey fields generated for the pages that are packaged with the template in this repo if Files collections cannot have hidden fields saved to the .md files?

I can manually add the fields to a new .md file and get the page to compile, but the CMS removes the templateKey field whenever it pushes a content update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant