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

Enhancement: Reusing fields of other content types #563

Closed
estruyf opened this issue Apr 4, 2023 Discussed in #559 · 4 comments
Closed

Enhancement: Reusing fields of other content types #563

estruyf opened this issue Apr 4, 2023 Discussed in #559 · 4 comments
Projects

Comments

@estruyf
Copy link
Owner

estruyf commented Apr 4, 2023

Discussed in #559

Originally posted by itsjavi April 3, 2023
I have 2 content types that have a very similar structure: "Page" and "Article", and I'd like to combine the fields that these 2 content types have in common, to avoid repeating the configuration. Kind of an "inheritance" / merge.

...

@estruyf estruyf added the enhancement New feature or request label Apr 4, 2023
estruyf added a commit that referenced this issue Sep 15, 2023
@estruyf
Copy link
Owner Author

estruyf commented Sep 15, 2023

I am thinking about the following configuration/setup to reuse the fields:

{
  "frontMatter.taxonomy.fieldGroups": [
    {
      "id": "GeneralFields",
      "fields": [
        {
          "title": "Title",
          "name": "title",
          "type": "string",
          "single": true
        },
        {
          "title": "Description",
          "name": "description",
          "type": "string"
        }
      ]
    }
  ],
  "frontMatter.taxonomy.contentTypes": [
    {
      "name": "default",
      "pageBundle": false,
      "previewPath": "'blog'",
      "filePrefix": null,
      "fields": [
        {
          "name": "fieldCollection",
          "type": "fieldCollection",
          "fieldGroup": "GeneralFields"
        },
        {
          "title": "Publishing date",
          "name": "pubDate",
          "type": "datetime",
          "default": "{{now}}",
          "isPublishDate": true
        },
        {
          "title": "Content preview",
          "name": "heroImage",
          "type": "image",
          "isPreviewImage": true
        }
      ]
    }
  ]
}

Do you have any feedback on this @Fasani @itsjavi?

Edit: I think reusing the frontMatter.taxonomy.fieldGroups would be better. This setting allows you to set field groups for the new fieldCollection and block fields.

@itsjavi
Copy link

itsjavi commented Sep 15, 2023

@estruyf that will be enough :) thanks!

@estruyf
Copy link
Owner Author

estruyf commented Sep 15, 2023

Great, I have added this logic to the latest beta version. Please feel free to test it out and let me know how it works for you.

@estruyf estruyf added this to To do in 9.3.0 via automation Sep 15, 2023
@estruyf estruyf moved this from To do to In progress in 9.3.0 Sep 15, 2023
@estruyf estruyf moved this from In progress to Done in 9.3.0 Oct 6, 2023
@estruyf estruyf closed this as completed Oct 6, 2023
@estruyf estruyf mentioned this issue Oct 6, 2023
@itsjavi
Copy link

itsjavi commented Oct 18, 2023

@estruyf I finally could test it and works as expected, thanks for adding this! <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
9.3.0
Done
Development

No branches or pull requests

2 participants