Hi my Netlify site name is https://kind-kalam-64dad8.netlify.app/ and github link is : GitHub - kalariyogi/kalariyogi-11ty-netlify-cms: Static site with eleventy and netlify cms
I am trying to update the config.yml to edit the index.njk file so I am using file collections. When I update the fields in Netlify CMS the file gets deleted.
Below is my config.yml file
backend:
name: git-gateway
branch: main
media_folder: “_site/images/uploads”
public_folder: “/images/uploads”
collections:
- name: "posts"
label: "Posts"
folder: "posts"
create: true
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
fields:
- { label: "Layout", name: "layout", widget: "hidden", default: "layouts/post.njk" }
- { label: "Title", name: "title", widget: "string" }
- { label: "Description", name: "description", widget: "string" }
- { label: "Date", name: "date", widget: "date", default: "" }
- { label: "Post Body", name: "body", widget: "markdown" }
- { label: "Featured Image", name: "featuredImage", widget: "image" }
- name: "pages"
label : "Pages"
files:
- label: "Home Page"
name: "index"
file: "index.njk"
fields:
- { label: "Hero Text", name: "heroText", widget: "string" }
- { label: "Hero Description", name: "heroDescription", widget: "string" }
- { label: "Hero Image", name: "heroImage", widget: "image" }
- { label: "Hero body", name: "body", widget: "markdown" }
Here is my index.njk file
---
layout: layouts/base.njk
permalink: /
heroText: Yoga
heroDescription: Yoga for the mind, body and soul
heroImage: none
---
<div class="jumbotron jumbotron-fluid" style="background-image: url("{{heroImage | url}}");">
<div class="container">
<h1 class="hero-text display-4">{{heroText}}</h1>
<p class="lead">{{heroDescription}}</p>
</div>
</div>
<div class="container">
{{ content | safe }}
</div>
Would really appreciate some help with this problem.
Thanks
Nikhil Pereira