BoldMinded acquires Ansel, support ending for all add-ons. BoldMinded acquires Ansel, support ending for all add-ons. Read More →
Support has been discontinued. Issues remain available as an archive. Support has been discontinued. Issues remain available as an archive.
Can't get External Link to work
#201 opened by Imp Designs
Description
I see in the docs that "If you need the menu item of your Node to point to an external link, you can use this field (you will need to account for this with your template tags)" but I can't seem to get the 'accounting for this in the template tags' bit worked out.
From a previous ticket, I saw you reference the {construct:node_link}
and the {construct:node_external_link}
variables with this note:
{construct:node_link}
will be the node_full_route unless the External Link field has content, in which case it will be the external link.
...but that's not what I'm seeing. When I use {construct:node_link}
and there's no external link field content, I just get the url segment (https://about for example) without the domain. For nodes WITH content in the external link field, I do get the external link but with the domain appended (https://thesite.com/https://external-link.com).
I'm sure I'm doing something stupid...
Replies
- TJ Draper
Replied 8/2/2021 7:15 PM, Edited 8/3/2021 8:45 AM
Can you post all the relevant template code please? Something doesn't seem right there.
- Imp Designs
Replied 8/3/2021 8:20 AM, Edited 8/3/2021 8:45 AM
`
{exp:construct:nodes tree_id="1" max_depth="2"} {if construct:level_count == 1} <ul> {/if} <li{if segment_1 !="" AND "{construct:node_slug}" == segment_1} class="current"{/if}{if segment_1 =="" AND "{construct:node_entry_id}"=="1"} class="current"{/if}> <a href="/{construct:node_link}">{construct:node_name}</a> {construct:children} </li> {if construct:level_count == construct:level_total_results} </ul> {/if} {/exp:construct:nodes}
`
- Imp Designs
Replied 8/3/2021 8:21 AM, Edited 8/3/2021 8:45 AM
Hmm well that didn't seem to work properly...
{exp:construct:nodes tree_id="1" max_depth="2"} {if construct:level_count == 1} <ul> {/if} <li{if segment_1 !="" AND "{construct:node_slug}" == segment_1} class="current"{/if}{if segment_1 =="" AND "{construct:node_entry_id}"=="1"} class="current"{/if}> <a href="/{construct:node_link}">{construct:node_name}</a> {construct:children} </li> {if construct:level_count == construct:level_total_results} </ul> {/if} {/exp:construct:nodes}
- Imp Designs
Replied 8/3/2021 8:24 AM, Edited 8/3/2021 8:45 AM
...AAAANNNNNDD just like that, I see what I did wrong.
Should be:
{exp:construct:nodes tree_id="1" max_depth="2"} {if construct:level_count == 1} <ul> {/if} <li{if segment_1 !="" AND "{construct:node_slug}" == segment_1} class="current"{/if}{if segment_1 =="" AND "{construct:node_entry_id}"=="1"} class="current"{/if}> <a href="{construct:node_link}">{construct:node_name}</a> {construct:children} </li> {if construct:level_count == construct:level_total_results} </ul> {/if} {/exp:construct:nodes}
without the slash in the href.
I just KNEW it was something stupid.
- TJ Draper
Replied 8/3/2021 8:45 AM
Ahh, there it is! Glad we were able to resolve it!