I found out something the hard way when working in SitecoreAI yesterday, and thought I'd share with the broader universe. This likely applies to Sitecore's "legacy" SXA as well, and whether you're using headless or not.
The impetus comes from SitecoreAI's recent decision to connect up default meta tags and Open Graph tags to the Page template. This is to support the recent Content SDK updates that help autogenerate meta tags. Apparently these templates have been in SXA for awhile, but it doesn't seem like many folks knew about them, judging by the commentary on Sitecore Slack. Most developers end up putting their own fields into a base page template for meta tags and Open Graph tags.
So, you have your own tags, and now Sitecore's thrown some of their own, which can create author confusion. I imagine a lot of developers will do what I wanted, find a way to drop Sitecore's tags and keep using your own, since you've already built for it. Looking at the Page template that's generated for you when you create a tenant in your instance, it inherits a Base Page template that's found at /sitecore/templates/Foundation/JSS Experience Accelerator/Multisite/Base Page. Dig into that template, and you'll see it inherits the two tagging templates, as well as another Page template. So you think you can just remove this Base Page and that'll handle it, right?
Wrong!
See, the Page template it inherits is a key one. If that template isn't inherited by your Page, you'll find that any datasource using tokens will break. For example, I had header tokens using query:$site/Data/Header and they all broke when I pulled that. I thought something I'd added after busted things, turns out it was an inheritance requirement.
So how do we fix it?
The key template you have to have in your inheritance line is /sitecore/templates/Foundation/Experience Accelerator/Multisite/Content/Page. That's the one that ensures tokens work. So for my purposes, I swapped out the Base Page template for this one, so I lose the Sitecore meta/OG tags and I keep my site working as it was before.
I hope this helps someone not break their site like I did for awhile!
Top comments (0)