Insert a meta tag in output HTML

Topics: User Forum
Feb 27, 2013 at 3:44 AM
Hi, I'd like to insert a meta tag in the HTML that's output. I'm currently on 1.8 and played with a plugin as a post processing step, but it's not going well.

If I upgrade to 1.9, what's the best way to approach this?


Great tool btw!

Thanks
Jim
Coordinator
Feb 27, 2013 at 2:59 PM
A build component would probably be the best approach. It runs in the BuildAssembler step and would let you insert them at the time the topic is being generated. See the MSHelpAttrComponent as it effectively does the same thing to insert Help 2 attributes into the XML data island.

Eric
Feb 27, 2013 at 7:26 PM
Thanks Eric, I followed your article here http://www.codeproject.com/Articles/16740/Creating-Custom-Build-Components-for-Sandcastle#CreateProject but with the code from MSHelpAttrComponent.

When I debug (per the article) I can see it working but the Apply override always get an empty XmlDocument (eg. document.OuterXML==""), even though I can see the topic key is correct. Any idea why?

Am still using v1.8

Thanks
Jim
Feb 27, 2013 at 9:42 PM
Ah, I see - I had to put my XML after the TransformComponent section in the sandcastle.config. Works now!
Coordinator
Feb 27, 2013 at 9:44 PM
Make sure you've placed your component in the proper location in the build assembler configuration file. Perhaps you've currently got it at or near the top in which case it may not have loaded the skeleton document yet. Placing it just before or just after TransformComponent should be fine depending on whether you want to insert your attributes before the topic is converted to HTML or after.

Eric