Matrix Version: 5.3.4.0
Hi guys, not sure if this has been covered elsewhere.
The scenario:
For my pages since we have some busy editors and they don’t always have time to enhance their pages - I opted to make a page’s <meta name="description">
a metadata field which an editor can overwrite (if they have time/feel it’s necessary), but the default is a keyword targetting the asset contents so there’s at least some sort of relevant description in Google:
%globals_asset_contents^striphtml^trim^replace:\s+: ^maxchars:153^append: | (site name)%
Basically the idea being since they’re mostly online editors, they will be creating a relevant opening paragraph which would make for some sort of relevant Google Description. while skipping any default descriptions that might pull in irrelevant words (these are sort of not-quite “long tail” pages generally so need some tailoring Google-wise).
The Challenge:
In another area of the site, we’re listing out “card” style previews of these pages, with a thumbnail, title, link to the page etc… But also we are going to have a short intro text about the page that it’s linking to.
So what better intro description than the same one that you’d use for a Google description!
That was the plan anyway - pull that default text, if they wanted to make it bespoke, they can manually change this via metadata.
The problem:
Can’t use javascript (due to some restriction by the organisation)
I can get that metadata field to pull all good, however it pulls the text, then evaluates, and we end up with the Google description/evaluated keywords of the “showcase” page, rather than of the page it is showcasing.
What I’d like to know:
When building an Asset List is there some way of evaluating whether a metadata field contains keywords?
I was intending to use the logic “if the description metadata field of the asset it is currently processing contains keywords (i.e. default value), pull specifically %asset_id% contents and sanitize them (rather than the general %global_metadata_description% default which evaluates as the showcase page’s description) - if it doesn’t contain keywords however, we can assume this is some custom description written in and pull that value”.
I hope that makes sense. Happy to clarify further - cheers.
(p.s. bit of an ancillary functionality, not really too important - but figured if there is a technique it would definitely be handy down the line too while solving this problem)