BuzzingPixel

Ansel for Craft

Ansel for EE

Treasury

Construct

Category Construct

Dashboard (open an issue here)

All Issues

My Issues

News Contact
Log in

Logged in as

Licenses Purchases Profile Change Password Billing Portal Admin
Log Out
Software
Ansel for Craft Ansel for EE Treasury Construct Category Construct
Support
Dashboard (open an issue here) All Issues My Issues
News Contact
Log in
Logged in as:
Licenses Purchases Profile Change Password Billing Portal Log Out
Dashboard All Issues My Issues
Support Dashboard
  1. Home
  2. Home
  3. Support Dashboard
  4. View Issue

Can't get External Link to work

#201 opened by Imp Designs

Subscribe

Details

Complete

Public Issue

Visibility: Public
5 replies
Last reply by TJ Draper
Created 7/30/2021 12:45 PM
Updated 8/3/2021 8:45 AM
Construct 2.1.1
CMS Version: 5.3.1
PHP Version: 7.2.30
MySQL Version: 10.4.11-MariaDB

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!

Use Markdown for formatting

Details

Complete

Public Issue

Visibility: Public
5 replies
Last reply by TJ Draper
Created 7/30/2021 12:45 PM
Updated 8/3/2021 8:45 AM
Construct 2.1.1
CMS Version: 5.3.1
PHP Version: 7.2.30
MySQL Version: 10.4.11-MariaDB
Cookie Policy
Privacy Policy
Terms of Service

© 2023 BuzzingPixel, LLC. All rights reserved.