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

Pre-existing images not displayed in gallery #57

Closed
dsgibbons opened this issue Sep 13, 2023 · 6 comments
Closed

Pre-existing images not displayed in gallery #57

dsgibbons opened this issue Sep 13, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@dsgibbons
Copy link

First of all, thank you for making this. I much prefer using this to Decap CMS.

I have a gallery configured like so in config.yml:

collections: # A list of collections the CMS should be able to edit
  - name: 'myGallery' 
    label: 'My Gallery'
    folder: 'src/routes/myGallery'
    create: true
    fields:
      - { label: 'Title', name: 'title', widget: 'string' }
      - { label: 'Publish Date', name: 'date', widget: 'datetime' }
      - { label: 'Body', name: 'body', widget: 'markdown' }
      - { label: 'Thumbnail', name: 'thumbnail', widget: 'image' }
      - label: 'Gallery'
        name: 'galleryImages'
        widget: 'list'
        summary: '{{fields.image}}'
        field: { label: Image, name: image, widget: image }

When I go to the UI, pre-existing images don't appear in the gallery, even though they are in the Markdown metadata under galleryImages. If I re-add the images via Svelta CMS, the images appear in the UI. However, the resulting Markdown is unchanged, and if I reload the post in the UI, the images disappear again.

@kyoshino
Copy link
Member

Hey, thanks for checking out Sveltia CMS! My quick local test couldn’t reproduce the issue. Do you use the GitHub backend or the local repository? #35 may be related, but not sure. 🤔

@kyoshino kyoshino added the bug Something isn't working label Sep 13, 2023
@dsgibbons
Copy link
Author

dsgibbons commented Sep 24, 2023

I'm using the GitHub backend. I'm not sure if this is the same issue as #35. The gallery images show up fine in Decap CMS.

@kyoshino
Copy link
Member

Hmm, I’m puzzled. What are your media_folder and typical image paths?

Sveltia CMS only displays images stored under the global and collection-specific media_folders (field-specific folders are not supported yet, but it’s probably not the case here). For example, If media_folder is static/uploads, static/images/favicon.png won’t show up in the gallery, which is intentional.

@dsgibbons
Copy link
Author

Ok I know the problem now.

In the markdown preamble, DecapCMS produces:

---
title: ...
date: ...
thumbnail: ...
galleryImages:
  - /uploads/img1.jpg
  - /uploads/img2.jpg
---

where SveltiaCMS produces:

---
title: ...
date: ...
thumbnail: ...
galleryImages:
  - image: /uploads/img1.jpg
  - image: /uploads/img2.jpg
---

I had previously created the markdown using DecapCMS, so the gallery images weren't viewable in Sveltia. I think I prefer the DecapCMS format - can Sveltia be changed to match?

@kyoshino
Copy link
Member

Thanks for looking into this! So it’s a compatibility issue in Sveltia. I’ll fix it for sure.

@kyoshino kyoshino self-assigned this Sep 29, 2023
@kyoshino
Copy link
Member

The fix is in 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants