Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with field-specific media_folder #4529

Closed
gtitov opened this issue Nov 2, 2020 · 0 comments · Fixed by #5095
Closed

Problem with field-specific media_folder #4529

gtitov opened this issue Nov 2, 2020 · 0 comments · Fixed by #5095

Comments

@gtitov
Copy link

gtitov commented Nov 2, 2020

I want my post to have one cover that is stored in assets so Hugo is able to resize it. Also my post have multiple images inside text (markdown widget) that I want to be stored in static so I can add these with the UI. Hope it's clear: cover in assets to resize, images inside text in static to add them without any code.

I came up with this config.yml:

backend:
  name: git-gateway
  branch: master
media_folder: 'static/img/blog'
public_folder: '/img/blog'
collections:
  - name: 'blog'
    label: 'Posts'
    folder: 'content/blog'
    create: true
    slug: '{{year}}{{month}}{{day}}{{hour}}{{minute}}{{second}}'
    editor:
      preview: true
    fields:
      - label: 'Title'
        name: 'title'
        widget: 'string'
      - label: 'Cover'
        name: 'image'
        widget: 'image'
        media_folder: '/assets/covers'
        public_folder: '/covers'
        allow_multiple: false
      - label: 'Post'
        name: 'body'
        widget: 'markdown'

Paths to files appears as I expect them to, like that:

---
title: Test
date: 2020-11-01T19:40:17.107Z
author: gman
image: /covers/lighthouse.jpg
---
Post body
![Sample](/img/blog/desert.jpg)

But the cover is stored in static/img/blog/lighthouse.jpg not in assets/covers/lighthouse.jpg.

So it looks like I can't set field based media folder... Is it even possible to do it as I described? Or I didn't understand docs right? Or I did something wrong?

Here is the repo if needed

Originally posted by @gtitov in #3208 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants