Skip to content

Instantly share code, notes, and snippets.

@vgrem
Last active April 20, 2016 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vgrem/8744426 to your computer and use it in GitHub Desktop.
Save vgrem/8744426 to your computer and use it in GitHub Desktop.
Rendering template for SharePoint Blogs
(function () {
function blogBodyRenderer(ctx) {
var item = ctx.CurrentItem;
return '<a href="' + ctx.listUrlDir + '/Post.aspx?ID=' + item.ID + '" class="ms-accentText">Read more...</a>';
}
function registerBlogsRenderer()
{
var blogContext = {};
blogContext.Templates = {};
blogContext.Templates.Fields = {
"Body": {
"View": blogBodyRenderer
}
};
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(blogContext);
}
ExecuteOrDelayUntilScriptLoaded(registerBlogsRenderer, 'clienttemplates.js');
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment