Settings for media_folder and public_folder when not using static site generator

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 for the src-attribute in the img tag.

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.

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

Any guidance on what I do wrong here?

I solved it myself. I only had to delete index.md and add content again with the admin interface.

1 Like

thanks for posting your solution!