" />

Add to Technorati Favorites



 

...where sanity comes to die.
Visit my blogBlur the lines between genius, insanity, and utter stupidity.WALDOLand Music CentralDevelopment WorkAbout MeContact MeWALDOLand Site Map
 

 Saturday, January 26, 2008

Yet another reason why MySpace Sucks and Facebook Rules

Just the simple fact that the blogs in MySpace can't be cross-posted or imported.

If I write a blog post on this site, I can let Facebook import my XML Feed and blammo, instant cross-post into their Notes feature.

With MySpace, I literally have to manually copy and paste every blog post I write and re-post it in MySpace. For someone who posts regularly, this is an incredible pain in the ass. On top of that, MySpace's wysiwyg editor is complete crap. If I post markup that for example, has a <table> tag in it, MySpace thinks they're clever and scrubs it out and replaces it with bad markup. Their scrubbed markup is not even close to XHTML-compliant (or even HTML-compliant), so I'm limited in what I can actually post to MySpace.

Labels: , , , , ,

 Sunday, September 02, 2007

Hey, I just noticed this.

Blogger Just started including the ability to have podcast enclosures for each post. Well done, Blogger. Now you've caught up to what even MySpace has had for over a year. ;-)

Labels: , ,

 Wednesday, July 11, 2007

Why didn't I think of that sooner?

I had been spending a lot of time working on my website. I can remember a good portion of time went into writing an HttpModule to identify pages generated by Blogger and apply an HttpFilter to produce server generated content based on static markup in those pages.

A brief explanation...

Blogger (the way I have it configured) generates HTML pages for each post, organized by date, an index HTML page for the home page, archive pages, etc. All of them static HTML, generated from a template. Then Blogger FTP's them up to my site. Simple for static content, right?

My HttpModule knows, through its own configurations, which folders on my site contain blog HTML files. If one is requested, it attaches an HttpFilter which scours the content using Regular Expressions, looking for markup that I designate. When it finds that markup, it replaces it with dynamic content, such as UserControls containing menus, Ad rotators, links, etc. It added a little overhead to the processing time of rendering a static page, but for the dynamic content, it was worth it for me.

I spent a couple of weeks building this very slick solution. It ostensively converted static content to dynamic.

A couple of days ago, while working on another section of the site using a Master Page, it hit me. Blogger lets me configure the names of files that it generates. It doesn't HAVE to be .html. Why couldn't it be .aspx, inherit a generic BlogPage class, and use a Master Page?

Holy crap what a great idea! Why hadn't that come to me in like a year? That would save me so much time and effort in updating my blog template.

I used to use a Master Page (several, actually) for the rest of the site, fish out the static content for a page once it was rendered, then apply it to my blog template so that my posts could look and behave like the rest of the site. This meant that any change to my Master Page, or to configurable dynamic content would mean that I would have to update the template and republish my entire blog. This also meant keeping a huge amount of static markup in my template which made diagnosing problems that much more difficult.

So I'm sure the question all of you want answered is, "So how do I use Master Pages and blogger content together?"

Well, I'm glad you asked.

  1. Start by creating a BlogPage base class in your App_Code directory.
    Public MustInherit Class BlogPage
        Inherits System.Web.UI.Page

        Protected WithEvents TitleContent As System.Web.UI.WebControls.Literal

        Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
            ' Apply the TitleContent's inner Text to the title, overriding the Title
            ' property defined at the page-level

            If ((Not Me.TitleContent Is Nothing) AndAlso (String.IsNullOrEmpty(Me.TitleContent.Text.Trim()) = False)) Then
                Me.Title = Me.TitleContent.Text.Trim()
                Me.TitleContent.Visible = False
            End If
        End Sub


    End Class

  2. Then create a Master page for your blog content.
    <%@ Master Language="VB" Inherits="MyBlogMaster" CodeFile="MyBlogMaster.master.vb" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server" id="head">
        <title>My Blog Master Page</title>
    </head>
    <body>
        <form id="aspNetForm" runat="server">
            <!-- BEGIN BODY CONTENT -->
            <asp:ContentPlaceHolder ID="BodyContent" runat="server">
                INSERT BLOG CONTENT HERE!
            </asp:ContentPlaceHolder>
            <!-- END BODY CONTENT -->
        </form>
    </body>
    </html>

  3. Update your Blogger settings to generate .aspx pages, rather than .html pages
    Blogger settings

  4. Update your Blogger Template to generate ASPX pages (Web Forms with no codebehind) that will inherit from your base page and consume your Master Page.
    <%@ Page Language="VB" MasterPageFile="MyBlogMaster.master" AutoEventWireup="false" Inherits="BlogPage" title="My Blog Page" %>

    <asp:Content ID="BodyContent1" ContentPlaceHolderID="BodyContent" runat="server">
    <asp:Literal id="TitleContent" runat="server" Visible="false"><$BlogPageTitle$></asp:Literal>

    <Blogger>

    <BlogDateHeader>
    <p class="dateheader"><$BlogDateHeaderDate$></p>
    </BlogDateHeader>

    <a id="<$BlogItemNumber$>" />
    <BlogItemTitle>
    <p class="posttitle" id="BlogItemTitle<$BlogItemNumber$>">
    <BlogItemUrl><a href="<$BlogItemURL$>" title="<$BlogItemURL$>"></BlogItemUrl>
    <$BlogItemTitle$>
    <BlogItemUrl></a></BlogItemUrl>
    </p>

    </BlogItemTitle>



    <div class="post-body">
    <p>
    <$BlogItemBody$>
    </p>
    </div>

    </Blogger>
    </asp:Content>


Oh my god! How much smaller is my template now? I don't have to port all that static markup in the template. If I ever need to change something, I can just change the Master Page and have it propogate all the way through every blog item page. Yay! How long did it take to implement? Well, let's put it this way, It took longer for me to write this post than it did to implement this entire solution.

Now of course I now have the problem of search engines having defunct links. Simple fix. I changed the behavior of my existing HttpModule to send 301 (Permanently Moved) HTTP statuses for any requests to the old .html pages to the new .aspx pages, rather than applying the HttpFilter to convert the static content to dynamic. Sweet!

Labels: , , , , , ,