COVID19 Lockdown Dev Log – Day 12

What I Worked On

Configuring Netlify CMS backend.

What I Learned

A little heads up: This more or less continues where I left off from yesterday’s post –“COVID Lockdown Dev Log – Day 11” 😀

I learned how to make Netlify CMS create detailed commit messages when I create, update or delete projects in my portfolio using Netlify CMS. Just a quick reminder here: I use Github as my “back-end”. Whenever I do CRUD operations from Netlify CMS, they are executed via git commits.

In my ‘config.yml’ file I add ‘commit_messages’. Here I can configure what a git commit message should say depending on which CRUD operation I perform:

//config.yml

backend:
  name: git-gateway
  branch: master
  commit_messages:
    create: 'Create {{collections}} “{{slug}}”'
    update: 'Update {{collections}} “{{slug}}”'
    delete: 'Delete {{collections}} “{{slug}}”'

media_folder: "static/uploads"

collections:
  - name: "project"
    label: "Project"
    folder: "src/pages/projects"
    create: true
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    fields:
      - {label: "Project title", name: "title", widget: "string", required: true, default: "Project"}
      - {label: "Publish Date", name: "date", widget: "datetime"}
      - {label: "Github URL", name: "giturl", widget: "string", required: true}
      - {label: "Live URL", name: "liveurl", widget: "string"}
      - {label: "Body", name: "body", widget: "markdown", required: true}

The ‘{{collections}} “{{slug}}”’ let’s Netlify CMS know what the name of the project is. In the end it looks like this in my commit history:

It actually took a little while for me to make it work properly, because most documentation assumed that you would be rendering a list of links that you could click on and then be redirected to. Like when you render a list of blog posts, you can click on a post and be redirected to it 😀 I just want to display the list only (my projects) 😀

What Distracted Me During The Day

  • LinkedIn
  • Youtube