BlogEngine.Net: +1 (plusone) Button

There has been a lot of discussion lately about Google’s +1 service. Google has even made it easy to add a +1 button to your webpage.

It is just as easy to add a +1 button to your BlogEngine.Net posts.

First need to add the following script to the HEAD section of your site.master template.

 

<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>

 

Then you only need to add the following to your PostView.ascx file where you would like the button to be displayed:

 

<g:plusone size="small" count="false" href="<%=Post.PermaLink %>"></g:plusone>

To display the +1 count for the post change the count attribute to true.

 

You can see more +1 button options here.



   

BlogEngine.net: StumbleUpon Button

In a previous post I discussed how to display Twitter, Facebook and dotNetKicks buttons in a BlogEngine.Net.  It is also possible to add ad StumbleUpon botton to you BlogEngine.Net post.

Place the following code in your PostView.ascx page.

<script src="http://www.stumbleupon.com/hostedbadge.php?s=2&r=<%=Post.PermaLink %>"></script>

The "s" parameter can be changed to a number 1-6 to displacy additional button types.



   

BlogEngine.net: Twitter, FaceBook and DotNetKicks Buttons

Outside of setting up an extension you can easily add Twitter, FaceBook and DotNetKicks buttons to you BlogEngine.Net posts by inserting the following code snippets in the desired location of your theme’s PostView.ascx page:

Twitter:

<a href='http://twitter.com/share' class='twitter-share-button' data-url='<%=Post.PermaLink %>'
                data-count='horizontal'>Tweet</a><script type='text/javascript' src='http://platform.twitter.com/widgets.js'></script>

 

FaceBook:

<iframe src='http://www.facebook.com/plugins/like.php?href=<%=Post.PermaLink %>&layout=button_count&show_faces=false&action=Like&colorscheme=light'
                frameborder="0" scrolling="no" style="border-style: none; height: 20px; width: 90px;
                overflow: hidden;"></iframe>

Note:

  • The options for layout are button_count, standard and box_count 
  • The options for action are like and recommend 
  • The options for colorscheme are light and dark

 

DotNetKicks:

<a href="http://www.dotnetkicks.com/kick/?url=<%=Post.PermaLink %>&title=<%=Post.Title %>"
                target="_blank">
                <img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=<%=Post.PermaLink %>"
                    border="0" alt="kick it on DotNetKicks.com" /></a>



   

Embed a YouTube Video in a BlogEngine.Net Post

As I continued to wade through and cleanse my previous posts I noticed that the tags to embed a YouTube video were stripped out.  A quick search led me to this forum discussion.  I added the line of code mentioned and now I can embed YouTube videos within my posts again. The changed code is as follows:

 

// Theme options
		theme_advanced_buttons1: "fullscreen,code,|,cut,copy,paste,pastetext,pasteword,|,undo,redo,|,bold,italic,underline,strikethrough,|,blockquote,sub,sup,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,outdent,indent",
		theme_advanced_buttons2: "iespell,link,unlink,removeformat,cleanup,charmap,emotions,|,formatselect,fontselect,fontsizeselect,|,forecolor,backcolor,insertcode",
        theme_advanced_buttons3: "",
		theme_advanced_toolbar_location: "top",
		theme_advanced_toolbar_align: "left",
		theme_advanced_statusbar_location: "bottom",
		theme_advanced_resizing: true,
        theme_advanced_resize_horizontal : false,
        tab_focus: ":prev,:next",
		//>> 001 110514
        extended_valid_elements: "iframe[src|class|width|height|name|align]",
		//<< 001 110514
        //Character count

 



   

Switching from Blogger to BlogEngine.net

Several years ago, I started out “blogging” with Blogger.  Blogger originally offered an FTP option, which offered a great deal of flexibility.  The FTP option allowed an author to host their own blog and use the Blogger software to manage posts via FTP.  Some time ago, the announcement was made denoting the death of FTP support.  This announcement took away from my enthusiasm towards posting content as I preferred to host content locally and have a bit of flexibility in the management of content and features.

Recently I decided to dabble with the BlogEngine.Net and found it to be a great alternative.  Besides experimentation with creating custom themes and experimenting with minor code changes, my first chore was to convert my posts from Blogger to BlogEngine.Net.  Unfortunately, you can’t get there from here.  It took some time and experimentation, but I finally managed to get the posts converted.

  1. Exported the Blogger blog
  2. Created a free Wordpress.com blog account
  3. Imported the Blogger export file
  4. Exported the posts from Wordpress
  5. Removed the <atom /> elements form the export file
  6. I downloaded  WXR2BlogML (Note: I did try aaron lerch’s powershell script and couldn’t seem to get it to work with my posts) and used it to converted the file
  7. Import the converted file into BlogEngine.Net using the ClickOnce Import application

I also noticed that a lot of the source code examples converted have format issues. This actually turned out for the better as I am taking the time to remove outdated posts and clean the remaining ones.  Let's see how this works out.