Configuring Layout Container and Layout Mode
- Topics:
- Administering
CREATED FOR:
- Admin
Responsive Layout is a mechanism for realizing responsive web design. This allows the user to create web pages that have a layout and dimensions dependent on the devices their users use.
AEM realizes responsive layout for your pages using a combination of mechanisms:
-
Layout Container component
This component provides a grid-paragraph system to allow you to add and position components within a responsive grid. It can be used as the default parsys for your page and/or made available to authors in the component browser.
-
The default Layout Container component is defined under:
/libs/wcm/foundation/components/responsivegrid
-
You can define layout containers:
-
As a component that the user can add to a page.
-
As the default parsys for the page.
-
Both.
You can have the layout container as standard for the page, while allowing the user to add further layout containers within this; for example, to achieve column control.
-
-
-
Layout Mode
Once the layout container is positioned on your page you can use the Layout mode to position content within the responsive grid. -
Emulator
This allows you to create and edit responsive websites that rearrange the layout according to device/window size by resizing components interactively. The user can then see how the content will be rendered using the Emulator.
With these responsive grid mechanisms you can:
- Use breakpoints (that indicate device grouping) to define differing content behavior based on device layout.
- Hide components based on device group (define on which breakpoint a component will be hidden).
- Use horizontal snap to grid (place components into the grid, resize as required, define when they should collapse/reflow to be side-by-side or above/below).
- Realize column control.
Configuring the Responsive Emulator
This tasks allow you to see the responsive Emulator on your site.
Register your Page Components for Emulation
To enable the emulator to support your pages, you must register your page components. See Registering Page Components for Simulation.
Specify the Device Groups
To specify the device groups that appear in the Devices list of the emulator see Specifying the Device Groups.
Link your Site to the Specified Device Groups
To include the dmulator you need to link your site to the device groups. See Adding the Devices List (for both the classic and touch-optimized UI).
Activate Layout Mode for your Site
These procedures are used to enable the Layout mode on your site.
Configure the Breakpoints
-
Are used in responsive design.
-
Can be defined:
- On the page template, from where the settings will be copied to any pages created with that template.
- On the page node, from where the settings will be inherited by any child pages.
-
Define a title and a width:
- The title describes the generic device grouping, with orientation if required; for example phone, tablet, tabletlandscape.
- The width defines the maximum width in pixels for that generic device grouping. For example, if the breakpoint phone has a width of 768 then that it the maximum width of the layout used for a phone device.
-
Are visible as markers at the top of the page editor when you are using the emulator.
-
Are inherited from the parent node hierarchy and can be overridden at will.
-
There is a default (out-of-the-box) breakpoint which covers everything above the last configured breakpoint.
They can be defined using CRXDE Lite or XML.
- you need to add breakpoints to the templates.
- add breakpoints to the templates
- add the same breakpoints to the existing pages
As inheritance is in operation you can limit this to the root page of your content.
Configuring Breakpoints using CRXDE Lite
-
Using CRXDE Lite (or equivalent), navigate to either:
- Your template definition.
- The
jcr:content
node of your page.
-
Under
jcr:content
create the node:- Name:
cq:responsive
- Type:
nt:unstructured
- Name:
-
Under this create the node:
- Name:
breakpoints
- Type:
nt:unstructured
- Name:
-
Under the breakpoints node you can create any number of breakpoints. Each definition is a single node with the following properties:
- Name:
<descriptive name>
- Type:
nt:unstructured
- Title:
String
*<descriptive title seen in Emulator>
* - Width:
Decimal
*<value of breakpoint>
*
- Name:
Configuring Breakpoints using XML
Breakpoints are located inside the <jcr:content>
section of the .context.html
under the appropriate template (or content) folder.
An example definition:
<cq:responsive jcr:primaryType="nt:unstructured">
<breakpoints jcr:primaryType="nt:unstructured">
<phone jcr:primaryType="nt:unstructured" title="{String}Phone" width="{Decimal}768"/>
<tablet jcr:primaryType="nt:unstructured" title="{String}Tablet" width="{Decimal}1200"/>
</breakpoints>
</cq:responsive>
Add a Responsive Information Provider
Copy the following cq:infoProviders
node structure into your parent page component:
/libs/foundation/components/page/cq:infoProviders/responsive
Enable Component Resizing for the Page
These procedures are required so you can resize components in the Layout mode.
Set Layout Container as Main Parsys
To set the main parsys of your page to be a layout container you need to define the parsys as:
wcm/foundation/components/responsivegrid
In either the:
- Page component
- Page template (for future use)
The following two examples illustrate the definition:
-
HTL:
<sly data-sly-resource="${'par' @ resourceType='wcm/foundation/components/responsivegrid'}/>
-
JSP:
<cq:include path="par" resourceType="wcm/foundation/components/responsivegrid" />
Include the Responsive CSS
CSS for Breakpoints using LESS
AEM uses LESS to generate parts of the necessary CSS, these need to be included for your projects.
You will also need to create a client library to provide additional configuration and function calls. The following LESS extract is an example of the minimum you need to add to your project:
@import (once) "/libs/wcm/foundation/clientlibs/grid/grid_base.less";
/* maximum amount of grid cells to be provided */
@max_col: 12;
/* default breakpoint */
.aem-Grid {
.generate-grid(default, @max_col);
}
/* phone breakpoint */
@media (max-width: 768px) {
.aem-Grid {
.generate-grid(phone, @max_col);
}
}
/* tablet breakpoint */
@media (min-width: 769px) and (max-width: 1200px) {
.aem-Grid {
.generate-grid(tablet, @max_col);
}
}
The base grid definition can be found under:
/libs/wcm/foundation/clientlibs/grid/grid_base.less
Styling Considerations
Components held within a responsive container will be resized (together with their respective HTML DOM elements) according to the responsive grid size. Therefore, in these circumstances, it is recommended to avoid (or update) definitions of fixed width (contained) DOM elements.
For example:
-
Before:
width=100px
-
After:
max-width=100px
Resizing and Adaptive Image Compliance
Any resizing of a component within the grid will trigger the following listeners as appropriate:
-
beforeedit
-
beforechildedit
-
afteredit
-
afterchildedit
To properly resize and update the content of an adaptive image included in a responsive grid, you need to add an afterEdit
set to REFRESH_PAGE
listener into the EditConfig
file of every contained component.
For example:
<cq:listeners jcr:primaryType="cq:EditListenersConfig" afteredit="REFRESH_PAGE" />
The adaptive image mechanism is made available via a script that controls selection of the correct image for the current size of the window. It activates after the DOM is ready or when receiving a dedicated event. Currently the page must be refreshed to properly reflect the result of the user’s action.
Enable the Layout Container Component for Page
These tasks allow authors to drag instances of the Layout Container component onto the page.
Enable the Layout Container Component for Page Editing
To allow authors to add further responsive grids to the content pages you need to enable the Layout Container component for your page. You can do this using either:
-
Author Environment
Use Design mode to activate the Layer Container component for a page.
-
Component Definition
Use
allowedComponent
or a static include when defining the component.
Configure the Grid of the Layout Container
You can configure the number of columns available for each specific instance of layout container:
-
Author Environment
You can configure the number of columns available for each specific instance of layout container.
To do this, use Design mode, then open the design dialog for the required container. Here you can specific how many columns will be available for positioning and sizing. The default is 12.
-
XML
Definitions for the responsive grid are specified in:
etc/design/<*your-project-name*>/.content.xml
The following parameters can be defined:
-
Number of columns available:
columns="{String}8"
-
Components that can be added to the current component:
components="[/libs/wcm/foundation/components/responsivegrid, ...
-
Experience Manager
- Administering User Guide overview
- Sites Features
- Website Administration
- Reusing Content: Multi Site Manager and Live Copy
- Live Copy Overview Console
- Configuring Live Copy Synchronization
- Creating and Synchronizing Live Copies
- MSM Rollout Conflicts
- MSM Best Practices
- Translating Content for Multilingual Sites
- Managing Translation Projects
- Identifying Content to Translate
- Preparing Content for Translation
- Creating a Language Root Using the Classic UI
- Connecting to Microsoft Translator
- Configuring the Translation Integration Framework
- Language Copy Wizard
- Translation Enhancements
- Translation Best Practices
- Configurations and the Configuration Browser
- AEM FAQs
- Operations
- Dashboards
- Operations Dashboard
- Backup and Restore
- Data Store Garbage Collection
- Monitoring Server Resources Using the JMX Console
- Working with Logs
- Configure the Rich Text Editor
- Configure the Video component
- The Bulk Editor
- Configuring Email Notification
- Configuring RTE for Producing Accessible Sites
- The Link Checker
- Troubleshooting AEM
- Audit Log Maintenance in AEM 6
- Editor
- Managing Access to Workflows
- Using cURL with AEM
- Configuring Undo for Page Editing
- Proxy Server Tool (proxy.jar)
- Configuring for AEM Apps
- Administering Workflows
- Configuring Search Forms
- Tools Consoles
- Reporting
- Administering Workflow Instances
- Configuring Layout Container and Layout Mode
- Enabling Access to Classic UI
- Starting Workflows
- Configure the Rich Text Editor plug-ins
- Admin Consoles
- Security
- User Administration and Security
- User, Group and Access Rights Administration
- Security Checklist
- OWASP Top 10
- Running AEM in Production Ready Mode
- Identity Management
- Adobe IMS Authentication and Admin Console Support for AEM Managed Services
- Creating a Closed User Group
- Mitigating serialization issues in AEM
- User Synchronization
- Encapsulated Token Support
- Single Sign On
- How to Audit User Management Operations in AEM
- SSL By Default
- SAML 2.0 Authentication Handler
- Closed User Groups in AEM
- Granite Operations - User and Group Administration
- Enabling CRXDE Lite in AEM
- Configuring LDAP with AEM 6
- Configure the Admin Password on Installation
- Service Users in AEM
- Encryption Support for Configuration Properties
- Handling GDPR Requests for the AEM Foundation
- Content Disposition Filter
- Personalization
- eCommerce
- Integration
- Integrating with Third-Party Services
- Integrating with Salesforce
- Integrating with Adobe Target
- Integrating with Adobe Analytics
- Connecting to Adobe Analytics and Creating Frameworks
- Configuring Link Tracking for Adobe Analytics
- Mapping Component Data with Adobe Analytics Properties
- Configuring Video Tracking for Adobe Analytics
- HTTP2 Delivery of Content FAQ
- Troubleshooting your Adobe Campaign Integration
- SharePoint Connector Licenses, Copyright Notices, and Disclaimers
- SharePoint Connector
- DHTML Viewer End-of-Life FAQs
- Integrating with Adobe Campaign Classic
- Related Community Articles
- Integrating with Adobe Campaign Standard
- Flash Viewers End-of-Life Notice
- Integrating with Adobe Creative Cloud
- Integrating with Adobe Dynamic Tag Management
- Opting Into Adobe Analytics and Adobe Target
- AEM Portals and Portlets
- Integrating with Dynamic Media Classic
- Troubleshooting Integration Issues
- Integrating with BrightEdge Content Optimizer
- Best Practices for Email Templates
- Catalog Producer
- Integrating with Silverpop Engage
- Integrating with Adobe Campaign
- Integrating with ExactTarget
- Analytics with External Providers
- Integrating with the Adobe Marketing Cloud
- Manually Configuring the Integration with Adobe Target
- Prerequisites for Integrating with Adobe Target
- Adobe Classifications
- Solutions Integration
- Target Integration with Experience Fragments
- Best Practices
- Content Management