If this is the case you can go to the Media section and locate your pdf media item. Then on the properties / info tab you will find the Link to media which is something like /media/1089/privacycookiepolicy.pdf.
Then you can copy the url and paste it into your partial view.
Make it dynamic
This requires some more setup. A possible solution could be to add a property to your Home root node called Privacy Policy which is of type Media Picker. Then in the Home node you can select the prefered policy media item ( your pdf file ).
Then in your partial view you can lookup this property recursively:
var privacypolicy = Model.Content.GetPropertyValue<IPublishedContent>("privacyPolicyAlias", true);
Create a hyperlink to a pdf document
Hi everyone, I need to create a hyperlink to a pdf document within a partial view.
I have uploaded the pdf to the Umbraco Media folder, what is the syntax to find the pdf and link it to the hyperlink?
Any help or pointers much appreciated.
Code so far
Thanks in advance. Tom
Hi Tom Bruce,
you some possibilities:
If this is the case you can go to the Media section and locate your pdf media item. Then on the properties / info tab you will find the Link to media which is something like
/media/1089/privacycookiepolicy.pdf
.Then you can copy the url and paste it into your partial view.
This requires some more setup. A possible solution could be to add a property to your Home root node called
Privacy Policy
which is of type Media Picker. Then in the Home node you can select the prefered policy media item ( your pdf file ).Then in your partial view you can lookup this property recursively:
https://our.umbraco.org/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Media-Picker2
Hope this helps.
/Michaël
I have managed to link to the pdf, see code below.
My next question is, is this the best way?
is working on a reply...