Search the FirstSpirit Knowledge Base
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!
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
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
Thank you, Tim!