BlogEngine Update - Integrate Advertising Affiliate Programs

by Naveen 12. June 2011 17:43

Download BlogEngine Source Code (5.83 mb)

This is another updated version of BlogEngine.Net 2.0. The focus of this release is on integration of advertising with your posts. This advertising is about display of advertisements for affiliate accounts like Commision Junction, LinkShare, Pepperjam etc. This is some update that I have deployed on my blog(s) as well and have been testing for some time.

A lot of affiliate programs provide scripts that can automatically detect context of your post and then display appropriate advertisements. But when you want to have greater control on advertisements then you are going to need some custom implementation on you end. Good.news is that all these programs offer web services that can be used to pull advertisements based on some predefined criteria. Another reason for not using automated scripts from these affiliate programs is that lot of these scripts tend to slow down loading of pages as well which could hurt performance of your blog.

Advertisements are mainly classified by categories and keyword. These categories may not be same as the categories you used to classify content of the posts. So what we need is to associate each post with advertisement categories. Good news is that since search engines do not look at keywords meta tag we can assign post keywords to search criteria for advertisements.

In this update to BlogEngine, I have added two new tables in database, be_AdCategories and be_PostAdCategory. Using these tables each post is associated with one.or.more advertising categories. I have updated admin interface to allow adding new advertisement categories and in post admin interface you can associate advertising categories to posts.

I have also included a demo advertising engine with the projects. This advertising framework pulls seasonal advertisement links from Commision Junction. I have included Commision Junction API that I implemented some time back. You can use this API to pull links, products etc based on some predefined search criteria. I have also included assemblies for LinkShare affiliate program API.

Each affiliate programs requires you to have some authentication token or key to use webservices. Instead of hard coding these values I have implemented a.BlogEngine extension AdAffiliateSettings that can be used to specify these access.tokens and other attributes that can be used with advertisement API. For now I have included parameters for LinkShare and Commision Junction. You can modify the code.for this extension to include other affiliate programs.

I have updated TitaniumX skin to make asynchronous request to get random advertisement from frmaework to display seasonal links. The script runs a timer on 20 seconds interval to pull new link to display.

This is just a proof of concept implementation of advertisement framework. You can extend it to pull more relevant advertisement links based on categories and keywords associated with each post. Let me know if you need any help with that and we can work something out.

Upgrade Instructions

  • In setup > SQLServer folder there is a SQL script MSSQLUpgrade2.0ForAdvertisements.sql. Run this script to create new tables in your database.
  • Compile the project and deploy it.
  • Make sure that you compile BlogEngineAdvertising project and copy ByteBlocks.BlogEngineAdvertising.dll assembly in BIN folder of your web application.
  • Assuming you have affiliate account with Commision Junction or/and Linkshare, launch Extensions administration part from administration dash. Then enter Development Key for Commision Junction and your web site ID in there. And for Linkshare enter your Access Token and save the settings.

Demo

You can see the demo of this integration at the bottom of each post under the section Deals Of The Day. Notice how the advertisement changes every 20 seconds.

If you run into any problems with this update of BlonEngine 2.0 (WAP version) toss an email to my side and I will try to get back to you!

 

Views: 2276

Tags:

Blog Engine

Google Plus One Button For ASP.Net and BlogEngine

by Naveen 4. June 2011 05:52

Download Source Code (3.27 kb)

Download Binaries (10.41 kb)

Google has been experimenting with concept like FaceBook's Like Button and Twitter's Share Link button. It is called Google Plus One Button. Now Google has opened it up for all web sites. If you want to read more about this, you can look it up at Add +1 to help your site stand out. Recently with Panada algorithm changes and its effect on site rankings, addition of this Plus One button is your friend. If you can get few friends to push up this count, you may see some upward movement in your site ranking.

I thought I will build a nifty little ASP.Net server control that you can use to add your ASP.Net web site and BlogEngine blog sites. I have included source code for the control with this post. It is pretty straight forward like I did Tweet This button. Here are steps that you can follow to include this control on your page or PostView control of BlogEngine.

  • Download source code or binaries of the control from this post.

  • Copy the control assembly (ByteBlocks.GooglePlusOne.dll) in BIN folder of your web application.

  • At the top of page where you want to include the button, add register tag as shown below.

    <%@ Register TagPrefix="ByteBlocks" Namespace="ByteBlocks.GooglePlusOne" 
      Assembly="ByteBlocks.GooglePlusOne" %>
    
  • Now add the control tag on your page or user control like below.

    <ByteBlocks:GooglePlusOneButton ID="GooglePlusOnePlace" runat="server" ButtonSize="Tall" />
    
  • There is nothing more to configure if you want to configure with default values. But if you want to customize it here are few properties that you can use.

    • Url: This property can be used to set URL that you want to promote. If you leave this blank then button automatically picks up URL of the page where it is placed.
    • ButtonSize: This property has four values, Small, Mediumn, Standard and Tall. By default this property value is set to Standard.
    • IncludeCount: This property controls if count of plus one actions on the URL. By default this value is set to true. But if you do not want to show the count, then you can set it to false.

Including Google's JavaScript File

It is important that you include following script file on your page.

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

You can set IncludeScriptFile on the control to true and then control will render the inclusion of this script for you. But I would strongly recommend that you put it in header of master page of your site itself so better control caching and optimization of page rendering.

Give It A Try!

You can try the little button +1 at bottom of this post to see how it works and all!

 

Views: 3166

Tags: ,

ASP.Net | Blog Engine

Customize View Of PostView In BlogEngine Home Page

by Naveen 27. May 2011 03:12

When you are using BlogEngine.Net out of the box, you will notice that display of blog posts on home are controlled by PostView.ascx user control in theme of your blog. A lot of time there may be some content in your post view that you only want to show when user is visiting page for that post and you do not want to show it on home page. For example in my blog I display google adsense block on each post. Since google allows only 3 ads on a page, that means on my home page I will have large empty blocks under each post. And in some cases you may want to hide some content that may increase load time of the home page because each post will need to render that part of the content. Bottom line is that since PostView.ascx controls the view of posts on home page as well, you may need some way of controlling that view depending on page where it is being used.

Here is a quick way to fix this without making any change to BlogEngine core. I have included parts of the view that I want to control in ASP.Net PlaceHolder control. And then in Page_Load or RenderControl event of PostView control, I have set the visibility of the panel based on URL. Following code snippet shows what I did on my blog.

<asp:PlaceHolder ID="GoogleAdBlock" runat="server">
.... ad script goes here ....
</asp:PlaceHolder>

<script runat="server">
public override void RenderControl(HtmlTextWriter writer)
{
   GoogleAdBlock.Visible = !Request.Path.ToUpper().Contains("POSTS.ASPX");
   base.RenderControl(writer);
}

</script>

You may be wondering why I am checking for POSTS.ASPX and not Default.aspx. I actually have modified BlogEngine core to control what my home page is going to be. I have removed hard coded Default.aspx value from core itself and now it is controlled by a new entry in settings.

 

Views: 2037

Tags:

Blog Engine

Tweet Button Control For BlogEngine and ASP.Net

by Naveen 21. May 2011 08:00

Download Source Code For Server Control (3.38 kb)

Download Assemblies For Server Control (5.26 kb)

For quite some time I have been using Tweet This button on this blog and on some of client's customized blogs. Yesterday when I tried to use that button to tweet about new posts I saw that Twitter has changed their handling of URL that used to populate the tweeter box to post a tweet. So I went to their developer support pages and noticed that Twitter has updated their APIs and provider few more options now to share the URLs on tweeter. For most part you can just put their two lines of javascript on every page and twitter will pick up the URL of that page along with title of the page and create a message for you to post as a tweet.

But if you want to have more control on the message along with the URL then you will need to be little bit work on how the HTML is constructed on your page. For example in my implementation of BlogEngine I have two sets of titles for each post. One title that is used to construct URL and second is the title that actually gets put in the TITLE tag of the page itself. Now you can see that default javascript may not work for me. Also from time to time I like to include my tweeter screen name in the tweet itself.

I have created an ASP.Net server control that you can deploy in any ASP.Net application including BlogEngine.Net. The implementation renders following HTML on the page as described in Twitter Documentation.

<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<div>
  <a href="http://twitter.com/share" class="twitter-share-button"
      data-url="http://dev.twitter.com/pages/tweet_button"
      data-via="your_screen_name"
      data-text="Checking out this page about Tweet Buttons"
      data-related="anywhere:The Javascript API"
      data-count="vertical">Tweet</a>
</div>

How to include Tweet Button In BlogEngine Posts

  • Compile the attached project or use the pre-compiled binaries for the control and copy them in BIN folder of your application.
  • Add Register tag at the top of your page or view's control that refers to this control's assembly. For example on my blog this looks like as below.

    <%@ Register TagPrefix="ByteBlocks" Namespace="ByteBlocks.TweetThisButton" Assembly="ByteBlocks.TweetThisButton" %>
    
  • Add instance(s) of control on your post or page as shown below.

    <ByteBlocks:TweetItButton ID="TweetPostButton" runat="server" CounterOrientation="Vertical" />
    
  • Now set the properties of the control to specify tweet text and URL. For example I did this in code in PostView of my theme as shown below.

    public override void RenderControl(HtmlTextWriter writer)
    {
       TweetPostButton.TweetUrl = Post.AbsoluteLink.AbsoluteUri;
       TweetPostButton.TweetText = Post.MetaTitle;
       base.RenderControl(writer);
    }
    

Now you are all set with Tweet Button control in your post. Following screen shot shows how it looks. You can actually see it at bottom of this post as well and give it a try and see how it works!

 

Views: 2686

Tags: , ,

ASP.Net | Blog Engine | Twitter

Poll Widget For BlogEngine.Net

by Naveen 20. May 2011 18:31

Download BlogEngine.Net2.0 WAP With Poll(5.46 mb)

Download Poll Widget Only (21.54 kb)

I have been thinking of adding some sort of Poll widget or control to Blogengine.Net for quite some time. Latey I ran into BlogEngine.NET 2.0 Poll Widget implementation. This looked like what I really needed. When I tried to integrate it into my BlogEngine.Net WAP model project, I ran into few issues.

First there was use of a property from BlogEngine core that did not exist in latest code base. That was not such a big deal because I just need to use a different property. The biggest issue I ran into was that the implementation was missing a very important aspect of poll answers. There was no definite way to specify order in which answers should be displayed. You could not simply say that how about sorting alhphabateically. Well, lot of times in polls the answers are places strategically and they can not be simply sorted alhpabattically. Following image shows a sample poll that I created. In this I want to show Other answer as last answer in the list but I could not do it it because.

blogengine poll

So I decided to moidy the implmentation to include additional field in the database Poisition for the answer. And when I got list of answers from database, I sort the list on this field. And that solved the whole issue with position specification. To accomplish that I modified poll editor interface as well so that I could move the answers up and down as needed. You can see from the following image modified editor interface.

blogengine poll widget editor

The end result is that I have modified polling widget that displays the answers as per position specified at design time. Following image shows the final poll widget user interface. As you can see that Other is the last answer in the list and not some alhphabetically sorted answer list.

blogengine poll ordered answers

Updated BlogEngine WAP Project

I have updated my conversion of BlogEngine2.0 WAP to include Poll widget in it. You can download the whole nine yards. I have also provided just the bare minimum you will need to include Poll widget in your WAP model of BlogEngine2.0.

Installation and Other Instructions

For more details about set up, theme, CSS etc. I will recommend looking at BlogEngine.NET 2.0 Poll Widget post.

 

Views: 1974

Tags:

ASP.Net | Blog Engine

Announcement Widget In BlogEngine.Net

by Naveen 24. April 2011 15:03

Download BlogEngine 2.0 WAP With Announcements (4.51 mb)

Lately we have been working on extending BlongEngine 2.0 to include some more CMS features and more capabilities to it. After converting it to Web Application Project (WAP) model, I have been working on extending the core to allow BlogEngine to publish and manage items like Announcement and News. This release of BlogEngine.Net 2.0 geared towards that. It allows you to add Announcements in BlogEngine with following attributes.

  • Title
  • Content
  • Publish Date
  • Expiration Date

I have implemented the whole administration user interface that looks and functions exactly as the one you have for Posts. I have also extended the database to include rights that are specific to Announcements administration. I have not created any widget objects for announcements yet. But I have included two user controls in web application that demonstrates how you can use it to display list of recent announcements with titles only. And then a detailed version of it that displays full content of announcements. You can see this on home page of this blog itself. In left section of home page, the items under Industry News is a user control displaying titles only. And in Announcements page, are full view of announcements.

Database Change

I have included MSSQLUpgrade2.0ForAnnouncements.sql file under Setup that you can use to modify the database. Here is the script that is included in that file/

CREATE TABLE [dbo].[be_Announcements](
	[AnnouncementId] [uniqueidentifier] NOT NULL,
	[Title] [nvarchar](200) NULL,
	[AnnouncementContent] [nvarchar](max) NULL,
	[DateCreated] [datetime] NULL,
	[DateModified] [datetime] NULL,
	[Author] [nvarchar](50) NULL,
	[IsPublished] [bit] NULL,
	[IsDeleted] [bit] NULL,
	[ExpireDate] [datetime] NULL,
 CONSTRAINT [PK_be_Announcements] PRIMARY KEY CLUSTERED 
(
	[AnnouncementId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, 
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, 
ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

insert into be_Rights (RightName) value('ViewPublicAnnouncements')
insert into be_Rights (RightName) value('ViewUnpublishedAnnouncements')
insert into be_Rights (RightName) value('CreateNewAnnouncements')
insert into be_Rights (RightName) value('EditOwnAnnouncements')
insert into be_Rights (RightName) value('EditOtherUsersAnnouncements')
insert into be_Rights (RightName) value('DeleteOwnAnnouncements')
insert into be_Rights (RightName) value('DeleteOtherUsersAnnouncements')
insert into be_Rights (RightName) value('PublishOwnAnnouncements')
insert into be_Rights (RightName) value('PublishOtherUsersAnnouncements')

insert into be_RightRoles (RightName,[Role]) values ('ViewPublicAnnouncements','Anonymous')

Administration

Here are screenshots of administration user interface. I have modified web.sitemap file to include Announcements item in Administration widget.

Announcements in BlogEngine

 

Views: 2496

Tags:

Blog Engine

Convert BlogEngine.Net to WAP

by Naveen 29. March 2011 10:07

Download BlogEngine.NET WAP Projects (4.93 mb)

I have been using custom version of BlogEngine 1.5 for quite some time. I have made some customized additions to this engine to include features that I thought I were missing or I needed for my needs. Here are some of the changes that I worked on in the past.

  • Keep track of number of views of pages or posts
  • Add FaceBook like button
  • Add Recent Page List widget
  • .... and more

BlongEngine2.0 has been quite for some, so this is time for me to upgrade to latest and greatest code base. First step in my upgrade path is to convert the downloaded Web Site Project to Web Application Project (WAP) model. There is some discussion on BlogEngine.Net forums about it and there is a Fork for WAP conversion as well. I tried that WAP Fork but it drove me nuts. It has some issues.

  • It has some code that uses some Core features that do not exist in main branch of BlonEngine.Core project.
  • The current version of BlogEngine.Core in source control also does work with this WAP fork.

Well if you are not looking into making any changes to core then you can get the Fork because it has a compiled version of Core that probably works with this conversion.

Since I have to modify the Core to merge changes from older version of core so I had no option to go with my own conversion to WAP model. Ben has done good job of explaining steps on how to convert the source to WAP. But I found some of the steps out of sequence. That caused "Convert to Web Application" process in Visual Studio to leave some designer files in a state that would not compile. Also his steps suggested lot of renaming of controls etc. I did not find it necessary. Two main things that you will have to keep in mind.

  • Renaming of App_Code folder to something different. I just renamed it to AppCode.
  • This is from Ben's post: In the web.config file, in the <pages> section, there's this line:

    <add namespace="App_Code.Controls" tagPrefix="blog"/>

    Change that to:

    <add assembly="BeWap" namespace="Controls" tagPrefix="blog"/>

    In my case I kept assembly name same as BlongEngine.Net. This step is very important before you goto using "Convert To WebApplication" option. Otherwise you are looking at doing conversion again.

  • Rest you can follow Ben's comments.

For your convenience I have attached my conversion of BlogEngine.Net 2.0 to WAP with this post. If you have any questions, please feel free to contact. I am working on adding some new features to this newer version.

 

Views: 2722

Tags: ,

Blog Engine | Blog Engine

Blogengine updated to use post and page titles different from Url to make it SEO friendly

by Viper 18. February 2009 05:54

Last week I added a new page to my blog site. The article was very popular and lot of people bookmarked it as well. After 3 days I realized that there is typo in the title that I need to fix. So I made the change. After few minutes of making the change I started getting flood of emails about broken link from the people who bookmarked that article. Then I realized that BlogEngine.net generated URLs for posts and pages based on Title field. So if you change the title of the item, your URL changes as well. Well there are following problems I see with this approach.

  • Biggest problem is that URL changes if title changes. That would mean that you will have keep track of where you have used this URL internally and externally and update them.
  • If i specify a very long title for my post or page, I will have a gigantic URL. This is not something that is recommended in best practices of URL creation.
  • Now to keep the URL to manageable length, I will have to come up with short titles that explain what the page or post is all about. Well, in some cases you want to have a title that is little bit more descriptive for SEO purposes

After thinking through this, I decided to make change in BlogEngine.net to include a new field named MetaTitle for pages and posts.

This new field allows you to enter a title that is different from what is used to create URL of that post or page. And when you want to update title of the item, you just need to update MetaTitle and never have to worry about URL change because you changed title. You can still change Title field, but it will result in a new URL for your page or post.

You can download the updated code from BlogEngine.Net Update 1.5.3. This update requires change in SQL Server tables. The updated script has been appended at the bottom of the page. I will post that update here as well. This update requires addition of new field MetaTitle in be_Pages and be_Posts tables.


/* Script for MetaTitle features */
ALTER TABLE [dbo].[be_Pages]
 ADD
 [MetaTitle] [nvarchar](255) NOT NULL DEFAULT (N'')
GO
 UPDATE [be_Pages]	SET [MetaTitle] = [Title]
GO
ALTER TABLE [dbo].[be_Posts]
 ADD
 [MetaTitle] [nvarchar](255) NOT NULL DEFAULT (N'')
GO
 UPDATE [be_Posts]	SET [MetaTitle] = [Title]
GO

Admin pages Add_Entry and Pages have also been updated to include new text box for MetaTitle field. And all the core code has been updated to account for new database field as well. If you have any feature that you would like implemented or modified, please feel free to contact me. I will be glad to work with you on the changes.


BlogEngine.Net Custom Updates
 

Views: 10566

Tags: ,

ASP.Net | Blog Engine | SEO

Adding Custom Social Link Sharing ASP.Net Control To BlogEngine

by Viper 5. February 2009 12:04

I got little tired of adding these social networking site post sharing links to my themes. And I saw that there were few web sites offering these ShareIt or AddIt buttons. Well, I decided to create my own custom control for it. Please see the following link for more details about the control and how to use it instructions. There is little piece of code that you will need to add to PostView to get to use title of your posts as well as URL. Notice that in following code, I have added a server side script that overrides RenderControl method to set LinkTitle and LinkUrl properties of ShareLink control. If you don't add this piece of code, the control will still work but it will pick up URL and title of page from client side. More details as present in the article.

Custom Link Sharing ASP.Net Control

<script runat="server">
public override void RenderControl(HtmlTextWriter writer)
{
socialShareLink.LinkUrl = Post.AbsoluteLink.AbsoluteUri;
socialShareLink.LinkTitle = Post.Title;
base.RenderControl(writer);
}
</script>

You can download PostView.ascx from the site and see how it is used. All other steps are same as described in article for the control.

Download PostView.ascx (1.60 kb)

 

Views: 9148

Tags:

ASP.Net | Blog Engine

Blogengine updated to include lot of new features

by Viper 2. February 2009 19:39

I have updated BlogEngine.Net to include following new features.

  • Added ability to assign categories to pages
  • Added new widget PostCategoryList that lists pages by category.
  • Added display of pages by category very much like the way currently posts are displayed by category. The difference is that the page only displays the link to the pages and does not display any details related to the pages. You can click on those links to get to the pages.

You can see all these changes in action on this site itself. Look at bottom right of the page where Articles by Category widget is displayed. This is the new widget that I added with this update.


There were too many changes in the core and web application implementation that I did not see it practical to create a svn patch. Just to keep the whole implementation separate from what is available on BlongEngine site, I have created a fresh package with all the latest code from BlogEngine.Net repository and my changes and named it BlogEngine 1.5.1

I have added changes to SQL script in MSSQLUpgradeTo1.5.0.0From1.4.5.0.sql that is present in "setup/SqlServer" folder.

I will be making more changes to this package to include some more new features and post them here.


Download BlogEngine_1_5_1(1.55 mb)

BlogEngine 2.0

If you are looking for latest and g reatest version of customized version of BlogEngine 2.0, please Click Here.

 

Views: 91866

Tags:

Blog Engine | Blog Engine | Blog Engine | Blog Engine

Smart Phones Poll

What smart phone do you currently own?





Show Results

Month List

Powered by BlogEngine.NET 2.0.0.49
Theme by Naveen Kohli