I just wanted something like the "share on facebook" button, but to post links on my (this) blog. I thought I would have to write a module to do that but.. no, Drupal itself allows us to do that directly :)

First, the CCK "Bookmark" Content

First of all, I created a CCK content named "bookmark". Here is the exported CCK code.

Download CCK bookmark here

Second: the "bookmark" button

Yep, I copied this from the facebook "SHARE IT" button.. :)

First, we need to enable the Prepopulate Drupal module, that allows us to prefill the forms by URL. Then, create some javascript code that could do the job

var d=document,f='http://www.example.org/node/add/bookmark-link',l=d.location,e=encodeURIComponent,p='?edit[field_url][0][url]='+e(l.href)+'&edit[title]='+e(d.title);
a=function() {
  if (!window.open(f+p,'drupalsharer','toolbar=0,status=0,resizable=1,width=626,height=436')) l.href=f+p};
  if (/Firefox/.test(navigator.userAgent))  setTimeout(a,0); else{ a()

(of course, remember to replace www.example.org with your real site URL)

Then, compress it to one-line and urlencode it. The final result will look like this:


Now, just create a bookmark in your browser pasting the above code as the bookmark URL, and the job is done!

Next step, a view to show bookmarks

I then created a view to display links. You can find it here.