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
863 stars 43 forks source link

Configuration property `summary` doesn't show the correct value for `{{slug}}` #105

Closed samtrion closed 6 months ago

samtrion commented 6 months ago

I use Sveltia together with Hugo. I would like to manage my tags cleanly and structure them accordingly. I would like to display the configured slug for the respective tag using the summary function.

However, the value from the slug field is not used here, but a new one is generated.

# Collection `Tags`
  - name: pages-tags
    label: "Pages/Tags"
    label_singular: Tag
    folder: "content/tags"
    path: "{{slug}}/index"
    icon: local_offer
    i18n:
      structure: multiple_files
      locales:
        - en
        - de
    create: true
    summary: "{{title}} | {{slug}}"
    fields:
      - label: Slug
        name: slug
        widget: string
        i18n: duplicate
      - label: Translation Key
        name: translationKey
        widget: string
        i18n: duplicate
      - label: Title
        name: title
        widget: string
        i18n: true
      - label: Draft
        name: draft
        widget: boolean
        default: true
        i18n: duplicate

Wrong used slug image

Configured values for Tag .NET image

Configured values for Tag C# image

samtrion commented 6 months ago

Ok, I have found a workaround.

If I add identifier_field: slug to the configuration, it works. But I assume that there should be an internal handling for this, so that we can minimize this error behavior. Especially with the field name slug.

kyoshino commented 6 months ago

slug is a special keyword, and as per the Decap CMS doc, I think the proper configuration would look like:

summary: "{{title}} | {{fields.slug}}"

(without identifier_field), but for some reason it’s not working in Sveltia CMS. I’m fixing the issue.