Asset Previous and Next keywords

(Nick Papadatos) #1

Matrix Version:

Hey Squiz folk

Just wondering whether anyone has used the “%asset_sibling_prev_type_1%” and “%asset_sibling_next_type_1%” keywords but with conditions?

What I’m trying to do is rather than return the next sibling based on asset map > return the next sibling based on most recent published. I’m guessing Using SSJS?

Please note each page where I want this navigation to happen does have a paint layout applied.


(Bart Banda) #2

You can’t really use those keywords, unless you automatically sort your asset tree to the published date on assets? You could enforce that using the Sort Asset Children trigger

Alternatively you’d need to source in an asset listing that lists the parent’s children, sorts it by published date, finds the current asset in the list to then figure out the prev and next links, all using SSJS, but could cause a slow page load if the asset listing has to load lots of assets to figure this out. Could also load this via ajax if needed.

(Aleks Bochniak) #3

Hello NickyP,

I’ve used the as_asset keyword modifier with these keywords…


sorry I can’t figure out how to paste code into this forum without it fucking up

(Aleks Bochniak) #4

(Aleks Bochniak) #5

(Aleks Bochniak) #6

As used on this page

(Nick Papadatos) #7

Thanks Aleks,
That’s how I normally use that keyword but good to know how to use the else statement to get back to the parent, clever!