This presentation from DrupalCon Dublin covered site building techniques for creating landing pages and layouts, including using custom blocks, paragraphs, and panels, and then different theming approaches for creating these layouts.
5. WHAT’S A
LANDING PAGE?
• Target a particular audience
• Display marketing content
and calls to action (CTAs)
• Distinctive layout and content
set
• Funnel users towards content
they’re looking for
• Registration, login, search
forms
6. QUESTIONS TO ASK
• Are you going to be creating many similar
landing pages?
• Is content curated by humans or aggregated by
Drupal?
• Do calls to action need to be re-usable from one
landing page to another?
• Is the content going to be moved around
frequently by editors?
• Do you need to be able to change the layout
easily?
7. USE CASES
• Re-usable landing pages with a consistent layout
• 1-time use landing pages
• Landing pages with a flexible layout
10. REQUIREMENTS
• You need to create multiple landing pages
• Landing pages need to have consistent styling/
layout but variable content
• Editors need to be able to edit the calls to action
easily
• Calls to action can link to anywhere (internal/
external links)
• There are different types of calls to action (links,
videos, downloads, forms)
• Calls to action have different styles
11. LANDING PAGE CONTENT TYPE
Banner Image Field
Calls to Action
Title
Title Prefix Field
13. PARAGRAPHS
• Set up each call to action as a Paragraph field on a landing
page
• Each paragraph has the title, image, text, and link fields
• You can edit the paragraphs when you edit the landing
page
• Title
• Image
• Text
• Link
• Title
• Image
• Text
• Link
• Title
• Image
• Text
• Link
Paragraph CTA Paragraph CTA Paragraph CTA
16. PARAGRAPH TYPES
• A paragraphs field can reference multiple paragraph types
• You can allow users to choose whether to add a video,
image, or file download call to action
• Title
• Image
• Text
• Video
• Title
• Image
• Text
• Link
• Title
• Image
• Text
• Files
Video Call to Action Call to Action File Call to Action
22. REQUIREMENTS
• You need to create a single, distinct landing
page
• Content from the landing page might be re-used
elsewhere
• Some content needs to be aggregated from
across your site
• You might need to re-order sections of the page
occasionally
24. CALLS TO ACTION VIEW
• This view shows a list of featured pages
• Selection/ordering logic is pre-defined
• Each call to action displays fields from the featured page
• Downside: you have to edit the individual pages to change
the content
25. CALL TO ACTION BLOCKS
• Each Call to Action block has title, background image, text, and links
fields
• Place the block on the landing page, can be re-ordered
• Re-use the blocks on other pages
26. WHY USE BLOCK TYPES?
• Re-usable, fieldable, movable
• Blocks are in core
• Downsides:
• You have to edit block content separately
• You have to place the block separately
31. REQUIREMENTS
• You have a series of landing pages with different
layouts
• You need to be able to easily change the layout
of the page (1 column, 2 column, etc)
• You can adjust the content in the selected layout
39. REQUIREMENTS
• You can add, re-position blocks in your overall
layout
• New blocks will fit into the existing layout
• You don’t have to update the theme each time
you add a block
42. BLOCKS & REGIONS
• EVERYTHING is a block
• You place blocks in regions
• Include enough regions in your theme to create
the overall layout you need
• You can avoid writing CSS for particular blocks to
create the layout
43. THEMING APPROACHES
• Updating the Markup
• Use a framework comes with pre-defined,
generic classes (e.g. Bootstrap, Foundation)
• Create a theme ‘from scratch’ where you define
your own generic classes
• Updating the CSS
• Use a framework where you write SASS to
apply pre-defined mixins
• Create a theme ‘from scratch’ where you add
multiple classes as selectors
51. UPDATING THE MARKUP
• Your Twig templates
• Add overall layout classes in page.html.twig
• Add classes in block, field, other templates
• Views configuration
• In grid settings, row settings, or overall CSS class
• Panels configuration
• Blocks config (using the Block Class module)
• Your content (if needed)
56. UPDATING THE CSS
@media screen and (min-width: 1180px){
.view-drupalorg-casestudies .views-row {
display: inline-block;
width: 33%;
}
}
57. UPDATING THE CSS
• You start with some initial CSS to handle your
layout
• When you add new components (views,
paragraphs, blocks, regions) you update your CSS to
add the new selectors
• SASS makes it easier to do this cleanly
58. SUSTAINABLE LAYOUTS
• Plan which layouts your theme will allow
• Limit the variability of styling/layout options
• Make your layout CSS generic enough to be re-
usable for different components
• Nothing in your theme should be content-
specific
• Create separate layout CSS files
• Document your layout and how it will treat new
elements
59. JOIN US FOR
CONTRIBUTION SPRINTS
First Time Sprinter Workshop - 9:00-12:00 -
Room Wicklow2A
Mentored Core Sprint - 9:00-18:00 - Wicklow
Hall 2B
General Sprints - 9:00 - 18:00 - Wicklow Hall 2A