2

I have the following code and I'm looking for the best way to link to another entry page.

<a href="#" class="btn-quote">request a quote</a>

I tried something like this with no luck:

<a href="{{ entry.getLink('Get a Quote') }}" class="btn-quote">request a quote</a>

Here's the entry: http://grab.by/Ax6s

Thanks in advance for the help.

2 Answers 2

4

First, you'll want to retrieve that entry specifically...

{% set entry = craft.entries.slug('get-a-quote').first %}

Once you've got the entry that you want to target, you can easily link to it like this:

<a href="{{ entry.url }}" class="btn-quote">request a quote</a>
2
  • For some reason when I use the code above, it's not outputting the entry field below. I created another discussion regarding the issue. Here's a link. Maybe you can help me figure it out. Thanks!
    – frshjb373
    Sep 23, 2014 at 20:22
  • Just left an answer on that thread... Looks like you'll need a different variable name than "entry" (since "entry" is already taken).
    – Lindsey D
    Sep 23, 2014 at 20:46
2

As a shorthand, you could also use Reference Tags along with the parseRefs filter, like this:

<a href="{{ '{entry:123:url}' | parseRefs }}">Request a Quote</a>

(Similar question/answer posted here.)

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.