Unlink current asset in asset listing


(David Herrington) #1

Matrix Version:
5.4.2.0

Hi,

I have an asset listing which is effectively displaying table of contents (parent page with an asset listing displaying all the children).

I’d like to unlink the page I’m on from the asset listing. A great example is on GOV.UK. The page you are on is displayed but unlinked. This is the functionality I want to replicate.

Any help/advice on how to achieve this in Matrix would be awesome.


(David Herrington) #2

Just to add to this. I have played with conditional keywords with some success but it’s still not right.

I’ve written that if the %asset_url% matches the %asset_url% of the page, display only the %asset_name%.

This works, but it applies the condition to all the assets in the asset listing so now all my assets in my table of contents have become unlinked.

%begin_asset_url^eq:{asset_url}%

  • %asset_name%
  • %else_asset%
  • %asset_name%
  • %end_asset%

    (John gill) #3

    I think you’ll need to change the second use of asset_url in that conditional.

    %begin_asset_url^eq:{frontend_asset_url}%
    

    That way you’re comparing the URL of the asset currently under consideration by the listing, with the URL of the asset that corresponds with the URL of the request.


    (David Herrington) #4

    Thank you @JohnGill. That has given me the exact functionality I was looking for. I’ve tested it thoroughly and it’s perfect.