Creating a BlogEngine.NET theme

I recently finished creating a custom blog engine skin for this site, you're looking at it right now. It's fairly simple as I wanted to see how far I could get without the (over) use of gradients and drop shadows. Creating a BlogEngine.NET theme was pretty straight forward, so I thought I'd cover off a few basics quickly.

Find another theme to base yours off
BlogEngine.NET ships with a number of themes, they are all developed in slightly different ways. Having a skeleton structure to build from saves you a lot of time. I ended up removing a lot of the theme I started from (including the entire css file). The BlogEngine control panel is not affected by the skin, so we are simply skinning the public side of the site.

The structure of a theme

blog skin structureThere is not a lot to a BlogEngine.NET theme and if you are familiar with ASP.NET it will be familiar. The site.master file is a standard asp.net 2.0 master page that will be applied to the site. The CommentView and PostView ascx files are standard user controls that BlogEngine uses not surprisingly, to render a post and it's comments. These inherit from the PostViewBase and CommentViewBase controls to provide access to the post and comment data.

Using the BlogEngine functionality

Being ASP.NET 2.0 the "all the logic in the view" (anti)pattern is followed! While I don't agree with this personally, you can't win 'em all :-) With blogengine already having done the hard work for me, I thought it overkill to build a testable presenter layer for the skin.

<%@ Import Namespace="BlogEngine.Core" %>

Adding the Import Namespace="BlogEngine.Core" server tag to the ASPX of any of these controls allows us to call into the engine and retrieve data on the blog itself and access a number of utility classes. You could also do this in the .cs code-behind.

<%=BlogSettings.Instance.Name %>

The static BlogEngine.Code.BlogSettings class contains a number of useful properties including the Name and Description of the site (I use these for the heading, and "welcome to my weblog" tag line on this site. This allows the skin to take advantage of the configurability of the blogengine.

<%=Utils.AbsoluteWebRoot %>

The static BlogEngine.Core.Utils class provides access to functionality like sending emails, and the AbsoluteWebRoot Uri which I use for hyperlinks.

<blog:WidgetZone runat="server" ID="footerZone" ZoneName="footerZone" />

The WidgetZone control provides a configurable place for widgets to be added. You can have any number of these zones, giving them a unique name allows you to have different widgets in each. This site has a widgetZone control in the footer with the tagCloud widget added to it and another hidden widgetZone with the Administration links in it visible when logged in.

Once I had a nice xhtml-compliant markup I set to work adding css. Using the Visual Studio 2010 Release candidate to edit CSS you get constant validation against the CSS2.1 standard. This was great, but I still find the easiest way to write CSS is using Firebug. Firebug allows you to directly manipulate stylesheets in the browser, re-rendering automatically. So I found myself writing the css in visual studio initially, then tidily updating the file in visual studio.

I hope this helps anyone writing a blog engine skin. Is there anything I've missed or any other useful features of BlogEngine.NET that I should know about?

 

Tags: , , , , , ,

Comments

trackback
DotNetKicks.com
4/24/2010 11:21:59 PM Permalink

Creating a BlogEngine.NET theme

You've been kicked (a good thing) - Trackback from DotNetKicks.com

pingback
topsy.com
4/29/2010 6:32:40 AM Permalink

Pingback from topsy.com

Twitter Trackbacks for
        
        instantiate | Creating a BlogEngine.NET theme
        [instantiate.co.nz]
        on Topsy.com

pingback
489.eumreborn.com
5/21/2010 3:06:19 PM Permalink

Pingback from 489.eumreborn.com

Hood Lexus Sc400 Fit, Gs350 Fog Light Exterior 2010 Lexus Gs

dog toy
dog toy United States
4/26/2012 9:47:39 AM Permalink

This is a great inspiring article. I am pretty much pleased with your good work. You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.

youtube to mp3
youtube to mp3 United States
5/9/2012 6:39:59 AM Permalink

i used to work for a fashion company where 1/2 of my day was spent writing on other blogs in the form of fake comments. my boss would come in and say "google emoda and see what comes up on blogs, make sure you combat all the negative ones, just sound like a happy customer". needless to say it was awful and i eventually quit. the truth is, if you produce a quality product and perform with quality service, you wont need to worry about anyone else. Smile

godaddy promo codes
godaddy promo codes United States
5/9/2012 4:30:16 PM Permalink

Good, site have learned more through this site than I have through months of reading search engine optimisation and reading how to gain links books. Prehaps you can give me me some advice on how to get my wiltshire based web company to the top of search engines - help to get me comments/links and to my site?

hid fog lights
hid fog lights United States
5/10/2012 8:33:34 AM Permalink

I'm extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you customize it yourself? Anyway keep up the nice quality writing, it’s rare to see a nice blog like this one nowadays..

physical fitness
physical fitness United States
5/16/2012 10:12:08 AM Permalink

I've never even thought about commenting till now. I guess if I really like a post I find myself checking the external links for more and favoriting (if that is a word) the post instead.
From now on though I'll definitely try and drop a comment every so often.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading