-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
status: confirmedtype: bugcode to address defects in shipped codecode to address defects in shipped code
Description
Describe the bug
This is how I define my posts collection
collections:
- label: Posts
label_singular: post
name: posts
folder: content/posts
media_folder: '/{{media_folder}}/posts/{{filename}}'
public_folder: '{{public_folder}}/posts/{{filename}}'
format: frontmatter
create: true
identifier_field: title
fields:
- {label: Title, name: title, widget: string}
- {label: Cover image, name: cover, widget: image, required: false}
- {label: Body, name: body, widget: markdown}
as you can see media_folder name is based on the filename. But the problem is that when you create post file doesn't exist, so images in markdown is written with wrong path.
How to reproduce
Here is reproduction repository
https://github.com/smashercosmo/folder-collections-media-and-public-folder-issue
- run
npm run develop
- open
http://localhost:8000/admin/
- press
new post
- fill the form and upload an image
- press
publish
Expected behavior
you should see correct image path in frontmatter
---
cover: /img/posts/new-post-name/image.jpg
---
Actual behavior
you will see this instead
---
cover: /img/posts/image.jpg
---
Applicable Versions:
- Netlify CMS version: 2.12.12
stephtr
Metadata
Metadata
Assignees
Labels
status: confirmedtype: bugcode to address defects in shipped codecode to address defects in shipped code