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

Issue: Only 1 dimension allowed in contentTypes #197

Closed
kristofzerbe opened this issue Nov 29, 2021 · 7 comments
Closed

Issue: Only 1 dimension allowed in contentTypes #197

kristofzerbe opened this issue Nov 29, 2021 · 7 comments
Labels
enhancement New feature or request
Projects
Milestone

Comments

@kristofzerbe
Copy link

Describe the bug
In case a Frontmatter subentry has to be taken as name of a custom contentType, it won't work. For example:

FrontMatter

---
title: xxx
subtitle: yyy
photo:
  file: my-photo.jpg
  name: My Photo
---

Setting

"frontMatter.taxonomy.contentTypes": [
	"name": "default",
    "previewPath": "/static/photos/",
	"fields": [
		...
        {
          "title": "Article preview",
          "name": "photo.file",
          "type": "image"
        }
	]
]

Expected behavior
Subentries should be noted if they are separated by a period.

@estruyf estruyf added the enhancement New feature or request label Nov 29, 2021
@estruyf
Copy link
Owner

estruyf commented Nov 29, 2021

Thanks @kristofzerbe, this is currently a limitation, but is great to add support in a future version!.

@zivbk1
Copy link

zivbk1 commented Nov 30, 2021

I think this would also help resolve #176

@estruyf estruyf added this to To do in v6.0.0 Jan 10, 2022
@estruyf estruyf moved this from To do to In progress in v6.0.0 Jan 11, 2022
@estruyf estruyf added this to the 6.0.0 milestone Jan 11, 2022
@estruyf
Copy link
Owner

estruyf commented Jan 11, 2022

The first integration of the multi-dimensional content-type field support has been added.

In the content type, you can now define it as follows:

{
  "frontMatter.taxonomy.contentTypes": [
    {
      "name": "multi-dimensional",
      "pageBundle": false,
      "fields": [
        ...
        {
          "title": "Photo",
          "type": "fields",
          "name": "photo",
          "fields": [
            {
              "title": "Title",
              "name": "title",
              "type": "string",
              "default": "default title"
            },
            {
              "title": "URL",
              "name": "url",
              "type": "string"
            }
          ]
        }
      ]
    }
  ]
}

When creating the content, it will automatically include the defined fields. From the metadata section in the Front Matter panel, you can perform changes to your article its front matter.

image

Feel free to test it out in the latest beta version.

@estruyf estruyf moved this from In progress to Ready to test in v6.0.0 Jan 11, 2022
@zivbk1
Copy link

zivbk1 commented Jan 11, 2022

This is excellent!

@estruyf
Copy link
Owner

estruyf commented Jan 12, 2022

Thanks @zivbk1 for verifying!

@kristofzerbe would you mind giving it a try?

@estruyf
Copy link
Owner

estruyf commented Jan 12, 2022

One small change, the object type has been changed to fields. Additionally, support for taxonomy fields has been added + image fields.

Screenshot 2022-01-12 at 11 25 04

@estruyf estruyf moved this from Ready to test to Done in v6.0.0 Jan 14, 2022
@estruyf estruyf closed this as completed Jan 25, 2022
@kristofzerbe
Copy link
Author

Thanks @zivbk1 for verifying!

@kristofzerbe would you mind giving it a try?

Custom subfields are working great. Thanks a lot. :)

Only thing is, that I expect in the frontmatter of my posts the file name only (f.e. my-image.png), because I have multiple image folders according to different device classes (mobile, tablet, normal). I tried now to create an image field called preview with a default value like this, to show the small (mobile) image as preview and use it also as preview image in the dashboard:

{
  "title": "Photograph",
  "name": "photograph",
  "type": "fields",
  "fields": [
    {
      "title": "File",
      "name": "file",
      "type": "string",
      "single": true
    },
    {
      "title": "Preview",
      "type": "image",
      "isPreviewImage": true,
      "default": "/static/photos/mobile/{{file}}"
    }
  ]    
}

Maybe the default type works different as I think or I can't use the variable file is this context...

Greets
Kristof

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Development

No branches or pull requests

3 participants