Home
Support Forums

Media Preview Path

Hi.

I want to change the privew path from

site.com/images/preview.jpg

to

site.com/post-name/preview.jpg

That’s why I changed the syntax in the config.yml file

from

media_folder: "static/uploads"
public_folder: "/images/"

to

media_folder: "static/uploads"
public_folder: "{{fields.url}}/uploads/"

But it doesn;t resond and the images are still showing from the same url as before!

Could you share your entire config so we can check accordingly?

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

media_folder: "static/uploads"
public_folder: "{{fields.url}}/uploads/"

collections:

#Posts Collection
  - name: "posts"
    label: "Posts"
    folder: "content/post"
    preview_path: "{{fields.url}}"
    create: true
    fields:
      - {label: "Title", name: "title" , widget: "string", required: true}
      - {label: "Layout", name: "type", widget: "hidden", default: "post"}
      - {label: "Draft", name: "draft", widget: "boolean", default: true, required: false}
      - {label: "SEO Title", name: "SEOTitle", widget: "string", required: false}
      - {label: "SEO Discription", name: "excrept", widget: "text", required: false}
      - {label: "Focus Keywords", name: "metaKeywords", widget: "string", required: false}
      - {label: "Slug", name: "url", widget: "string", required: false}
      - {label: "Publish Date", name: "date", widget: "datetime"}
      - {label: "Modify Date", name: "updateDate", widget: "datetime"}
      - {label: "Featured Image (Size 1200x680)", name: "image", widget: "image", required: false}
      - {label: "Tags", name: "tags", widget: "relation", collection: "tags", searchFields: ["name"], valueField: "name", displayFields: ["name"], multiple: true, required: false}
      - {label: "Categories", name: "categories", widget: "relation", required: false, collection: "categories", searchFields: ["name"], valueField: "name", displayFields: ["name"], multiple: true}
      - {label: "Schema Markup", name: "schemaMarkup", widget: "text", required: false}
      - {label: "Staff Pick P.Name", name: "pickName", widget: "string", required: false}
      - {label: "Staff Pick P.Image", name: "pickImg", widget: "image", required: false}
      - {label: "Staff Pick P.Link", name: "pickLink", widget: "string", required: false}
      - {label: "Body", name: "body", widget: "markdown", required: false}

Here it is!

You might have to use Folder Collections to be able to configure this: Beta Features! | Netlify CMS | Open-Source Content Management System

You’ve currently set it in global config and thus, it won’t work.