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

Default and hidden variables don't reflect in mdx file #4520

Closed
lilpolymath opened this issue Nov 1, 2020 · 1 comment
Closed

Default and hidden variables don't reflect in mdx file #4520

lilpolymath opened this issue Nov 1, 2020 · 1 comment
Labels
type: bug code to address defects in shipped code

Comments

@lilpolymath
Copy link
Contributor

Describe the bug

I have this collection of files and here is the config.yml specification

  - name: support-page
    label: Support Pages
    extension: mdx
    format: frontmatter
    editor:
      preview: true
    delete: false
    files:
      - file: 'content/support/support.mdx'
        label: Support
        name: support
        fields:
          - label: Template
            name: template
            widget: hidden
            default: Support
          - label: Slug
          - label: Slug
            name: slug
            widget: hidden
            default: support
          - label: Title
            name: title
            widget: string
          - label: accordion
            name: accordion
            widget: list
            fields:
              - label: title
                name: title
                widget: string
                default: ''
              - label: content
                name: content
                widget: list
                fields:
                  - default: ''
                    label: title
                    name: title
                    widget: string
                  - label: description
                    name: description
                    widget: string

But whenever I update the file this is what gets created.

---
title: Frequently Asked Questions
accordion:
  - title: General
    content:
      - title: Can you finish our project in less than a day?
        description: No.
---

Here is the template declaration in the cms.js

CMS.registerPreviewTemplate('support', ({ entry }) => (
  <SupportTemplate {...entry.toJS().data} />
))

The default && hidden variables I declared in the config don't show up in the file at all and it prevents the page from getting created.

Expected behaviour
I expect that the file has this content

---
template: Support
slug: support
title: Frequently Asked Questions
accordion:
  - title: General
    content:
      - title: Can you finish our project in less than a day?
        description: No.
---

Screenshots

Applicable Versions:

  • Netlify CMS version: netlify-cms-app 2.13.1
  • Git provider: GitHub
  • OS: Elementary OS
  • Browser version: Chrome 86
@lilpolymath lilpolymath added the type: bug code to address defects in shipped code label Nov 1, 2020
@lilpolymath lilpolymath changed the title Please replace with a clear and descriptive title Default and Hidden variables don't reflect in file Nov 1, 2020
@lilpolymath lilpolymath changed the title Default and Hidden variables don't reflect in file Default and hidden variables don't reflect in mdx file Nov 1, 2020
@erezrokah
Copy link
Contributor

Thanks @lilpolymath, closing this in favour of #3046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants