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

list widget of code widget does not persist both fields "code" and "lang" #6254

Open
slumbering opened this issue Feb 28, 2022 · 0 comments
Open

Comments

@slumbering
Copy link

Describe the bug

Where creating a List widget of Code widget and persist it, only one of them is actually saved (code or lang) but not both of them

To Reproduce

Create a config file with the following:

  - label: "Terminal"
    name: "terminal"
    widget: "list"
    field:
      {
        label: "Code Snippet",
        name: "code_snippet",
        widget: "code",
      }

Expected behavior

When published, both code and lang are saved within the markdown

Screenshots

Applicable Versions:

  • Netlify CMS version: 2.10.186
  • Git provider: Github (but with git-gateway locally)
  • OS: MacOS Monterey
  • Browser version Firefox 97.0.1
  • Node.JS version: v15.14.0

CMS configuration

# Uncomment when in dev mod
local_backend: true
backend:
  name: git-gateway
media_folder: public/img
publish_mode: editorial_workflow
site_url: https://dagger.io
show_preview_links: true
public_folder: img
collections:
  - name: "pages"
    label: "Pages"
    files:
      - label: "Home"
        name: "Home"
        file: "content/home.md"
        fields:
          - label: "Section Hero"
            name: "hero"
            widget: "object"
            collapsed: true
            fields:
              - { label: "Title", name: "title", widget: "string" }
              - { label: "Content", name: "body", widget: "markdown" }
              - { label: "Call to action", name: "cta", widget: "string" }
              - { label: "Image", name: "img", widget: "image" }

          - label: "Parallax"
            name: "storyParallax"
            widget: "object"
            collapsed: true
            fields:
              - label: "Slide-1"
                name: "slide1"
                widget: "object"
                fields:
                  - { label: "Image", name: "img", widget: "image" }
                  - { label: "Title", name: "title", widget: "string" }
                  - { label: "Content", name: "body", widget: "markdown" }
              - label: "Slide-2"
                name: "slide2"
                widget: "object"
                fields:
                  - { label: "Image", name: "img", widget: "image" }
                  - { label: "Title", name: "title", widget: "string" }
                  - { label: "Content", name: "body", widget: "markdown" }
              - label: "Slide-3"
                name: "slide3"
                widget: "object"
                fields:
                  - { label: "Image", name: "img", widget: "image" }
                  - { label: "Title", name: "title", widget: "string" }
                  - { label: "Content", name: "body", widget: "markdown" }
              - label: "Slide-4"
                name: "slide4"
                widget: "object"
                fields:
                  - { label: "Image", name: "img", widget: "image" }
                  - { label: "Title", name: "title", widget: "string" }
                  - { label: "Content", name: "body", widget: "markdown" }

          - label: "How it works"
            name: "howItWorks"
            widget: "object"
            fields:
              - { label: "Title", name: "title", widget: "string" }
              - label: "Content"
                name: "content"
                widget: "list"
                summary: "{{fields.title}}"
                fields:
                  - { label: "Title", name: "title", widget: "string" }
                  - { label: "Content", name: "body", widget: "markdown" }
                  - { label: "Image", name: "img", widget: "image" }
              - label: "Terminal"
                name: "terminal"
                widget: "list"
                field:
                  {
                    label: "Code Snippet",
                    name: "code_snippet",
                    widget: "code",
                  }
          - label: "Section Footer"
            name: "footer"
            widget: "object"
            collapsed: true
            fields:
              - { label: "Title", name: "title", widget: "string" }
              - { label: "Content", name: "body", widget: "markdown" }
              - { label: "Call to action", name: "cta", widget: "string" }
              - { label: "Image", name: "img", widget: "image" }
      - label: "Terms of Service"
        name: "terms-of-service"
        file: "content/terms-of-service.md"
        fields:
          - { label: "Title", name: "title", widget: "string" }
          - {
              label: "Publish Date",
              name: "date",
              widget: "datetime",
              date_format: "MMMM YYYY",
              time_format: false,
            }
          - { label: "Body", name: "body", widget: "markdown" }
      - label: "Privacy policy"
        name: "privacy-policy"
        file: "content/privacy-policy.md"
        fields:
          - { label: "Title", name: "title", widget: "string" }
          - {
              label: "Publish Date",
              name: "date",
              widget: "datetime",
              date_format: "MMMM YYYY",
              time_format: false,
            }
          - { label: "Body", name: "body", widget: "markdown" }
  - name: "blog"
    label: "Blog"
    folder: "content/blog/posts"
    create: true
    slug: "{{slug}}"
    identifier_field: slug
    fields:
      - { label: "Slug", name: "slug", widget: "string" }
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Publish Date", name: "date", widget: "datetime" }
      - { label: "Featured Image", name: "thumbnail", widget: "image" }
      - { label: "Body", name: "body", widget: "markdown" }

Additional context

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

No branches or pull requests

2 participants