Unable to retrieve the ChannelInfo in an Spa++ site

Hi,

Im trying to retrieve the ChannelInfo in a doBeforeRender method for an Spa++ site in order to output the channel settings, but Im unable to retrieve this via the normal route:

Mount mount = rxc.getResolvedMount().getMount();
    WebsiteInfo info = mount.getChannelInfo();

Im able to retrieve the channelInfo just fine if Im on a normal website (remove the SPA pipeline config and the pagemodelapi from the mount config)

Any idea how to correctly retrieve the channelInfo in the SPA++ site?

Kind regards,
Matthijs

Oh I found it.

I can just retrieve the parent which is the normal mount and not the resourceApi mount.

I’m not exactly an expert on this new feature, so grain of salt. First, make sure you have configured it correctly [1]. Second, I believe the SPA mount is a child of the real mount, so try the parent.

[1] https://www.onehippo.org/library/concepts/spa-plus/configuration.html

edit: and of course you found it while I was typing my reply.

Hey Mathijs,

can you true

Mount useMount = rxc.getResolvedMount().getMount();
if (!useMount.isExplicit()) {
useMount = useMount.getParent();
}

The reason is that your request mount might be the auto-appended
‘pagemodelapi’ mount. I am not fully sure, but this is from the top of
my head.

Let me know

Regards Ard

Hi Ard,

You are right its the appended pagemodelapi mount. I didnt notice it before. The getParent() works. The check is a nice addition.