2

Some pages, like the home page, have unique content/layouts that are very different from basic pages. I want the editor to be able to fill in a different set of fields for the home page. Currently, the only way I can achieve this is by making a "Home Page" content type and setting up its fields. However, that feels wrong to make a whole content type for just one page. It would be great if the editor can create a basic page, then choose a layout (maybe a dropdown with the options: Default Page, Home Page, About Page, etc). Each layout would have it's own set of fields.

In WordPress, this can easily be achieved by assigning fields (usually with the Advanced Custom Fields plugin) to different page templates. I would love to replicate this in Drupal.

1 Answer 1

2

In Drupal you can achive this using Paragraphs

Paragraphs module comes with a new "paragraphs" field type that works like Entity Reference's. Simply add a new paragraphs field on any Content Type you want and choose which Paragraph Types should be available to end-users. They can then add as many Paragraph items as you allowed them to and reorder them at will.

enter image description here

You can create paragraph types, and these paragraph types you can add sets of fields.


Alternatively, if you just need this type of functionality for the home page only, then just create a block type /admin/structure/block/block-content/types and add fields to it and then create a block of your block type and assign this block to the home page only.

2
  • So if I want specifc fields to only be available for some pages, I need to use the block method? I would like the editors to be able to choose while editing a page. It's a bit overcomplicated for typical editors to have to assign blocks to specific pages.
    – Eric
    Commented Oct 26, 2018 at 14:41
  • @Eric, as I mentioned if you just need this type of functionality for the home page only, then it makes sense to use the block method. But if you need this functionality for more than the home page than Paragraphs is indeed the way to go.
    – No Sssweat
    Commented Oct 26, 2018 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.