I'm using Sitecore 9 and SXA 1.7.

I have a few PDF files that I have uploaded into media library/files/myfolder, and an "instructions" template whose fields are title (type: single line text), Date (type: date), description (type: single line text), and file (type: file).

I have created a few items of type "instructions", and in each of their "file" fields there is one PDF file from the media library/files/myfolder path.

My question is: I created a search results component that searched for these "instructions" items, and I need it to view a download link for these PDF files. Specifically, to view a link that the user can click on, which opens the related PDF file in a new tab or so.

So far I've used the rendering variant to display each item's Name and Date, but I do not know how to show a download link for the PDF file. I have tried using reference->file in the rendering variant, but it shows nothing on the results page.

1 Answer 1


Did you create variant items under reference field? You need to display something in order to render a link.

It works fine on my machine. Here are screenshots with the setup:

Template enter image description here

Content enter image description here

Media Library (Title field is not filled automatically) enter image description here

Variant (pass through: File) enter image description here

Results in EE enter image description here

  • Thank you so much, that worked! I was struggling with showing the link and didn't think of just writing something and linking the variant to the Title field! I also searched a bit and found out how to stop the force download when I click on the PDF link (by changing the forceDownload attribute in Sitecore.config for pdf extension to false), now it opens the file in the same tab .. is there a way to open it in another tab onclick, which is my requirement? Jun 28, 2018 at 9:21
  • I found the answer : I just set the "link attributes" field in the rendering variant to "href" --> "_blank" and now when i click on the link it opens in a new tab .. thank you! Jun 28, 2018 at 10:42

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.