How to get multiple collections working within Netlify-CMS? - netlify-cms

I'm running a Gridsome project where I have integrated Netlify-CMS. This is what my config.yml file looks like:
backend:
name: github
branch: master # Branch to update (optional; defaults to master)
repo: user/repo
media_folder: "images/uploads"
public_folder: "/images/uploads"
collections:
- name: "blog" # Used in routes, e.g., /admin/collections/blog
label: "Blog" # Used in the UI
folder: "blog" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
fields: # The fields for each document, usually in front matter
- {label: "Layout", name: "layout", widget: "hidden", default: "blog"}
- {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"}
- name: "projects" # Used in routes, e.g., /admin/collections/blog
label: "Projects" # Used in the UI
folder: "projects" # The path to the folder where the documents are stored
create: true # Allow users to create new documents in this collection
slug: "{{year}}-{{month}}-{{day}}-{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
fields: # The fields for each document, usually in front matter
- {label: "Layout", name: "layout", widget: "hidden", default: "blog"}
- {label: "Customer", name: "customer", widget: "string"}
- {label: "Activity", name: "activity", widget: "string"}
- {label: "Date", name: "date", widget: "datetime"}
- {label: "Link", name: "link", widget: "string"}
- {label: "Featured Image", name: "thumbnail", widget: "image"}
- {label: "Body", name: "body", widget: "markdown"}
I'm able to see both Blog and Projects in the admin interface, however, when I click on the Project collections it doesn't show my existing .md file within the specified folder. At the same time, when I try to create a new project, this doesn't get added and no error message is displayed.
Everything works like a charm with the Blog collection.
This is what the project directory looks like:

There's no field that can serve as an identifier. Right now you either have to have a field named "title" or set "identifier_field" to the name of a field that you'd like to use instead. The value of the field should be unique to the entry, so I'm guessing adding a "title" to each project is probably a good move anyway.
There should be an error for this, if you could open a bug in GitHub for that we can look into it.

Related

How to access .yml file at root in Netlify CMS?

I'm trying to give Netlify CMS access to a data file containing authors for a blog site, but I haven't been able to get the records from the root of the file. I need the records to be at the root because of the site generator I'm using. Is there anything I can replace the asterisks with to accomplish this?
- name: "settings"
label: "Settings"
files:
- name: "authors"
label: "Authors"
file: "_data/authors.yml"
fields:
- name: "*****"
label: "Authors"
widget: "list"
fields:
- {label: "Name", name: "name", widget: "string"}
- {label: "Last Name", name: "last_name", widget: "string"}
- {label: "First Name", name: "first_name", widget: "string"}
- {label: "Display Name", name: "display_name", widget: "string"}
- {label: "Bio", name: "bio", widget: "markdown"}

How to add image upload functionality in Netlify CMS

Hi I'm new to Netlify CMS I just learned about it from a blog
so I have config.yml that creates two input fields in Netlify CMS
Sample:
collections:
- name: 'team'
label: 'Team'
folder: 'src/team'
create: true
slug: '{{slug}}'
fields:
- { label: 'Team Member', name: 'title', widget: 'string' }
- { label: 'Bio', name: 'bio', widget: 'markdown' }
I'm just wondering how can I add input field for the image
Thanks!
Just add
{ label: "Image", name: "thumbnail", widget: "image"}
into one of your fields
collections:
- name: 'team'
label: 'Team'
folder: 'src/team'
create: true
slug: '{{slug}}'
fields:
- { label: 'Team Member', name: 'title', widget: 'string' }
- { label: 'Bio', name: 'bio', widget: 'markdown' }
- { label: "Image", name: "thumbnail", widget: "image"}
Source: https://www.netlifycms.org/docs/add-to-your-site/

Gatsby, how to do "join" with graphql?

I use gatsby and netlify-cms.
My schema:
collections:
- name: "tags"
label: "Tags"
folder: "src/data/tags"
create: true
slug: "{{slug}}"
fields:
- {label: "Id", name: "title", widget: "string"}
- {label: "Description", name: "description", widget: "text"}
- name: "posts"
label: "Posts"
folder: "src/data/posts"
create: true
slug: "{{slug}}"
fields:
- {label: "Id", name: "title", widget: "string"}
- label: "Tags"
name: "tags"
widget: "list"
fields:
- label: "Tag"
name: "tag"
widget: "relation"
collection: "tags"
searchFields: ["name", "description"]
valueField: "title"
displayFields: ["name"]
My query:
query PostByID($id: String!) {
markdownRemark(id: { eq: $id }) {
id
html
frontmatter {
id: title
description
tags {
tag
// get tag description????
}
}
}
}
Is there a way to get tag description? I'm trying to use fragments, but it doesn't work. I asked this question as issue on Gatsby GitHub, I was advised this example:
fragment tagDetails on Tag {
title
description
}
and with this usage:
tag {
...tagDetails
}
I get this error:
"Field \"tag\" must not have a selection since type \"String\" has no subfields."

Kendo ui scheduler group by date then by resource

I'm creating a scheduler by using Kendo UI Scheduler, with horizontal grouping like this.
My problem is that I don't want one calendar for each resource like the mentioned example does. I only want one calendar displayed, but each day will provide one colomn for each resource. I've found an example that does exactly what I want here (check both "group by speaker" and "group by date" and then select week view), but this example is for Telerik (Kendo is the javascript version of telerik). I've tried to translate this example into working for Kendo UI by using the below code, but none of the options work.
Basic kendo code
$('#scheduler').kendoScheduler({
date: new Date(),
views: [
{ type: "day" },
{ type: "week", selected: true }
],
group: {
resources: ["Owner"]
},
resources: [
{
field: "ownerId",
name: "Owner",
title: "Owner",
dataSource: [
{ text: "Alex", value: 1, color: "#f8a398" },
{ text: "Bob", value: 2, color: "#51a0ed" },
{ text: "Charlie", value: 3, color: "#56ca85" }
]
}
]
});
How I've tried to group by date and then by resource
resources: ["date", "Owner"]
resources: ["Date", "Owner"]
resources: [Date, "Owner"]
I have not provided another resource called "date"/"Date". In the Telerik example above you did not need to do that. The scheduler understod that you wanted to group by date.

Re-Adding Bullet & Italics to CkEditor

I have inherited an MVC3 C# .Net Web App which uses CkEditor. The ability to insert bold text and italicized text has been removed from the CkEditor boxes by another developer (who is no longer here). How can I re-add the Bold & Italics functionality back into CkEditor?
I found the answer. Attributes of the .toolbar config property had been removed. I.e.
toolbar: [
{ name: 'insert', items: ['Image'] },
{ name: 'tools', items: ['Maximize'] },
],
I modified to:
toolbar: [
{ name: 'insert', items: ['Image'] },
{ name: 'tools', items: ['Maximize'] },
['Bold', 'Italic', 'Underline'], ['NumberedList', 'BulletedList']
],
Here's the Url that helped me: CkEditor Config Stuff

Resources