Your mobile strategy may require the ability adapt page content to various device types. So, for example, some content appears if the user views it on a desktop but not on a phone.
While widgets do not support targeting by device type, you can limit the display of a widget's content by device type.
The exercise below explains how to enable a widget for one device type, then disable that widget for a different device type.
Enable a language to have device-specific content
To see the Device drop-down list in a widget, you first need to enable languages to have device-specific content.
- Go to Administration > Localization > Languages in the Admin Console.
- Click Edit for a language. For example, edit US English.
- Set the Has Device Specific Content toggle to Yes on the Details finger tab.
- Click Save.
Select a device type to display widget content
- Select the page to which you want to add targeted content from the left menu.
- From the Device drop-down list in the top toolbar, select a customer segment that should see the content. For example, select Mobile.
- Add a widget containing text or images specific to these device users. To do this:
- Click Edit to enter edit mode for the page.
- If you need to add a row, select Edit in the row table on the page and choose the desired configuration for the row you are adding to the page. If not, proceed to the next step.
- Click Add Widget within one of the row's cells. The Add a Widget window appears and shows widgets available for the page.
- Search for or select a widget from the displayed widget groups and options.
- When you have selected your widget, add content in the way you normally would. For more information on working with widgets, review the Work with Widgets in Spire article.
- When you are finished, click Save.
Test the results by toggling between device types using the drop-down menu.
Hide widget content from a certain device type
In this example, you disable the Rich Content widget for the Phone device type.
- Using the device selector menu, choose Phone.
- Click the widget Edit button.
- Clear the content, and type a space in the text editor.
Adding the space is necessary, as the WYSIWYG editor requires content in the text area.
- Click Save.
- Click Publish.
- Approve by clicking Publish again.
- Click Edit in the upper left corner to hide the page editing options.
Test the results by toggling between device types.