Netlify-cms: Can't edit pages in collection

Created on 23 Mar 2018  Â·  14Comments  Â·  Source: netlify/netlify-cms

- Do you want to request a feature or report a bug?

Bug or handling error (by me :))

- What is the current behavior?

Can't edit pages in collection

- What is the expected behavior?

Edit at least body content in cms

- Please link or paste your config.yml below if applicable.

backend:
  name: git-gateway
  branch: development # Branch to update (master by default)

media_folder: "assets/img/uploads" # Folder where user uploaded files should go

collections: # A list of collections the CMS should be able to edit
  - label: "Post" # Used in routes, ie.: /admin/collections/:slug/edit
    name: "post" # Used in the UI, ie.: "New Post"
    folder: "content/_posts" # The path to the folder where the documents are stored
    sort: "date:desc" # Default is title:asc
    create: true # Allow users to create new documents in this collection
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    fields: # The fields each document in this collection have
      - {label: "Layout", name: "layout", widget: "hidden", default: "post"}
      - {label: "Title", name: "title", widget: "string", tagname: "h1"}
      - {label: "Body", name: "body", widget: "markdown"}
      - {label: "Number", name: "number", widget: "number"}
      - {label: "LinkedIn", name: "linkedin", widget: "string", default: "https://www.linkedin.com/groups/XXXX"}
    meta: # Meta data fields. Just like fields, but without any preview element
      - {label: "Publish Date", name: "date", widget: "datetime", format: "YYYY-MM-DD hh:mm:ss"}
  - label: "Pages"
    name: "page"
    files:
      - label: "How"
        name: "how"
        file: "content/_pages/how.md"
        fields:
          - {label: "Layout", name: "layout", widget: "hidden"}
          - {label: "Title", name: "title", widget: "string", tagname: "h1"}
          - {label: "Menu-title", name: "menu-title", widget: "string"}
          - {label: "Description", name: "discription", widget: "string"}
          - {label: "menu-title", name: "discription", widget: "string"}
          - {label: "Body", name: "body", widget: "markdown"}

Page looking like this, i.e. cms doesn't pull anything from the file but can find it: https://www.dropbox.com/s/fvdggzp3oc3txi5/Sk%C3%A4rmklipp%202018-03-23%2017.04.27.png?dl=0

https://www.dropbox.com/s/ryec38wrc8o7e2l/Sk%C3%A4rmklipp%202018-03-23%2017.05.19.png?dl=0

Most helpful comment

So... I don't know why I've happened to put two lines of "description" - but when removing one of them and having frontmatter and config.yml fields in same order (but hat is not really necessary, right?) I can edit the files. Sorry for making a fuzz about it!

All 14 comments

@martinmodighkarlsson This is working for me in the latest CMS version (v1.3.5). Can you upgrade and try again?

@tech4him1 I've upgraded to latest now, still doesn't work? Empty in cms even though the file exists with those fields: https://www.dropbox.com/s/z90wo4o4676n5v3/Sk%C3%A4rmklipp%202018-03-23%2022.59.37.png?dl=0

The problem is that we can't reproduce - if you can help us do that I'm certain we can figure it out.

Steps to repro would be great. I'm suspecting that the CMS isn't able to parse the file correctly, and is therefore showing no content.

@erquhart @tech4him1 I see, what do you need? Thanks!

That just means we need a list of steps to take on our own to observe the bug ourselves.

I see, well that's the problem. I don't get it, I've read and followed instructions in https://www.netlifycms.org/docs/configuration-options/#backend, https://www.netlifycms.org/docs/collection-types/ and looked in for example https://github.com/netlify/netlify-cms/issues/679
I can't really see what kind of steps I might be doing wrong. Since this seems to be well implemented core functions in Netlify CMS I am rather sure I've missed something and it's not a bug. But what?!

@martinmodighkarlsson was this an existing page? If so, can you paste the how.md code here with at least the front matter?

Yes, it's an existing page:

layout: how
title: Hur fungerar det?
description: Hur fungerar det?
menu-title: Hur?
description: Vi är piprensare som arbetar tätt tillsammans med våra kunder. Piprensare tar aldrig uppdrag från andra och anställer inga andra piprensare – vi förmedlar bara till och från pipor.
order: 20
published: true
slug: how
permalink: /how/
---
Body text

If I rename this page or call for another, non existing page, in config.yml it doesn't show up. So it seems to be found, but not read properly?

So... I don't know why I've happened to put two lines of "description" - but when removing one of them and having frontmatter and config.yml fields in same order (but hat is not really necessary, right?) I can edit the files. Sorry for making a fuzz about it!

The order doesn't matter. Did taking out the duplicate fix the issue?

@martinmodighkarlsson I just noticed you have two discription in your config. That may be your issue.

Taking out the duplicate fixed the reading part - I can now in the cms reach all fields I put in the config.yml. However, I get a 404 on the site. I'm guessing that's because I have fields in front matter not called for in config, and they're overwritten? Like for example "published: true".

Right, if it's not in the config, Netlify CMS won't write it on save, so that published field won't be present. When in doubt, check the commits that are being made by Netlify CMS in your repo to make sure the output is what you expect.

Was this page helpful?
0 / 5 - 0 ratings