Custom Menu Link to External Site

Brendon McCarthy asked on September 11, 2014 18:46

I have a custom menu (Bootstrap) that I've setup transformations for. All works great, except when you want a page to redirect elsewhere. This is the current link:

<a href="{% Transformation.GetDocumentUrl() #%}" title="{%DocumentName%}">{%DocumentName%}</a>

However, if you change the Navigation > Menu Actions property to "URL Redirect" the above does not take this into account. What Transformation method should I be using instead of GetDocumentUrl()?

Correct Answer

Jan Hermann answered on September 15, 2014 10:39

Hello,

I would use something like this:

<a href="{% DocumentMenuRedirectUrl.ToString()==""?Transformation.GetDocumentUrl():DocumentMenuRedirectUrl #%}" title="{%DocumentName%}">{%DocumentName%}</a>

Best regards,
Jan Hermann

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brendon McCarthy answered on September 15, 2014 19:12

Thanks @Jan. This works great...can you tell me where in the documentation (docs.kentico.com) this key is documented: "DocumentMenuRedirectUrl"? I was not able to find it via a search and I looked here where I assumed it would be document, but is not: https://docs.kentico.com/display/K81/Reference+-+Transformation+methods#Reference-Transformationmethods-URLsandpagelinks.

0 votesVote for this answer Mark as a Correct answer

Jan Hermann answered on September 16, 2014 14:28

This is standard macro property you can find in the macro console:

System -> Macros -> Console -> CurrentDocument

Best regards,
Jan Hermann

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.