What is trigger action "Add URL" - and how does it work?


(Kequi) #1

I want to add a redirect to any type of asset using a trigger.

 

There are 3 trigger actions that look like they may help.

 

"Add Remap"

But this adds a specific short url using the ID number and is not customisable.

 

"Add webpath" This creates another url using the same hierarchy.

I don't want another url - just a new redirect - and I also don't want it in the same hierarchy.

 

"Add URL" is the only other option - but I can't get this to do anything!

 

https://matrix-manuals.squiz.net/triggers/chapters/trigger-actions#Add-URL

 

I've tried a few different asset types and a few different url formats in the trigger - but I always get the same error message:

 

(/core/assets/system/triggers/trigger_action_types/trigger_action_add_url/trigger_action_add_url.inc:90) - Unable to add URL for a [asset_type_named here] asset

 

So I'm wondering if this trigger actually does something different? And if so what it actually does.

 

Has anyone used it?

 

Thanks

 

Karl


(Marcus Fong) #2

I think what you’re seeing with the Add URL trigger is due to the way URLs work in Matrix. In Matrix, you can only assign a URL to a Site asset, or to an asset which is a subtype of Site (e.g. the Design Folder asset type is a descendant of the Site asset type).

Other types of assets don’t control their own URLs - their URLs are derived from the site URL, plus all the webpaths of the assets between the site and the asset (the asset’s “lineage”), plus the asset’s own webpath, e.g.


http:// site.url / level1assetwebpath / level2assetwebpath / level3assetwebpath / myassetwebpath


So you can’t add a URL directly to a non-site asset, because the asset’s URLs are automatically generated based on where it’s linked in the asset tree.


I’m not sure I really understand what you mean when you say you “want to add a redirect to any type of asset” - are you trying to create a new redirect on a different URL, which redirects to the original asset?


(Kequi) #3

Thank you for the explanation - makes sense now.

 

I think I'm probably talking more about a "remap" than a redirect

 

So the process in Matrix would be either:

 

Go to webpaths screen of an asset and add a new remap

Go to remap manager and add a new remap there

 

So for example for this asset:

www.mysite.com/news/january/2016/myarticletitlehere

 

I could add a remap:

www.mysite.com/myshorturl

 

This would appear on the webpaths screen of the asset as a remap.

 

Anyone going to www.mysite.com/myshorturl would be redirected to www.mysite.com/news/january/2016/myarticletitlehere

 

So my question is:

 

Is there a way to set up one of these 'remaps' using a trigger?

If not - maybe via API?

 

Thanks for your help.

 

Karl


#4

This is something I've wanted to achieve in the past so when a similar question was asked a month or so ago it stuck in my mind - I'm afraid it might not be the answer you were hoping for though...  http://forums.squizsuite.net/index.php?showtopic=13375  

Yea I would go with remaps as well. But don't think it's possible to create custom ones like that automatically, the trigger action and js api methods only allow you to create them off the current path the asset already has, so www.site.com/path/path1 to www.site.com/path/path2
 
Would be nice to add that as a new feature though actually.


(Kequi) #5

Thanks Jason,

 

That answers my question.

 

Let's hope it's part of a release in future - I think it would be very useful.

 

Karl


(Anthony Ponomarenko) #6

Hi Karl,

 

You can add a feature request to Squizmap, as a client you should have access. If not you can ask your Squiz Account Manager to set it up for you.