Experience Page Inheritance

Hello, we are trying to achieve a specific use case. We have started to use Experience Pages within all of our projects. We would like to create a set of standard pages that every site can get for free. But we also want our content creators to be able to customize their own versions of those pages. Is this achievable? How can we do this?

Hello, inheriting or sharing xpages between channels is not something that can be done OOTB. The easiest solution is to copy them across channels and make modifications as needed. This also means copying “common” pages into each channel, with the downside of updates needing to be done to each and every copied page. It can get messy and hard to keep track of.

One solution to shared/inherited xpages is to implement a sitemapitemhandler that is invoked on the sitemapitem that matches your xpages. The handler can look within your channels’ folder structure for an xpage that can be returned in absence of an xpage in the current channel, and return a new relativeContentPath. You typically need a wrapper class around the ResolvedSiteMapItem. Something like this:

  public ResolvedSiteMapItem process(ResolvedSiteMapItem resolvedSiteMapItem, HttpServletRequest request, HttpServletResponse response)
      throws HstSiteMapItemHandlerException {
    // find a page in this channel or a common (inherited) channel
    String resolvedPath = //code to find a page in your channel(s)
    return new XpageSiteMapItemImpl(resolvedSiteMapItem, "../" + resolvedPath);

This has some side-effects that are a bit complicated to discuss here. It really depends on your use-case, site structure, SPA vs Freemarker etc.

Very interesting! I was trying to utilize the Link Processor using HstLinkProcessorTemplate.

This approach seems a little more straight forward. Is there an example of this implementation that I can use to reference?

Hello, I put together a sample project GitHub - davidbrrr/xpage-inheritance

1 Like

Thank you @david.bailey . Your guidance was super helpful. You gave me enough to run down the solution! We have successfully created an inheritance strategy for our users/developers!

1 Like