Inserting inline html/javascript into text of a blogpost

Topics: Customizing Orchard, Writing modules
Oct 14, 2011 at 2:23 PM


I wish to insert some inline javascript (which returns an image) into the text of a BlogPost.

At the moment I have created a widget which contains the javascript, so I can only make the image appear above or below the BlogPost text. As shown in the image on the left.



What I am looking for is results like the image on the right. The javascript rendered within the BlogPost text. Ultimately, I wish to for the javascript to be rendered within the text of every BlogPost on the site.

Any ideas on how I would do this?

Oct 14, 2011 at 3:20 PM

Your best bet would be to override the BodyPart template. Inside this template you could register a local script which would do it. You could even use some specific fields attached to your content to drive the ad, or the placement of the add so the editor gets a nice integration in the workflow.

Oct 15, 2011 at 6:24 AM

You can also set the flavor to text for the body part (from the content type editor).