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
|
|
|
by Viper
8. February 2009 11:09
Based on the last update where I added ability to make pages in blogengine first class citizens, it became too much to list most viewed posts/pages, categories of posts and pages separately. They were taking too much vertical space in widget zone. So I decided to create new widgets that use tabbed views. See the following snapshots of most categories and recent items widgets.


These widgets are implemented using Yahoo User Interface (YUI) library. You don't have to worry about carrying these java script files on your server. You can just reference them
directly from YUI site. You can add these references in master file of your theme. See site.master file in Blues theme to see how these references were added.
Following code package contains all the updates that were done to BlogEngine since last official code release from original site.
Download Latest BlogEngine (modified) Code (~2MB))
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)
|
|
|
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)
|
|
|
by Viper
1. February 2009 09:08
Finally i got around to adding new widget to BlogEngine.Net to display most viewed posts. I also added a new field in the database to track views of pages as well. And in a day or two I will add new widget to display most viewed pages as well. Here is list of changes to the code.
- Updated be_Pages SQL table to include new column Views and two new entries be_Settings table for most viewed posts and page count.
- Updated BlogSettings.cs to include new properties NumberOfMostViewedPosts and NumberOfMostViewedPages
- Updated Page.cs file in Data provider project to include new property Views
- Updated DbBlogProvider.cs to update CRUD metods for Page to manipulate page views count
- Added new folder MostViewedPosts that contains implementation of new widget.
How to use new widget
Unzip MostViewedPosts.zip file into Widgets folder. Run sql update script to add new field and values in tables. And then apply the code patches.
Following is list of files that you will need to download to add new widget to your existing installation.
SVN Code Patch [BlogEngine_MostViews.patch]
Widget Files [MostViewedPosts.zip (2.44 kb)]
SQL UPdate Script [Sqlupdate.sql (297.00 bytes)]
|
|
|
by Viper
27. January 2009 06:16
I have modified latest version of BlogEngine.Net to record number of times a post has been viewed and then display it on the post itself. I did the following things to make this change:
I have attached SVN patch file that has the changes to latest code available from codeplex.
BlogEngine_View.patch (5.79 kb)
by Viper
14. January 2009 06:25
I was experimenting with themes that are provided with BlogEngine.Net. I liked how Fresh looked. So i decided to use it. So I hit apply and all is well and good. Now I wanted to add a blog entry. I could not find Login link on the page anywhere. And now I had noway to reset the theme that has login button. So i looked around and found the table be_Settings. There is a column in there with name SettingName which has names of all the settings and their corresponding values. There is a row with Theme setting name. Here you can alter the value of this setting to whatever theme you want. Obviously you have to have that theme on your server :-)
by Viper
25. December 2008 14:05
I was looking for a blog engine to host on our web server to start our new web site. In the past I have used one or two blog engines that did a decent job. But they were failing to keep up with the latest trends and social networking requirements. I started looking around and found link to
BlogEngine.Net. So I decided to give it a spin. Well, only thing I could say about install experience is that it was a walk in the park. After downloading the web application, followed instructions to run SQL script to install tables for blog engine, changed the connection string as set up file described and I was up and running in 5 minutes. I would definitely say that developers of this blog engine has done a decent job on this.
bc8c9a03-196b-4925-b809-58706709a93f|0|.0
Views: 3501
Tags:
Blog Engine