sveltia / sveltia-cms

Alternative to Netlify/Decap CMS. Fast, lightweight, Git-based headless CMS. Modern UX, first-class i18n support, open source & free. Made with Svelte.
MIT License
727 stars 33 forks source link

One of the latest updates seems to break local development #124

Closed Because789 closed 3 months ago

Because789 commented 3 months ago

I have a project where local development worked with a previous version of Sveltia, but now it doesn't. Here is my config:

# backend: not relevant now, since only local dev

media_folder: "src/assets/images"
public_folder: "@assets/images"

i18n:
    structure: "multiple_folders"
    locales:
        - "de"
        - "en"
    default_locale: "de"
    save_all_locales: false

collections:
    - name: "posts"
      i18n: true
      label: "Blog Posts"
      folder: "src/content/blog"
      media_folder: "/src/assets/images/blog"
      public_folder: "@assets/images/blog"
      create: true
      delete: true
      fields:
          - name: "title"
            widget: "string"
            label: "Post Title"
            i18n: true
          - label: "Description"
            name: "description"
            widget: "string"
            i18n: true
          - label: "Publish Date"
            name: "pubDate"
            widget: "datetime"
            format: "YYYY-MM-DD HH:mm"
            i18n: "duplicate"
          - label: "Image"
            name: "heroImage"
            widget: "image"
            i18n: "duplicate"
          - name: "body"
            widget: "markdown"
            label: "Post Body"
            i18n: true

When I open my Astro project on http://localhost:4321/admin/index.html and select src/content/blog, no posts show up (they previously did). When I save a new asset, it's saved at: src/content/blog/src/assets/images/whatever.jpg. A new post is saved at src/content/blog/src/content/blog/de/test.md and src/content/blog/src/content/blog/en/test.md

kyoshino commented 3 months ago

Hmm, will take a look.

kyoshino commented 3 months ago

When I test the config locally, the entry and asset files are saved properly under src/content/blog.

When I open my Astro project on http://localhost:4321/admin/index.html and select src/content/blog

Maybe this is the cause. You need to select the project root directory that contains src, not the blog directory itself.

Because789 commented 3 months ago

Oh man, yeah, "select the project’s root directory", there it is. Seems like the first time around I actually read and the second time I let myself be led by a terrible intuition. Sorry for bothering you with that, gonna close.

kyoshino commented 3 months ago

Great to hear the problem is solved! I’ll add user-friendly local workflow instructions to the entrance page 😆