Search code examples
sitecoresitecore8glass-mapper

Glass Mapper RenderLink double quotation marks


I am using Glass Mapper with Sitecore 8. Glass Mapper renders links with single quotation marks, which goes awry when the link text itself has a quote in it:

<a href='' class=' ' title='Coroner's Request' >

How can I get Glass Mapper to use double quotes in links? I notice that the option has been added in a recent change, which has included a new property in the GlassHtml class. But I can't seem to find how to configure it anywhere! What have I missed?

Thank you for your answers.


Solution

  • It's a field of GlassHtml class. You would need to set it e.g. by executing this code:

    Glass.Mapper.Sc.GlassHtml.QuotationMark = "\"";
    

    It's a static field so it's enough to do this only once e.g. in <initialize> pipeline.