Wednesday, October 16, 2013

Add Custom HTML Templates to Your CKEditor

Over two months since my last post...aggghhh...pathetic...just been very busy which is not a bad thing these days...

Simpering skulking done...and now....On With The Tip!!

I really have no idea why, but my entire Notes/Domino life has essentially been one long period of nobody else seems to need or do what I do.  Or at least very often.  Dunno' why.  Just is.

This tip might be one of those things that you will not find useful but in our business it is extremely productive and it is easy to do.  Easy to do if your administrators are your friends that is.

First what are we talking about?  The Templates button in your CKEditor for XPages rich text fields.

Huh?  What's that you say?  You never used it or noticed it?  Well alrighty then take a gander at the image below.

Got it?  Don't ever need to give yourself or your users a quick way to insert the same thing over and over again into the "rich text" editor?  No problem.  Hurry!  Go! Click! Go take a look at what David Leedy has today on or or by Marky Roden or what Brad Balassaitis has on or who published what on

Still here?  Right!  Here's how you do that.

1.  Edit the CKEditor config.js on your server so that it contains the following line which comes from here:

config.templates_files = [ '/mytemplates.js' ];

2. Create the mytemplates.js file. This file contains your HTML templates.  It is very simple and you can copy and paste the example right from here to get you going.

3. Now here is the critical part.  Restart your server and test your editors by clicking the Templates button.  If you don't see your templates, reload your browser without caching so it reads the CKEditor files fresh.  Should work like a champ.

Word to the wise...if it matters to you, you might want to add a file protection rule to the templates file.

There it is.  A simple task that most people will probably never need outlined once again in the simple jocular way that I hope people like.