This project is read-only.

Apply Different Themes to Different Blogs

Topics: Administration
Jul 18, 2012 at 2:27 PM

Is it possible to apply a different themes to different blogs on the same site?  When I go to create a New Blog, it would be nice to be able to apply a different Theme to it since it would be a totally different blog (it may not even be of the same subject matter).

Jul 23, 2012 at 12:04 PM

Yes, you need to implement IThemeSelector to change the theme dynamically. I suppose one could implement a content part that stores a theme name for the blog, that the theme selector could then use.

Jul 23, 2012 at 8:00 PM

So, let me see if I understand:

Create a content part and attach it to blog.

Make content part retrieve current blog variable (how)?

Select theme using IThemeSelector based on current blog variable?


It would be ideal to be able to do this within the UI.  Just like when you select a theme for the site, you can select a theme for a blog.

Jul 23, 2012 at 9:34 PM

Not exactly. The part would need to retrieve the list of themes, like the theme admin screen, and present it as a radio button or drop-down list. The currently selected theme name for the blog would be stored as a simple string on the record for the part.

The difficulty then would be to retrieve the setting from the IThemeSelector implementation. It gets a RequestContext as a parameter. From that object, you need to determine whether the current request is for a post or list of posts on one of your blogs, probably by looking at the route data. You would then retrieve that blog content item, cast it As<TheThemeSelectionPartYouBuilt>() and get the theme setting. Return that.

Makes sense?

Jul 23, 2012 at 9:39 PM

Sort of.  I need to build more modules to understand how things are supposed to work.  I have built the hello world module.  I will try next creating the 1 to n, and maybe then I will understand how something like this will work.