0

Sitecore verison - 9.0.2 Glass version - 5.0.6.0

We are trying to use Glass @RenderLink to render a pdf media item, it's generating anchor tag with below path

/sitecore/media-library/site-content/xxx/your-account/xxx/xxx/pdfFileName

Which is going to page not found as expected. I believe it should render as below:

/~/media/site-content/xxx/your-account/xxx/xxx/pdfFileName.ashx

Looks like Glass issue, am I right?

Is there an alternative way to render pdf link, our cshtml is a Glass View rendering.

Code Example view.cshtml:

@inherits Glass.Mapper.Sc.Web.Mvc.GlassView<xxx.Data.GlassModel.sitecore.templates.xx.Journeys.Components.Ixxx>

@Editable(x=>x.Heading)
@RenderLink(x=>x.LinkName)
@Editable(x=>x.Description)

Glass model is generated by TDS and the Link field in the model as below:

[SitecoreField(Ixxxx.LinkNameFieldName)]
Link LinkName{get; set;}
  • Can you add a code example of how you are rendering the link? And how your model is setup? – Richard Seal Oct 23 '18 at 13:35
  • What type of field is your LinkName field? – Dan Sinclair Oct 24 '18 at 11:10
  • @DanSinclair GeneralLink – Dheeraj Palagiri Oct 24 '18 at 15:19
  • @DheerajPalagiri how did you select your media item? Did you use a Media Link or an Internal Link? I've sometimes found one to be problematic when creating links, where the other works fine (can't remember which is which off the top of my head). – Dan Sinclair Oct 24 '18 at 19:03
  • @DanSinclair I used media link. – Dheeraj Palagiri Oct 26 '18 at 8:46
0

I have found an alternative for rendering pdf link media item through Glass.

@Editable(x=>x.LinkName)

worked for me.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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