How to link to URL and "entry::" strings from a link field the same way? #6274
-
This is probably a dumb question but I ask it anyway ... :-) I have a link field
If I link to a URL it is of course the pure string value of the entered URL. I would have expected that I can treat both strings in a view the same way, like:
But I had to differentiate both kinds of strings, checking for the substring "entry" and removing it to pluck the id to use that in a {{ link }} tag, That feels absolutely over-complicated but I probably have, as we say in German, "a board in front of my head" ...
I'd be happy to get any hints for a better and easier solution. :-) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey @jensolafkoch, Maybe I'm getting something wrong here but usually <div>
<a href="{{ link_url }}" class="bunch-of-tw-classes">
{{ link_text }}
</a>
</div> You could also give Could you please share what your Blueprint looks like? Hope that helps :) |
Beta Was this translation helpful? Give feedback.
-
Hi Joshua, thanks! Yes, just using the field value inside the href was the first thing I tried and what I expected to work. What I did NOT try was the variant you suggested: I'm not sure why though. :-) |
Beta Was this translation helpful? Give feedback.
Hey @jensolafkoch,
Maybe I'm getting something wrong here but usually
<a href="{{ link_to_imprint }}"> ... </a>
should work whether the Link field links to an entry by id or to a direct URL. I use it quite a lot with something like a{{ link_url }}
and just tested it by linking to an entry by id instead of a direct URL.You could also give
{{ link_to_imprint:url }}
or{{ link_to_imprint | url }}
a try.Could you please share what your Blueprint looks like?
Hope that helps :)