Generate a data file from folder type CMS actions

Say you have a collection like this in your config.yaml;

collections:
    - name: blog
      label: Blog
      folder: cms/blog/:slug
      extension: yaml
      create: true
      delete: true
      fields:
        - { label: Title, name: title, widget: string }
        - { label: Summary, name: summary, widget: string }
        - { label: Body, name: body, widget: text }
        - { label: Image, name: thumbnail, widget:  image } 

Is there a way to have some of this data sent to another file; based on if a new blog was just created, deleted or modified?

For example the collection above could be used to create a new blog post. I’d like to have a blog preview section on my home page. The preview items would just display the blogs thumbnail, title, and summary.

If I had a single data file for this, I could load it up, iterate through it and generate the html content to be embedded into the home page.

The data file might look like this;

data:
  - title: A Blog Title
    summary: A blog summary
    thumbnail: path/to/blog/image.jpg
  - title: Another Blog Title
    summary: One more summary
    thumbnail: path/to/another-blog/image.jpb

You must be able to do this! Having to have users repeat themselves to produce two seperate files is crazy. And this seems like a pretty standard requirement.

Can you do a diff check during the Netlify build to see what files have been added, modified, or deleted?

I’m struggling to find any good solution for this. Looks like my client will have to create a new blog file, and then remember to add the relevant details to a list widget on the home page too.

What we need is a way to set data relationships/associations between pages. But that might be hard for Netlify to implement.

Hi there! Thanks for your interest in Netlify CMS. Looks like you posted your question a little while ago, but that you haven’t received a solution yet. Here’s where you might get more help:

netlifycms.org - the site houses our extensive documentation that likely contains helpful information to get you back on track.

netlify cms slack - join our friendly slack channel and chat with other cms pros to get the help you need.

GitHub Issues - think you’ve found a bug, or would like to make a feature request? Make your voice heard here. Netlify CMS is open source - PRs and other contributions are also welcome!

Stack Overflow Check StackOverflow for questions tagged “Netlify CMS” if you don’t get an answer in the Slack or the GH issues. StackOverflow reaches a worldwide audience of knowledgeable people.

Your question will be left open here for anyone to comment - but we encourage you to check out the above resources if you are still looking for a solution!

We need widget like Relation, only it does not require the user to manually construct the list/items. And it should be able to pull in multiple fields.

This way you can have folder type collection relation setup. so anytime a new blog post for example was added, some data from the blog post file would automatically make it onto the home page etc…