How to use snippets in SXA project
Snippets in SXA
Data Source Configuration
A unique feature of the snippet, is that the usage can take a couple of paths depending on intent of usage. Through the Content Editor there are three setting options for a snippet item regarding how to handle the data sources of applied to any renderings placed within the snippet.
Do not copy – The default setting. The snippet uses a globally assigned data source. The source of the content is in the site data folder. When you reuse this snippet on different pages and then change it, all instances of the snippet on all pages are updated automatically.
Copy global data source to local context upon selection – A copy of the snippet, its configuration, and content are added to the page. Changes made to the snippet are only applied for that specific page.
Ask user whether the copy of global data source to local context is required upon selection – This option allows the content editor to choose how to reuse the snippet and displays the following message in the Experience Editor:

Design and Building a Snippet
- Expand the content tree to your Home page.
- Right click and select the option for Experience Editor.
- Once in Experience Editor, from the Toolbox expand ‘Composites’ section
- Click on Snippet
- Drag Snippet into the Header placeholder and drop it.

10. After creating the ‘Select the Associated Content’ modal will refresh with our new item. Select Global Header and click OK
11. Datasource can be created in two places. The first one (Snippets) refers to the shared location provided by SXA. the second option Data will create data source under the page itself. The second option can be used if the snippet is limited to a single page.
Comments
Post a Comment