An experience fragment is a part of a page, made of components, that you write once and show in many places: the header and footer of a site, a promotion that appears on twenty pages, a sign-up box.
Change the fragment and publish it, and every page that shows it changes.
| Experience fragment | Content fragment | |
|---|---|---|
| What it is | Components laid out the way they will look | Fields of content, with no look of their own |
| You edit it | In the page editor | In a form |
| Use it for | A header, a footer, a banner, a promotion | A product, an article, a person |
| Shown by | The Experience Fragment component | Components and applications that decide how it looks |
The console is the Pages console you already know. Everything works the same: properties, versions, the timeline, references, publishing.
A fragment can have several variants: the same promotion as a wide banner for pages and as a narrow box for a sidebar. Each variant is edited on its own. A page shows the variant you choose.
A new fragment starts with one variant, called master. Create more below the fragment, the way you create a page below a page.
Drag the Experience Fragment component onto the page and choose the variant to show.
The header and footer of a site are usually experience fragments placed in the template, so every page gets them without anyone adding them. To change the header of the whole site, edit the header fragment and publish it.
When fragments are kept by language, in the same shape as the site, a page shows the fragment of its own language by itself: the English page shows the English header, the French page the French one, though both use the same template.
You built something on a page and now want it elsewhere too. In the page editor, select the components, then choose Convert to experience fragment variant in the toolbar. They are moved into a new fragment, or added as a variant to an existing one, and the page shows the fragment in their place.
A fragment is published like a page. When you publish a page that shows a fragment not yet on the live site, the fragment is offered to be published with it.
When a fragment is published, the Live cache refreshes exactly the pages that show it. See Publishing.
Select the fragment and open the inspector's References tab: it lists every page that shows it. A change reaches all of them. A deleted fragment leaves an empty place on each.