Accessing metadata specific to site 'home' page


(Chris Mackay) #1

Matrix Version:6.24

Hello,

I have a metadata schema applied to our /home page which includes a related asset field.

This related asset points to a REST resource, which returns its contents. This is then then manipulated as required using SSJS. Works perfectly fine on /home or any of our other pages.
NB: The SSJS is being referenced on the page like so: %globals_asset_contents_raw:123456%

However, when I preview the change at URL entry point, the metadata does not return.

Example:
yourpage.foo/home (works)
yourpage.foo (doesnt)

I have tried using both globals and frontend to string together the keywords - both will return on any of the pages applied, except for when you visit the entry point / top level landing page (aka home).

%globals_asset_metadata_foo-Bar^as_asset:asset_contents_raw^empty:[]%
%frontend_asset_metadata_foo-Bar^as_asset:asset_contents_raw^empty:[]%

For testing purposes, I added a related field to one of our site schemas, and used %globals_site_metadata_foo-Bar…% and worked fine - verifying keywords, modifiers, etc are correct.

The problem now is that whilst it works adding the schema to the site level, not all of our users have access to schemas in the globe.

Is there a way to get around this without having to rely on schema applied to the globe?

Thank you.


(Nick Papadatos) #2

If I’m understanding you correctly - have you applied the schema to both the globe and /home?

If not give that a try and don’t cascade the schema.


(Chris Mackay) #3

Sorry, to clarify.
If I apply the schema to the page only (home) then when I visit /home I can see the output.

This /home page is set as the default “home” page which is what people see when they access the site (no /home in the url).

When people access the page this way, they will not see the same as if they accessed the “home” page via url/home.

The only way I can get the same showing for both, is by adding the schema to the globe (these global schemas are not accessible to all our editors).

This problem appears to be unique to only our home page.


(Chris Mackay) #4

Schema applied to home page. Can see the output for this if I visit the URL directly (/home)

If I access the home page as the index page, I do not see the output.

When I add the schema to the globe (no cascade, as we dont want this available to all pages), I can see the output on the index (“home”) page. However not all of our editors are able to access schemas assigned to the globe.


(Chris Mackay) #5

Removed globals and worked if you have the JS also on the page. If youre pulling the JS through via %globals_asset_contents_raw:12345% then it wont.

Think need to revisit this approach.