Asset listing: Show status and type 1 or 2


(Bdebroglio) #1

Matrix Version: 5.4.0.1

I’m using an asset listing to generate a sitemap of sorts for internal use. We’re auditing all pages in a section.

I’d like to be able to output the status (live, under construction, etc) as well as the linking (type 1 or 2).

I can’t find a keyword for these. Is there one?

Thanks.


(Bart Banda) #2

For status, use: %asset_status_description%
For link type, try: %asset_linking_info_current^index:link_type%


(Bdebroglio) #3

Thanks Bart.

For linking, I can get back an array, but our assets have a lot of cruft. I don’t think I can assume position 1 is the current asset.

[{“linkid”:“234020”,“link_type”:“8”,“link_value”:"",“lineage”:[“69”,“71”,“131954”,“141849”,“151205”,“127205”,“127206”,“127209”]},{“linkid”:“218911”,“link_type”:“8”,“link_value”:“thumbnail”,“lineage”:[“69”,“71”,“128438”]},{“linkid”:“218917”,“link_type”:“8”,“link_value”:“redirect_asset”,“lineage”:[“69”,“71”,“128438”]},{“linkid”:“159916”,“link_type”:“1”,“link_value”:"",“lineage”:[“69”,“71”,“64493”,“64669”,“64709”]},{“linkid”:“272475”,“link_type”:“8”,“link_value”:"",“lineage”:[“69”,“71”,“64493”,“64669”,“150062”,“155110”,“150074”,“150075”,“154991”]},{“linkid”:“415772”,“link_type”:“8”,“link_value”:"",“lineage”:[“69”,“71”,“64553”,“114205”,“197166”,“122940”,“226916”,“226977”,“226978”,“226981”]}]


(Bart Banda) #4

%asset_linking_info_current% should only give you the most relative link based on the current context, not all of the notice links as well, that’s weird, as that big array should only print if you use %asset_linking_info%


(Bdebroglio) #5

You’re right, sorry for the confusion. I did switch to %asset_linking_info% because I got not output from %asset_linking_info_current%. Maybe the context wasn’t available to Matrix although I’m not sure what current context actually means!


(Bart Banda) #6

It just means based on the current URL you are viewing the keywords from.

So if an asset with asset ID #1234 is linked into multiple places and has multiple URLs, for example /section-1/about and /section-2/about, and you if you have a page where you print that keyword on that has a url of /section-2/some-other-page, for example this keyword: %globals_asset_linking_info_current:1234%, it would give you the linking info for the URL matching closest to the page it’s printed on, which in this case would be /section-2/about.

But I just double checked and that keyword didn’t come out until 5.4.1.0, which is why it doesn’t print anything for you :frowning:

A workaround might be to feed the json array into a SSJS function and loop through the links and find the one that has link_type as either “1” or “2” ?