logo
Submitted by Mikhail Ismajlov on Mon, 08/19/2019 - 13:29

Very often you need to make a landing page on a site whose template is significantly different from the rest of the site. Often this is a page of promotions, events, presentations.

For these purposes, there is a convenient Paragraphs builder:

https://www.drupal.org/project/paragraphs

Paragraphs allows you to display other types of paragraphs through a multiple field in a node: photo galleries, text with an image, sliders, videos, and more.

In order for you to have such an opportunity, let's include on the Paragraphs module, Paragraphs demo. The Paragraphs demo already has prefabricated paragraph types. We also need a module Entity Reference Revisions:

Now let's add create a new content type Landing Page (or you can use the existing Page, Article) paragraphs field to the content type:

https://www.drupal.org/project/entity_reference_revisions

drupal 8 paragraphs

We select an unlimited number of values for this new field.

drupal 8 paragraphs

manage fields

We can add more types of paragraphs, any galleries, videos, parallax pictures. In 7th Drupal there are many additional modules for various types of paragraph.

Paragraphs pack

Classy paragraphs

Edgy

Entity background

Paragraphs Defaults

Apachesolr Paragraphs

Paragraphs ID

Entity behaviors

Perhaps in the future, these modules will appear for the 8th Drupal.

Now when we create nodes of the Landing Page type, we can add various types of paragraphs:

drupal 8 paragraphs

drupal 8 paragraphs

It looks something like this:

Drupal 8 paragraphs

Paragraphs module provides a convenient interface for editing landing pages, but you still have to draw up the output of materials on the page yourself.

Let's try adding a new type of Slideshow paragraph. To do this, you need a module that displays the Drupal fields in the form of a gallery, for example this Gallery Formatter:

https://www.drupal.org/project/galleryformatter

Install the module and create a new paragraph type:

/admin/structure/paragraphs_type/add

drupal 8 paragraphs

In the paragraph type, now add the Photos field:

drupal 8 paragraphs

To upload photos as many as you want, put an unlimited number in the field settings:

drupal 8 paragraphs

In the manage display tab, set the jQuery Gallery format for the image field:

drupal 8 gallery formatter

Now when we edit the Landing Page node, we can add gallery as a separate paragraph:

drupal 8 paragraphs

On the page, this module without decoration looks like this:

Drupal 8 gallery formatter

I think over time, the authors of the module will correct the design and it will look the same as in the 7th version of Drupal.

The paragraphs module is suitable for landing pages, news pages, blogs, but at the same time you still have to page up to make them look good.