I'm using views to create a custom block of shortcut icons and need the images to link to the corresponding content. Using Rewrite Results I can overwrite the output of the view and have an anchor tag wrap around the image, however when I inspecting the output on the site, the href is blank making the images useless as links. Everything else renders though.

The view uses two fields, all from the same content type (shortcut). It consists of an image and a URL field. The image field is called first and then hidden to get the tokens, and the URL field holds the actual rewrite text. All of the these Twig tokens are listed as available within the Replacement Patterns dialog box.

<a href="{{ field_url__uri }}">
{{ field_image }}
{{ field_url }}

Does Twig Debug affect the output for content like this? Is there another format I should be using? I tried calling and hiding via CSS the {{field_url}} first, before the rest of the rewrite text to see if it had to do with render inheritance but it still didn't change the blank href output.

Any insight on why the Twig token won't render inside HTML would be GREATLY appreciated. Thank you.

1 Answer 1


Problem solved. There were two issue at play; first off when I was messing with the Twig templates to trying and format the view the hard way, I inserted an extra <a href=""> in one of the templates and failed to remove it. My template was wrapping the empty tag around the properly generated content making it useless.

The second problem was that for some odd reason, the block was calling/using the same custom theme hook twice. I haven't figured out what was causing this error, but deleting the bock and forcing the new one to revert to a more general template hook solved the rendering issue.

However Twig debug still shows that there are two custom theme hooks of the same name available for use. No clue what is causing this behavior.

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.