External Links in navigation function to be opened in a new tab
Author: Anca
Publication Date: 2/21/2014 15:11
Hi,
The issue I am facing concerns creating the navigation of the site in latest FS version.
Inside the main navigation, there are some direct links to other sites. For this purpose on the Page Reference I set the "External URL", like in the attached image.
These links to other sites should open in a new window, but how can I interrogate inside the navigation function (template level) whether it is an internal page or redirect page? Is there a way to get the value of the "External URL" property from the #nav.ref object, or in some other way?
Thank you!
-
Author: pavone - 2/27/2014 9:01
Hey,
you can use #nav.ref.getPageLangSpec(#global.language).useExternalUrl() to check if the site uses an external url.
Use it to add the attribute target to your a-tags if its value is true.
<a href="$CMS_REF(#nav.ref)$" $CMS_IF(#nav.ref.getPageLangSpec(#global.language).useExternalUrl())$target="_blank"$CMS_END_IF$>$CMS_VALUE(#nav.label)$</a>Best regards
Tim
0 -
Author: Anca - 2/28/2014 16:12
Thank you, Tim!
0
Please sign in to leave a comment.
Comments
2 comments