Unable to bind a relation between post (content/posts) and authors (data/authors)
samtrion opened this issue · comments
In the current setup with Hugo, it is not possible for me to link the collection pages-posts
with the data collection data-authors
with a relationship. The dropdown is empty.
See configuration
collections:
# Data `Authors`
- name: data-authors
label: "Data/Authors"
label_singular: "Data/Author"
folder: "data/authors"
create: true
format: yml
extension: yaml
i18n: false
editor:
preview: false
summary: "Id: `{{id}}` | Name: `{{name}}` | Default: `{{isdefault|ternary('Yes', 'No', 'Help')}}`"
fields:
- label: Id
name: id
widget: hidden
- label: Display Name
name: name
widget: string
- label: Is Default Author
name: isdefault
widget: boolean
default: false
- label: Mail
name: mail
widget: string
- label: Page
name: page
widget: string
- label: Use VG Wort
name: useVGWort
widget: boolean
default: false
- label: Social
name: social
widget: object
required: false
fields:
- label: LinkedIn
name: linkedin
widget: string
required: false
- label: Xing
name: xing
widget: string
required: false
- label: "Twitter / X"
name: twitter
widget: string
required: false
- label: GitHub
name: github
widget: string
required: false
- label: GitLab
name: gitlab
widget: string
required: false
- label: Stack Overflow
name: stackoverflow
widget: string
required: false
# Collection `Posts`
- name: pages-posts
label: "Pages/Posts"
label_singular: Post
folder: "content/posts"
path: "{{slug}}/index"
icon: post_add
i18n:
structure: multiple_files
locales:
- en
- de
create: true
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: Author
name: author
widget: relation
i18n: duplicate
collection: data-authors
value_field: "id"
search_fields: ["id"]
display_fields: ["name"]
If i switch back to Decap CMS it works fine with this configuration
Interesting, I have a bunch of relation fields in client setups. Will have a look shortly.
Maybe this is the case, because data-authors
is a hugo data-template. Which is not directly related to the content
This was due to a locale mismatch: pages-posts
are either en
or de
while data-authors
are not localized (internally having one locale called _default
). A fallback is now in place.
I have just shipped v0.12.2 with the fixes for the 3 issues you’ve reported! Please reload the CMS and try again.