CMS Development

Kevin-C
Especialista reconhecido(a) | Parceiro
Especialista reconhecido(a) | Parceiro

Linking to internal page with Repeater Option

resolver

Hey everyone!

 

I am currenly buildiong a tieriary navigation that has 3 options. I am accomplishing this by using a field group with the repeater option. The links are added from the staging content page. The issue is when the page is viewed/tested the URL(s) aren't inserted into the href attribute as specified. I have tried a few methods including a text field and a Page Field, with no success.

 

Code below (with text field):

{% for item in module.tunnel_group %}
      <article class="col-sm-12 col-md-4 tunnel-nav">
        <a href="{{ item.tunnel_link }}">
        <div class="tunnel-nav-header" style="background-image: url('{{ item.tunnel_image }}');">
          <div class="hero-caption hidden-md hidden-lg">
            {{ item.tunnel_caption }}
          </div>
        </div>
        
        <div class="tunnel-nav-body">
          <p class="hidden-sm">
            {{ item.tunnel_caption }}
          </p>
          <a href="{{ item.tunnel_link }}" class="btn btn-primary">
            {{ item.tunnel_cta_copy }} <i class="fa fa-caret-right"></i>
          </a>
        </div>
          </a>
      </article>
      {% endfor %}
Kevin Cornett - Sr. Solutions Architect @ BridgeRev
2 Solução aceitas
Jsum
Solução
Conselheiro(a) de destaque

Linking to internal page with Repeater Option

resolver

Hi  @Kevin-C,

 

If you pretty print the page token:

{{ page_field|pprint }}

You will see that the field allows you to choose a page in your cos, pages contain attributes, one of which is absolute_url. if you want to print the url of a page from the page field you can do this:

{{ item.tunnel_link.absolute_url }}

 

Need help? Hire Us Here

Exibir solução no post original

0 Avaliação positiva
Jsum
Solução
Conselheiro(a) de destaque

Linking to internal page with Repeater Option

resolver

The only place to set up a page field is in a custom module. 

 

you need to copy the snipped to the entire repeater field, paste it into your editor, copy the page field snippet from the repeater snippet, place that in your href, and add '.absolute_url' to the snippet. 

 

The fact that you are getting nothing from the field shows me that it is mispelled or otherwise not correctly referencing the field.

 

Need help? Hire Us Here

Exibir solução no post original

0 Avaliação positiva
4 Respostas 4
Jsum
Solução
Conselheiro(a) de destaque

Linking to internal page with Repeater Option

resolver

Hi  @Kevin-C,

 

If you pretty print the page token:

{{ page_field|pprint }}

You will see that the field allows you to choose a page in your cos, pages contain attributes, one of which is absolute_url. if you want to print the url of a page from the page field you can do this:

{{ item.tunnel_link.absolute_url }}

 

Need help? Hire Us Here

0 Avaliação positiva
Kevin-C
Especialista reconhecido(a) | Parceiro
Especialista reconhecido(a) | Parceiro

Linking to internal page with Repeater Option

resolver

Thanks Jsum,

 

Edit: Just noticed I didn't mention I was working within a module and not a HubL page. Might this be the issue?

 

I must not be implementing this correctly as I am still getting no value inserted into the href attribute. The PPrint prints no value as well.

 

Might there be more documentation on this outside of this page?

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
0 Avaliação positiva
Jsum
Solução
Conselheiro(a) de destaque

Linking to internal page with Repeater Option

resolver

The only place to set up a page field is in a custom module. 

 

you need to copy the snipped to the entire repeater field, paste it into your editor, copy the page field snippet from the repeater snippet, place that in your href, and add '.absolute_url' to the snippet. 

 

The fact that you are getting nothing from the field shows me that it is mispelled or otherwise not correctly referencing the field.

 

Need help? Hire Us Here

0 Avaliação positiva
Kevin-C
Especialista reconhecido(a) | Parceiro
Especialista reconhecido(a) | Parceiro

Linking to internal page with Repeater Option

resolver

Got it going! Very much appreciated.

Kevin Cornett - Sr. Solutions Architect @ BridgeRev
0 Avaliação positiva