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;}
6
  • Can you add a code example of how you are rendering the link? And how your model is setup?
    – Richard Seal
    Oct 23, 2018 at 13:35
  • What type of field is your LinkName field? Oct 24, 2018 at 11:10
  • @DanSinclair GeneralLink Oct 24, 2018 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). Oct 24, 2018 at 19:03
  • @DanSinclair I used media link. Oct 26, 2018 at 8:46

1 Answer 1

0

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

@Editable(x=>x.LinkName)

worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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