Netlify-cms: Opening delimiters break config.yml

Created on 26 Jan 2018  路  7Comments  路  Source: netlify/netlify-cms

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

bug

- What is the current behavior?

Opening delimiters (---) in config.yml cause problems, at least one of which being that new slugs end up populated with simply ---, which the backend slug formatter crunches down to a blank string. This results an the following error (for searchability):

Failed to persist entry: API_ERROR: refs/heads/cms/ is not a valid ref name.

- If the current behavior is a bug, please provide the steps to reproduce.

  • Add opening delimiters --- to config.yml
  • Attempt to create a new entry

- What is the expected behavior?

Delimiters are valid yaml and should be allowed in config.yml without breaking the application.

- Please mention your CMS, node.js, and operating system version.

- Please link or paste your config.yml below if applicable.
Confirmed in 0.7.6 and 1.1.0

configuration formats bug

All 7 comments

Weird, our YAML parser should support that by default: https://nodeca.github.io/js-yaml/.

Yeah, I know. And entry.slug somehow getting set to "---" was a real head scratcher.

@erquhart I can't reproduce in v1.4.0.

Hi all,

Just been stuck with the same issue before I came across this issue on GH. If I removed the

---
---

from the top of the config.yml file then new post slugs are formatted as expected otherwise they are merely three dashes ---. If it weren't for this issue I may have not figured out the issue so soon. I've tested with the latest versions and it's definitely still an issue unless I'm missing something.

We need the dashes at the top of the file to dynamically add the required branch/repo/url for all of our static sites from the Jekyll site config.

Tested with:
https://unpkg.com/[email protected]/dist/netlify-cms.js

Config file I'm working on:
https://github.com/kylekirkby/jumbo-jekyll-theme/blob/master/admin/config.yml

Kind regards,

Kyle

~Just encountered this issue when using spaces inside the slug moustaches.~

  • ~This works fine: {{slug}}~
  • ~This does not: {{ slug }}~

~Guessing it's because of this line? 馃 https://github.com/netlify/netlify-cms/blob/master/packages/netlify-cms-core/src/lib/stringTemplate.js#L22~

EDIT: Not sure how this ended up here. Will move it to the right issue.

I have the same issue in the latest netlify as of today. it occurs when I try to save a new post.

Edit: Gist to config.yml code https://gist.github.com/numoonchld/10ffe8c302b79a57c585481cca6c8ea7

I believe I will strip the top three lines using ruby as my config file is ruby generated, and report back if anything changes.

Edit: here is a dirty patch to fix it.

curr_admin_config = File.open("./admin/dirty_config.yml")
curr_admin_config.first

new_admin_config = File.new("./admin/config.yml","w+")
curr_admin_config.each { |line| new_admin_config.puts(line) } 

post save was successful after stripping the first line of --- in the config file

Can someone open a new issue to track this?

Was this page helpful?
0 / 5 - 0 ratings