SlideShare a Scribd company logo
CREATING LAYOUTS AND
LANDING PAGES
FOR DRUPAL 8
Suzanne Dergacheva
ABOUT ME
• Suzanne Dergacheva
• Co-founded Evolving Web
in 2007
• Drupal trainer, site builder,
themer, developer…
• @suzanne_kennedy
CREATING LAYOUTS &
LANDING PAGES IN D8
• Planning Your Landing Pages
• Landing Page Configuration
• Overall Layout
• Theming Approaches + Sustainable Layouts
PLANNING YOUR
LANDING PAGES
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
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?
USE CASES
• Re-usable landing pages with a consistent layout
• 1-time use landing pages
• Landing pages with a flexible layout
RE-USABLE
LANDING PAGES
DESIGN
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
LANDING PAGE CONTENT TYPE
Banner Image Field
Calls to Action
Title
Title Prefix Field
LANDING PAGE CONTENT TYPE
Banner Image Field
Calls to Action
Title
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
DEFINING THE CALL TO ACTION
Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin
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
PARAGRAPH TYPES
ADDING CALLS TO ACTION
ALTERNATIVES
• Field Collection
• Entity reference field with Inline Entity Form
1-TIME USE
LANDING PAGES
DESIGN
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
Custom block (banner type)
Custom blocks (CTA type)
Views
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
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
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
SETTINGS TRAY & PLACE BLOCK
BLOCK VISIBILITY GROUPS
LANDING PAGES
WITH A FLEXIBLE
LAYOUT
LANDING PAGE WITH A
FLEXIBLE LAYOUT
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
PANELS
WHY USE PANELS
• 1 edit link to edit content + layout
• In-place editor
• User-friendly, drag-and-drop
NESTED PARAGRAPHS
Choose the
layout
Add the
content to
the layout
NESTED PARAGRAPHS
NESTED PARAGRAPHS
• 1 edit link
• Easy to switch the layout
• Create a limited number of layout types
• Control which calls to action go where
THEMING
APPROACHES
OVERALL Layout
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
OVERALL LAYOUT Header
second
Header first
Footer first
Footer
second
Footer top
EVERYTHING IS A BLOCK
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
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
Update the Markup
2-COLUMN LANDING PAGE
CSS ALREADY EXISTS
@media screen and (min-width: 1180px){
.grid-2-column {
width: 50%;
display: inline-block;
}
}
Bootstrap
Custom CSS
UPDATING THE MARKUP
{%
set classes = [
page.sidebar_first ? '3-col-grid',
]
%}
<div{{ attributes.addClass(classes) }}>
{{ title_prefix }}
{% if label %}
<h2>{{ label }}</h2>
{% endif %}
{{ title_suffix }}
{% block content %}
{{ content }}
{% endblock %}
</div>
field--paragraph--field-calls-to-action-column-1.html.twig
field--paragraph--field-calls-to-action-column-2.html.twig
{%
set classes = [
'field',
'field--name-' ~ field_name|clean_class,
'field--type-' ~ field_type|clean_class,
'field--label-' ~ label_display,
'col-md-6',
'grid-2-column',
]
%}
3-COLUMN VIEW
CSS ALREADY EXISTS
@media screen and (min-width: 1180px){
.grid-3-column {
width: 33%;
display: inline-block;
}
}
Bootstrap
Custom CSS
UPDATING THE MARKUP
Views Grid Settings
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)
Update the CSS
2-COLUMN LANDING PAGE
UPDATING THE CSS
@media screen and (min-width: 1180px){
.field—name-field-calls-to-action-column-1,
.field—name-field-calls-to-action-column-2 {
display: inline-block;
width: 50%;
}
}
3-COLUMN VIEW
UPDATING THE CSS
@media screen and (min-width: 1180px){
.view-drupalorg-casestudies .views-row {
display: inline-block;
width: 33%;
}
}
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
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
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
Evaluate This Session
THANK YOU!
events.drupal.org/dublin2016/schedule

More Related Content

PDF
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
PDF
Creating a Reusable Drupal Website for Higher Education - at USG Tech Day
PDF
Creating a Reusable Drupal Website for Higher Education - Webinar
PDF
Creating Dynamic Landing Pages for Drupal with Panels - Webinar
PDF
What is Drupal? And Why is it Useful? Webinar
PDF
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
PDF
The Wonderful World of Drupal 8 Multilingual
PDF
DrupalCamp NYC Panels Presentation - April 2014
Creating Landing Pages and Layouts for Drupal 8 - DrupalCon Baltimore
Creating a Reusable Drupal Website for Higher Education - at USG Tech Day
Creating a Reusable Drupal Website for Higher Education - Webinar
Creating Dynamic Landing Pages for Drupal with Panels - Webinar
What is Drupal? And Why is it Useful? Webinar
Minimalist Theming: How to Build a Lean, Mean Drupal 8 Theme
The Wonderful World of Drupal 8 Multilingual
DrupalCamp NYC Panels Presentation - April 2014

What's hot (20)

PDF
Introduction to the Drupal - Web Experience Toolkit
ODP
Drupal - Blocks vs Context vs Panels
PDF
Responsive Design in Drupal with Zen and Zen Grids
PDF
A Custom Drupal Theme in 40 Minutes
KEY
Learn Drupal's Most Powerful Site-Building Modules: Display Suite, Context, V...
PDF
Creating a Drupal Install Profile for a Large Organization
PDF
Put A Map On It! Enhanced geolocation in WordPress with Geo Mashup
PDF
Drupal Site Building Checklist from DrupalCamp New Jersey
PPT
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
PDF
Responsive Web Design using ZURB Foundation
PDF
Zurb foundation
PPTX
Drupal Camp Manila 2014 - Theming with Zen
KEY
Getting started with CSS frameworks using Zurb foundation
PPTX
BDUG Responsive Web Theming - 7/23/12
PPTX
Creating Web Templates for SharePoint 2010
PDF
DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...
PPTX
Advanced Wordpress
ZIP
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
PDF
Creating a Responsive Drupal Theme: Presentation from DrupalCamp Montreal 2012
PDF
Pimp your wp site
Introduction to the Drupal - Web Experience Toolkit
Drupal - Blocks vs Context vs Panels
Responsive Design in Drupal with Zen and Zen Grids
A Custom Drupal Theme in 40 Minutes
Learn Drupal's Most Powerful Site-Building Modules: Display Suite, Context, V...
Creating a Drupal Install Profile for a Large Organization
Put A Map On It! Enhanced geolocation in WordPress with Geo Mashup
Drupal Site Building Checklist from DrupalCamp New Jersey
Creating Responsive Drupal Sites with Zen Grids and the Zen 5 Theme
Responsive Web Design using ZURB Foundation
Zurb foundation
Drupal Camp Manila 2014 - Theming with Zen
Getting started with CSS frameworks using Zurb foundation
BDUG Responsive Web Theming - 7/23/12
Creating Web Templates for SharePoint 2010
DRY CSS A don’t-repeat-yourself methodology for creating efficient, unified a...
Advanced Wordpress
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Creating a Responsive Drupal Theme: Presentation from DrupalCamp Montreal 2012
Pimp your wp site
Ad

Viewers also liked (20)

PDF
Paragraphs and the Fieldable Authoring Experience in Drupal 7
PDF
Bootstrap framework and drupal paragraphs
ZIP
Theme Kickstart
PDF
UX design for every screen
PDF
[Srijan Wednesday Webinars] Drupal 8: Goodbye to 10 Years of Theming Headaches
PPT
PSD to a Drupal Theme (using a base theme)
PPT
Converting Static Html To Drupal Theme
PPS
TBI Data Integration
PPTX
Drupal 8 DX Changes
PPTX
Patient-controlled medical records
PPTX
Drupal developers of the Eastern Europe.
PPTX
Top 20 mistakes you will make on your 1st Drupal project
PDF
Hsc 2008 Day 2
PDF
From Drupal 7 to Drupal 8 - Drupal Intensive Course Overview
PPTX
Paragraphs at drupal 8.
PDF
Building a Custom Theme in Drupal 8
PPTX
Using a Shared Electronic Patient Record to Develop and Assess e-Consultation...
PDF
operationalizing asthma analytic plan using omop cdm brandt
PPTX
Amia now! session two
PPTX
HIE technical infrastructure
Paragraphs and the Fieldable Authoring Experience in Drupal 7
Bootstrap framework and drupal paragraphs
Theme Kickstart
UX design for every screen
[Srijan Wednesday Webinars] Drupal 8: Goodbye to 10 Years of Theming Headaches
PSD to a Drupal Theme (using a base theme)
Converting Static Html To Drupal Theme
TBI Data Integration
Drupal 8 DX Changes
Patient-controlled medical records
Drupal developers of the Eastern Europe.
Top 20 mistakes you will make on your 1st Drupal project
Hsc 2008 Day 2
From Drupal 7 to Drupal 8 - Drupal Intensive Course Overview
Paragraphs at drupal 8.
Building a Custom Theme in Drupal 8
Using a Shared Electronic Patient Record to Develop and Assess e-Consultation...
operationalizing asthma analytic plan using omop cdm brandt
Amia now! session two
HIE technical infrastructure
Ad

Similar to Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin (20)

PPTX
Drupal: Organizing Content for Multiple Audiences
PPTX
Drupal architectures for flexible content - Drupalcon Barcelona
PDF
Creating Landing Pages for Drupal 8
PDF
Building a Great User Experience for Content Editors in Drupal 8
KEY
Efficient theming in Drupal
PDF
Carrington Core (2014)
PDF
Creating a Great XPages User Interface
PDF
Creating a Great XPages User Interface, TLCC Teamstudio Webinar - Feb, 2014
PPTX
HTML5- Create divisions in a web page
PDF
X All The Things: Enterprise Content Management
PPTX
Module 4 - Dreamweaver Templates (Static vs. Dynamic Content)
PPTX
SharePoint Navigation: A Step Towards Success
PPTX
SPSHawaii: Navigation: A Step Towards Success in SharePoint
PDF
Introduction to Responsive Web Development
PPTX
Wordpress overview
PPTX
UF HTML Template Presentation
PPTX
Wordpress theme development
ZIP
44 Slides About 22 Modules
PPTX
Quick Wins to Jump Start Your SharePoint Implementation - SPEngage Raleigh 2016
PPTX
Drupal: Organizing Content for Multiple Audiences
Drupal architectures for flexible content - Drupalcon Barcelona
Creating Landing Pages for Drupal 8
Building a Great User Experience for Content Editors in Drupal 8
Efficient theming in Drupal
Carrington Core (2014)
Creating a Great XPages User Interface
Creating a Great XPages User Interface, TLCC Teamstudio Webinar - Feb, 2014
HTML5- Create divisions in a web page
X All The Things: Enterprise Content Management
Module 4 - Dreamweaver Templates (Static vs. Dynamic Content)
SharePoint Navigation: A Step Towards Success
SPSHawaii: Navigation: A Step Towards Success in SharePoint
Introduction to Responsive Web Development
Wordpress overview
UF HTML Template Presentation
Wordpress theme development
44 Slides About 22 Modules
Quick Wins to Jump Start Your SharePoint Implementation - SPEngage Raleigh 2016

More from Suzanne Dergacheva (17)

PDF
It's All About the Experience: What I’ve learnt from talking to thousands of ...
PDF
Dipping Your Toe into Drupal 8 Module Development
PDF
Device-Agnostic Content Strategy for Drupal
PDF
What is Drupal? An Introduction to Drupal 8
PDF
Using Core Themes in Drupal 8
PDF
Upgrading to Drupal 8: Benefits and Gotchas
PDF
Migrate for Site Builders from MidCamp 2016
PDF
Intro to Drupal Migrate for Site Builders
PDF
Drupal migrate-june2015
PDF
10 New Things You Can Do with Drupal 8 Out-of-the-Box
PDF
Creating a User-Friendly Search UI with Drupal - Presentation at DrupalCamp T...
PDF
Getting Started with Drupal 8 Theming - DrupalCamp Toronto 2014
PDF
Using Panels Wisely - DrupalCamp Ottawa 2014
PDF
Meilleures pratiques pour construire un site web Drupal
PDF
Site Building Checklist DrupalCamp Ottawa
KEY
Views Configuration at Drupal Camp Toronto 2012
PDF
Drupal 7 for Government Case Study: Presentation at DrupalCamp Montreal 2012
It's All About the Experience: What I’ve learnt from talking to thousands of ...
Dipping Your Toe into Drupal 8 Module Development
Device-Agnostic Content Strategy for Drupal
What is Drupal? An Introduction to Drupal 8
Using Core Themes in Drupal 8
Upgrading to Drupal 8: Benefits and Gotchas
Migrate for Site Builders from MidCamp 2016
Intro to Drupal Migrate for Site Builders
Drupal migrate-june2015
10 New Things You Can Do with Drupal 8 Out-of-the-Box
Creating a User-Friendly Search UI with Drupal - Presentation at DrupalCamp T...
Getting Started with Drupal 8 Theming - DrupalCamp Toronto 2014
Using Panels Wisely - DrupalCamp Ottawa 2014
Meilleures pratiques pour construire un site web Drupal
Site Building Checklist DrupalCamp Ottawa
Views Configuration at Drupal Camp Toronto 2012
Drupal 7 for Government Case Study: Presentation at DrupalCamp Montreal 2012

Recently uploaded (20)

PDF
Sims 4 Historia para lo sims 4 para jugar
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PPTX
Internet___Basics___Styled_ presentation
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPT
tcp ip networks nd ip layering assotred slides
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
Testing WebRTC applications at scale.pdf
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Sims 4 Historia para lo sims 4 para jugar
Job_Card_System_Styled_lorem_ipsum_.pptx
Internet___Basics___Styled_ presentation
SASE Traffic Flow - ZTNA Connector-1.pdf
The New Creative Director: How AI Tools for Social Media Content Creation Are...
international classification of diseases ICD-10 review PPT.pptx
introduction about ICD -10 & ICD-11 ppt.pptx
Design_with_Watersergyerge45hrbgre4top (1).ppt
tcp ip networks nd ip layering assotred slides
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PptxGenJS_Demo_Chart_20250317130215833.pptx
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Decoding a Decade: 10 Years of Applied CTI Discipline
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Module 1 - Cyber Law and Ethics 101.pptx
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Testing WebRTC applications at scale.pdf
INTERNET------BASICS-------UPDATED PPT PRESENTATION
RPKI Status Update, presented by Makito Lay at IDNOG 10
APNIC Update, presented at PHNOG 2025 by Shane Hermoso

Creating Layouts and Landing Pages for Drupal 8 - DrupalCon Dublin

  • 1. CREATING LAYOUTS AND LANDING PAGES FOR DRUPAL 8 Suzanne Dergacheva
  • 2. ABOUT ME • Suzanne Dergacheva • Co-founded Evolving Web in 2007 • Drupal trainer, site builder, themer, developer… • @suzanne_kennedy
  • 3. CREATING LAYOUTS & LANDING PAGES IN D8 • Planning Your Landing Pages • Landing Page Configuration • Overall Layout • Theming Approaches + Sustainable 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
  • 12. LANDING PAGE CONTENT TYPE Banner Image Field Calls to Action Title
  • 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
  • 14. DEFINING THE CALL TO ACTION
  • 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
  • 18. ADDING CALLS TO ACTION
  • 19. ALTERNATIVES • Field Collection • Entity reference field with Inline Entity Form
  • 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
  • 23. Custom block (banner type) Custom blocks (CTA type) Views
  • 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
  • 27. SETTINGS TRAY & PLACE BLOCK
  • 29. LANDING PAGES WITH A FLEXIBLE LAYOUT
  • 30. LANDING PAGE WITH A FLEXIBLE LAYOUT
  • 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
  • 33. WHY USE PANELS • 1 edit link to edit content + layout • In-place editor • User-friendly, drag-and-drop
  • 34. NESTED PARAGRAPHS Choose the layout Add the content to the layout
  • 36. NESTED PARAGRAPHS • 1 edit link • Easy to switch the layout • Create a limited number of layout types • Control which calls to action go where
  • 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
  • 40. OVERALL LAYOUT Header second Header first Footer first Footer second Footer top
  • 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
  • 46. CSS ALREADY EXISTS @media screen and (min-width: 1180px){ .grid-2-column { width: 50%; display: inline-block; } } Bootstrap Custom CSS
  • 47. UPDATING THE MARKUP {% set classes = [ page.sidebar_first ? '3-col-grid', ] %} <div{{ attributes.addClass(classes) }}> {{ title_prefix }} {% if label %} <h2>{{ label }}</h2> {% endif %} {{ title_suffix }} {% block content %} {{ content }} {% endblock %} </div> field--paragraph--field-calls-to-action-column-1.html.twig field--paragraph--field-calls-to-action-column-2.html.twig {% set classes = [ 'field', 'field--name-' ~ field_name|clean_class, 'field--type-' ~ field_type|clean_class, 'field--label-' ~ label_display, 'col-md-6', 'grid-2-column', ] %}
  • 49. CSS ALREADY EXISTS @media screen and (min-width: 1180px){ .grid-3-column { width: 33%; display: inline-block; } } Bootstrap Custom CSS
  • 50. UPDATING THE MARKUP Views Grid Settings
  • 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)
  • 54. UPDATING THE CSS @media screen and (min-width: 1180px){ .field—name-field-calls-to-action-column-1, .field—name-field-calls-to-action-column-2 { display: inline-block; width: 50%; } }
  • 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
  • 60. Evaluate This Session THANK YOU! events.drupal.org/dublin2016/schedule