I'm hoping someone can help me out here.
I've got a Standard Page asset called 'RHS' which is going to be nested into a whole bunch of other Standard Page assets (for example 'Scholarships', 'Exams' etc).
The RHS asset will reference a JS File called appConfig.js, which defines some variables.
Within appConfig.js I would like to reference metadata fields from my Scholarships/Exams pages
At the moment, the keyword replacement is giving me the metadata field from appConfig.js
For context, the contents of appConfig.js must be a javascript file, and cannot be inline within RHS. If this were not the case, I'd be laughing, as the above code would work.
If you are using a JS File asset this won't work. However, I have done something like this many times, and I used a Standard Page so that keyword replacements would work. Then I applied a Design to it that has the following:
The best practice for this is to actually write the global keyword into a data attribute on the page somewhere on the front end, and then grab it with JS.
Just curious Nic, how does that approach go with browser caching? Is Matrix smart enough to return a 304-Not Modified header? I'm curious as that approach would be really handy in quite a few cases.
Just curious Nic, how does that approach go with browser caching? Is Matrix smart enough to return a 304-Not Modified header? I'm curious as that approach would be really handy in quite a few cases.
No, I don't think it does. Just tested it on an old implementation of this. I used it mostly for internal sites.