Different path when creating a MD manually or when creating it from Netlify CMS

Hi Everyone, so I am creating a little portfolio project with Gatsby Js and Netlify CMS. I think my problem is related to relative / absolute paths…

simonc.netlify.app

When I create a MD file manually to reach the “thumb” I use the path for example like this:
thumb: …/…/static/assets/images/countries.png

But when I create a new “project” from the CMS And I check the thumb path that is uploaded to GitHub it looks like this:
/assets/images/e3efdb08-88e0-482a-a2e9-9f217dc5a7bb.jpeg

Then when netlify tries to deploy the site with the new CMS created project it fails cause it cannot find the thumb anywhere. How can I do to have same style of paths everywhere in my project? Can and should I change the MD files? Or is it maybe something in the config.yml?

I am new to gatsby and CMSs so any help will be appreciated :slight_smile:
Thanks, Simon!

Can you share your config.yml?

Sure. Here it is:

backend:
  name: git-gateway
  branch: master # Branch to update (optional; defaults to master)

publish_mode: editorial_workflow

# media_folder: "src/images/thumbs"
media_folder: "static/assets/images" # Media files will be stored in the repo under static/images/uploads
public_folder: "/assets/images" # The src attribute for uploaded media will begin with /images/uploads

collections:
  - name: "projects" # Used in routes, e.g., /admin/collections/blog
    label: "Projects" # Used in the UI
    folder: "src/projects" # The path to the folder where the documents are stored
    create: true # Allow users to create new documents in this collection
    slug: "{{slug}}" # Filename template, e.g., YYYY-MM-DD-title.md
    fields: # The fields for each document, usually in front matter
      - { label: "Title", name: "title", widget: "string" }
      - { label: "Stack", name: "stack", widget: "string" }
      - { label: "Slug", name: "slug", widget: "string" }
      - { label: "Url", name: "url", widget: "string" }
      - { label: "Publish Date", name: "date", widget: "datetime" }
      - { label: "Thumb", name: "thumb", widget: "image" }
      - { label: "Body", name: "body", widget: "markdown" }

Can you try to update the public folder path to a relative one?

public_folder: "…/…/static/assets/images/"

I’m not quite sure if it works, but it’s worth a shot!

1 Like

Also: I’ve found this post over at the github repo, it seems there are some workarounds for this issue:

This actually worked… I also took a look at the link below but could not find any solution also because the comments and information is 5 years old.

Anyways now it seems to work fine. Thanks much for you help!

2 Likes

Thanks for coming back and letting us know. Happy building :rocket: