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

Can't edit pages in collection #1190

Closed
martinmodighkarlsson opened this issue Mar 23, 2018 · 14 comments
Closed

Can't edit pages in collection #1190

martinmodighkarlsson opened this issue Mar 23, 2018 · 14 comments

Comments

@martinmodighkarlsson
Copy link

martinmodighkarlsson commented Mar 23, 2018

- 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

@tech4him1
Copy link
Contributor

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

@martinmodighkarlsson
Copy link
Author

martinmodighkarlsson commented Mar 23, 2018

@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

@erquhart
Copy link
Contributor

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

@tech4him1
Copy link
Contributor

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.

@martinmodighkarlsson
Copy link
Author

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

@erquhart
Copy link
Contributor

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

@martinmodighkarlsson
Copy link
Author

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 #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?!

@talves
Copy link
Collaborator

talves commented Mar 24, 2018

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

@martinmodighkarlsson
Copy link
Author

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?

@martinmodighkarlsson
Copy link
Author

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!

@talves
Copy link
Collaborator

talves commented Mar 25, 2018

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

@talves
Copy link
Collaborator

talves commented Mar 25, 2018

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

@martinmodighkarlsson
Copy link
Author

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".

@erquhart
Copy link
Contributor

erquhart commented Mar 25, 2018

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.

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

4 participants