Link assets - original asset url


(Gjboyd7) #1

Hi

 

Is it possible to create a linking asset, then use a keyword in an asset listing to point to the original asset url?

 

By linking asset, this one I mean:  https://manuals.matrix.squizsuite.net/concepts/chapters/linking-an-asset

 

Currently just using a relative path and some keyword modifiers to get the original url of the asset.

 

<a href="/ulster-life/events/%asset_name^preg_replace:64223^lowercase%">%asset_name%</a>

 

This could break eventually if urls are slightly different due to assets with duplicate names.

 

Thanks,

Gavin


(Nic Hubbard) #2

So, you are saying you linked some assets, or you are using the Link Asset Type?

 

If you just mean regular linking, there isn't an "original URL" anymore, after you have linked it in multiple places, so there wouldn't be any way to get that specific URL.


(Gjboyd7) #3

Thanks Nic, I do mean regular linking.  The use case was we wanted handpicked news and events items on our homepage.  The best option was to link those assets under the homepage, and then use asset listing to display, linking seems like an easy way to keep all the assets info in sync.  We wanted to guide the user to the news and events area of the website when an item is clicked on the homepage,

 

for example /ulster-life/events/title-of-event

and not /home/title-of-event

 

Thought it may be possible to get the linked asset url, or "Original Url" through a keyword, similar to how all the other metadata etc can be used with a keyword...  

 

Currently just using this structure to build the url in the link up:

 

<a href="/ulster-life/events/%asset_name^preg_replace:64223^lowercase%">%asset_name%</a>

 

Another question, if you trash or set a linked asset to under construction, does this effect the original asset?


(Nic Hubbard) #4

Another question, if you trash or set a linked asset to under construction, does this effect the original asset?

 

If you trash an asset that is linked in multiple places, it only deletes that link.

 

However, if you change the status it will be affected everywhere, since it IS the same asset in all locations.


(Anewport) #5

You could create a folder under the home page and link the assets there and remove the web path from the folder. Then using %asset_url% will always take the user to to right location.


(Peter McLeod) #6

Hi

 

Alternatively, if you are wanting a 'handpicked' selection and are manually selecting them, you could just add a link value to the actual assets (in your events section) you want to list on the homepage, and then set the Link Value, Link Value Filtering Logic, Enable Link Value Filtering in your asset listing to match.

 

By doing this you avoid having to create linked assets in different parts of the site, that (in terms of the overall information architecture of the site) don't necessarily belong there.  

 

Or other options could be to relate them to the homepage via metadata and list these, or pass in a array of the specific asset ids to the listing.

 

Think the folder option above would be the best option if you want them linked under the homepage, but you could also try using the web path keyword rather than the asset url in the listing, and get the parent path dynamically:

 

1234 = events parent asset under which events are added

href="%globals_asset_url:1234%/%asset_web_path%"

It would get more complicated if you have multiple parents though.

 

Thanks

Peter