I’m connecting Netlify CMS to a website built without a static site generator.
In my config.yml I have media_folder: “/images/uploads”. At the moment I’m using public_folder: “/images/uploads” in config.yml which should, to my understanding, add /images/uploads as the path to the image in the index.md.
The problem is that whatever I write in public_folder the image will always be found at images/uploads/imagename.png, but the path to the image in the markdown file is always image/imagename.png.
Any guidance on what I do wrong here?
config.yml
backend:
name: git-gateway
branch: main # Branch to update (optional; defaults to master)
media_folder: "/images/uploads" # Media files will be stored in the repo under images/uploads
public_folder: "/images/uploads"
collections:
- label: "Pages"
name: "pages"
files:
- file: "_posts/news/index.md"
label: "News" # Used in the UI
name: "news" # Used in routes, e.g., /admin/collections/blog
description: "News page"
fields: # The fields for each document, usually in front matter
- {label: "Template Key", name: "templateKey", widget: "hidden", default: "news-page"}
- {label: "Title", name: "title", widget: "string"}
- {label: Description, name: description, widget: string}
- {label: Intro, name: intro, widget: object, fields: [{label: Blurbs, name: blurbs, widget: list, fields: [{label: "Title", name: "title", widget: "string"}, {label: Body, name: body, widget: markdown}, {label: Image, name: image, widget: image}, {label: "Publish Date", name: "date", widget: "datetime"}]}]}
index.md
---
title: Aktuellt
description: "Aktuella händelser.. "
intro:
blurbs:
- date: 2020-10-15T10:23:49.470Z
title: Hej
body: Test
image: images/newspaper.jpg
---
Fetch response in frontend
As you can see the address returned by fetch is image/newspaper.jpg. In reality it is images/uploads/newspaper.jpg
I finally solved it myself, after a long walk. I just had to delete index.md and add content again in the CMS admin interface.
So, steps to solve the issue: