Prevent Asset Listing from Using URL


(Nic Hubbard) #1

We have two parts of our site that share the same News Item assets. Both parts of the site need to display the News Item under their own URL.

 

So if I visited site 1 and viewed the article, the URL needs to be:

www.puc.edu/news/article1

 

If I visited site 2 and viewed the article, the URL needs to be:

www.puc.edu/now/article1

 

However, our homepage pulls these news articles for display as well, and the root node is set to site 1. But, when I link one of those articles into site 2, the URL on the homepage changes to site 2, and users are directed to the wrong site.

 

I realize Matrix is likely choosing the shortest URL here, but in this case I very much need to restrict which URL is used. 

 

What options do we have here?


(Bart Banda) #2

Could you use a keyword modifier on the %asset_url% keyword in the asset listing that lists the news items on the homepage?

 

%asset_url^replace:/now/:/news/%


(Nic Hubbard) #3

Could you use a keyword modifier on the %asset_url% keyword in the asset listing that lists the news items on the homepage?

 

%asset_url^replace:/now/:/news/%

 

No, that doesn't really sound like a flexible solution, and wouldn't work for us.


(Bart Banda) #4

I'm not sure what the rest of your setup is like that makes it not a good solution for you, but another alternative might be to use the %asset_urls% keyword and grab the URL from a certain position of that array if you can expect it to be the same each time perhaps?

 

Or perhaps set it as a default metadata text field value and use that instead when printing the URL? 


(Nic Hubbard) #5

I'm not sure what the rest of your setup is like that makes it not a good solution for you, but another alternative might be to use the %asset_urls% keyword and grab the URL from a certain position of that array if you can expect it to be the same each time perhaps?

 

Or perhaps set it as a default metadata text field value and use that instead when printing the URL? 

 

I wish I could use the %asset_urls% keyword, but we are on 5.2.3.0.


(Nic Hubbard) #6

I got it working. My solution was to just arbitrarily make the URL of Site 2 longer, so that Matrix would not use that one on the homepage.