Add custom fields to Post

Topics: Business Logic Layer
Sep 13, 2007 at 11:13 PM
Is it at the moment possible to add custom fields to a Post? Like for example I like to add longitude and latitude fields for geo-tagging features to each post.

If not, I assume I can just start to fiddle around with the code myself to extend the Post class and add entry fields to the admin section.
Sep 14, 2007 at 9:23 AM
If you want geo tagging for individual posts, then why not just write them in the editor following the "geo" microformat. You can always set it to be invisible. See
Sep 14, 2007 at 10:19 AM
Yes, that probably would suffice for geo-tagging, but there are some other specific fields I want to add.
I'll probably see if I can create some generic way to add fields to a Post, possibly with a configuration option in the admin section.
Sep 14, 2007 at 10:36 PM
You can also run BlogEngine.NET on a .NET 3.5 server. Then you can use extension methods to extend any class you want
Oct 30, 2007 at 10:57 PM
I have developed a custom fields feature for BlogEngine.NET myself. It consists of the following changes:

- PostExt.cs
- BlogSettingsExt.cs
- XmlBlogProviderExt.cs
- MSSQLBlogProviderExt.cs

Add these files to the same folder where the original files reside. Change the original class to be a partial class, and comment out some of the duplicate functions in the original class (i.e. constructor, load, save which are now overwritten in the new file).

- Add_entry.aspx
- Add_entryExt.aspx.cs
- Settings.aspx
- SettingsExt.aspx.cs

Overwrite the ASPX files in the project with the new ones. Copy and replace the functions from the extended code-behind files into the original code-behind files.

Compile it all and when you run it you will find a new setting on the Settings page in the admin part, which allows you to add and remove custom fields. Once added you will find entry textboxes on the Add Entry page and you can write the custom fields for each blog post.
To retrieve the content of a custom field in your template use the following syntax: Post.GetCustomFieldValue("<fieldname>","<format>"), where <fieldname> is the name of the specified custom field and <format> is an optional format string if you want to format the string output of date, double or integer fields.

The described files can be found here:
Any feedback is highly appreciated. Note that I didn't test the MS SQL provider changes, so if someone could test the storing and retrieval of the custom fields that would be great.
Feb 29, 2008 at 7:33 PM
Update: this custom field functionality has now been submitted as a proper patch (patch ID 898).
Nov 27, 2011 at 6:31 AM

Check out this Post on:

How to Add a Custom Field to a Post in BlogEngine.Net

Dec 1, 2013 at 12:47 PM
Page does not work.
Is there an alternative?
Dec 1, 2013 at 1:44 PM
If you want to see the blogpost, try here.

I no longer use BlogEngine, so there might be an option in the current version to add custom fields to it.
Dec 1, 2013 at 1:53 PM
Dec 2, 2013 at 12:41 AM
Dec 2, 2013 at 3:59 AM
Thanks alot