I’d like to customize the HTML5 result format used by ServiceStack. My basic goal is to be able to embed REST-style links between resources and to recognize them in-line. E.g., I’d like to be able to embed a link rel="edit"-type element in my response and convert that into the appropriate link/form/etc. when it’s rendered. I have several other similar customizations in mind as well.
Would it be easier to build a static site off to the side that calls the JSON APIs? If not, how should I proceed with customizing the existing format? I think I can address my immediate need if I can supply my own CSS/JS, but I’m interested in any other extension points I might be overlooking.
Only limited customization available in the HtmlFormat itself e.g.
TitleFormat,HtmlTitleFormat, etc (see impl for details).The body of the HtmlFormat is an embedded resource so ships inside the ServiceStack dll. To customize any embedded resource in ServiceStack you can just add the embedded file in the same directory structure as it is in ServiceStack project, to your Host project (which takes precedence).
To override the body, add a customized version of HtmlFormat.html in:
Otherwise you can just completely remove it and add your own, e.g: