Forum:Auto adding a blurb to new blogs

Is there a way to automatically add something to every new blog post that is created (similar to how the forumheader is added to every new forum)? I ask because on my wiki the content takes absolute priority while discussion around it comes a clear second to that. We allow blogs and realise that the blogs can help attract editors and encourage some casual readers to have a go at editing, but do not want the blogs to be a distraction from the work on the wiki itself. So I'd like to set it up so that when a new blog is created, at the top of it will automatically be added a template which will give links to the various ongoing projects and easy tasks that need doing on the site. The aim being to encourage (or at least increase awareness of) work on the site itself. Does anyone know how I would go about doing this or if it is even possible? I have no problem going doing this manually, but it would be a lot easier. Anyway, thanks in advance 14:02, April 6, 2011 (UTC)


 * It's not as simple as the forumheader, unfortunately - but it is possible. You can use a short JS function that will automatically add the template you want to the top of the page.


 * Moncho: Mind writing that JS blurb for us since you are the go to guy for all the JS needs around here? Would be much appreciated--


 * I have a couple of things to get done right now (mainly school stuff), but I'll get it done ASAP. If you can find Rappy, he might be able to do it with jQuery.


 * That would be great. Thanks for your help. 18:37, April 6, 2011 (UTC)


 * Here it is:

 function BlogPreload { var creating = true; for(i in location.href.split('&')) { if(location.href.split('&')[i].split('=')[0] == 'article') { creating = false; }	}	if(wgPageName == 'Special:CreateBlogPage' && creating == true) { if(document.getElementById('#cke_contents_wpTextbox1') != null) { document.getElementById('cke_contents_wpTextbox1').getElementsByTagName('iframe')[0].contentDocument.getElementById('bodyContent').innerHTML = '  '; }		else { document.getElementById('wpTextbox1').innerHTML = '\n\n&lt;-- Please place your content under this line. -->';		}	} }

addOnloadHook(BlogPreload);
 * For the record, I hope I never have to work with the RTE again. The whole thing is just a burden - not only when I have to use it, but when other people use it and fail miserably at accomplishing a simple task.


 * Thanks so much (and agree about the RTE, at least in its current form it causes so many problems). 13:48, April 7, 2011 (UTC)


 * Hey Mocho, its not working right, it is adding the blog header to talk pages and css and js pages as well.-- 16:32, April 7, 2011 (UTC)


 * Are you sure? The if should stop that.
 * Nevermind, I made a few major syntax fails, such that it perfectly breaks, and uses the else statement as "if you aren't on Special:CreateBlogPage, add the MW editor line". Now that's a fail with style - usually, it would just throw an error. In any case, I fixed it above, so it should work if you copy it again.


 * No worries, its sorted now. Thanks for the help, it works great now. Now I just hope that the header does help promote work on the wiki's articles. 21:11, April 7, 2011 (UTC)


 * Monchoman45 has so many FAQ worthy posts... -- Fandyllic (talk &middot; contr) 7 Apr 2011 2:19 PM Pacific

I think there is a minor error. When it adds the template, the "Put your content below this line" comment is visible on the blog post. The opening comment tag is <-- instead of ';)
 * '\n\n';)
 * It actually should be, that was my mistake. It should show up in the edit window, but not show up in the preview, just like the forumheader.


 * New problem, when editing a blog, the header replaces all content.--
 * That shouldn't happen either, unless  is glitched on blogs. I'll check it out and see.
 * Updated code, should be fixed now.

Hello, I am from the Bleach wiki, and I see that you updated the code. I tried to see if I could editing my existing blog post, and I still run into the issue of having the blog header only and the rest of my content is gone. I only know a little CSS and JS, so this is way over my head. Thanks for all your help, --Lemursrule 03:29, April 10, 2011 (UTC)


 * Should be fixed once Yyp logs on.--