Bookmarklets
can be pretty poweful in combination with blogging tools. They make it easy to post
to your blog or to any social bookmarking application like del.icio.us. The del.icio.us firefox extension, in fact, is the inspiration
for this section of my site. I adore the new .Net Blogging Engine tool I've
been using, so I though I'd try to make it a little easier for the others of
you out there who might be using this tool to have one-click publishing of links
you find interesting to your own .Net BE site.
First and foremost, you're going to have to get your hands a little dirty. We're
going to make a slight change to the way the "Add Entry" administration
page in BE works. The code below should be added to the end of your admin/Pages/Add_entry.aspx
codebehind. Feel free to omit the commentary if you'd like, it's in there
just so I can remember the changes I make in my own installation of BE.
/** -----------------------------------
* Author: Brady Gaster
* URL: http://www.bradygaster.com
* Date: 08/11/2007
* Description: Added
support for incoming
* posts
via the Post-to-BE bookmarklet
** ------------------------------------
if (!Page.IsPostBack
&& !Page.IsCallback)
{
if
(Request.QueryString["beScrptltTtl"]
!= null &&
Request.QueryString["beScrptltPostUrl"] !=
null)
{
string beScrptltTtl =
Request.QueryString["beScrptltTtl"];
string beScrptltPostUrl =
Request.QueryString["beScrptltPostUrl"];
txtTitle.Text =
beScrptltTtl;
txtContent.Text
= string.Format(
"<p><a href=\"{0}\" title=\"{1}\">{1}</a></p>",
beScrptltPostUrl,
beScrptltTtl
);
}
}
} // Page_Load
Once you've made this change in your own BE installation you're ready to
use the handy-dandy little Bookmarklet Builder below. To use the Bookmarklet Builder
click here.
When it opens, just change the value of the textbox with the path to your own "Add
Entry" page. When you click the button, the Post-to-BE hyperlink will be displayed.
If you're using Firefox, drag the link up to your bookmarks toolbar. If you're
using Internet Explorer, right-click the link the Bookmarklet Builder creates and
select "Add to Favorites."
Note: Either browser may prompt you that this type of link is unsafe.
You can rest assured, the link the Bookmarklet Builder is safe. It just opens a
web browser window with your own Add Entry page.
Now, you can click your new Post-to-BE bookmarklet when you're looking at something
interesting and have one-click posting functionality. Happy coding!