Social Bookmarking for Umbraco Options
ferret
Posted: Wednesday, January 16, 2008 12:06:13 PM

Rank: Enthusiast

Joined: 1/10/2008
Posts: 25
Location: Nottingham, UK
The site I am working on needs a strip of Social Bookmarking buttons under each content page or news item. Does anyone have any links or recommendations?

I am tempted to have a go myself, by pulling the page URL and title from Umbraco into a template and showing the relevant icon next to it.

Thanks,

Nick

Nottingham web design and green hosting - FCS Websites
Umbraco documentation wiki - Come and join in!
tim
Posted: Wednesday, January 16, 2008 1:16:10 PM

Rank: Addict

Joined: 2/19/2007
Posts: 734
Location: Belgium
Should be an easy task, create a new xslt macro and place that on your templates

Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
sjors
Posted: Wednesday, January 16, 2008 1:29:26 PM

Rank: Fanatic

Joined: 7/20/2006
Posts: 408
Location: Amsterdam
Do you have some sourcecode for such a strip?
NeilG
Posted: Wednesday, January 16, 2008 2:16:09 PM

Rank: Aficionado

Joined: 12/15/2006
Posts: 113
Use this to generate the tool and it to your templates.

http://social.front.lv/

Neil


___________________________________________________________________________________

Neil
ferret
Posted: Wednesday, January 16, 2008 2:52:50 PM

Rank: Enthusiast

Joined: 1/10/2008
Posts: 25
Location: Nottingham, UK
Thanks for your replies guys :P

I had a look at that link Neil, but it just makes a bookmarklet for your toolbar. I am looking for something that I can put on every post or page that displays a list of bookmarking link images, then passes the current URL and page title to the bookmark service.

My code so far is:

Code:

Add to social bookmarks:

<a href=http://del.icio.us/post?v=2&url=null&title=<?UMBRACO_GETITEM field="pageName"/>>

<img src=/Images/icons/delicious.png border=0 hspace=2>

</a>


So if I pull the current URL from Umbraco, do reckon this will work? :D

ta

Nick


Nottingham web design and green hosting - FCS Websites
Umbraco documentation wiki - Come and join in!
imayat12
Posted: Thursday, January 17, 2008 12:07:12 PM

Rank: Addict

Joined: 7/19/2006
Posts: 649
Location: Preston, UK
Nick,

You could try add this you have to create an account it then gives you javascript to insert in your page. You could then add that to your master template and it will appear on all pages.

Not sure if you can configure it so that only specified elements appear. Good thing is you also get stats report to see who is tagging with what.

Regards


Ismail

Level 2 certified. If it aint broke dont fix.
ferret
Posted: Thursday, January 17, 2008 3:25:51 PM

Rank: Enthusiast

Joined: 1/10/2008
Posts: 25
Location: Nottingham, UK
Thanks Ismail, that will do the trick nicely :)

Another way of doing it I eventually settled on was:

Code:
<a href=http://digg.com/submit?phase=3&url=http://www.domain.com/<?UMBRACO_GETITEM field="pageID"/>.aspx&title=<?UMBRACO_GETITEM field="pageName" urlEncode="true"/>><img src="/Images/icons/digg.png" title="Add to Digg" alt="Digg logo"/></a>


That works, but uses the pageID as the url instead of using "niceURLs" though. How could I pull the current niceURL and insert it into the above template code for the bookmark link?

Thanks,

Nick


Nottingham web design and green hosting - FCS Websites
Umbraco documentation wiki - Come and join in!
tkahn
Posted: Tuesday, May 27, 2008 8:47:55 AM

Rank: Fanatic

Joined: 11/24/2006
Posts: 322
Location: Stockholm, Sweden
Here's an example of a tag that I use on one of my sites to enable sharing on Facebook:

Code:

<p OnClick="JavaScript:window.open('http://www.facebook.com/sharer.php?u=http://www.yoursite.com<?UMBRACO_MACRO macroAlias="GetNiceLink"></?UMBRACO_MACRO>&t=<?UMBRACO_GETITEM field="pageName"/>','ShareOnFacebook',
'left=50,top=50,width=626,height=436,location=0,status=0,menubar=0,toolbar=0,resizable=1');" style="color: #bf1562; cursor: pointer; text-decoration: underline;">Share this recipe on Facebook</p>


In the example above I have styled the p-tag to act like an a-tag for some reason. In most cases you'd want to use a regular a-tag though.

If you want to see this snippet in action, check out:

http://www.lattehemma.se/recepten/gott-till/kakor-tartor-och-bakelser
(click on any one of the recipes and scroll down on the page until you find the sentence "Dela med dig av detta recept på Facebook". It means "Share this recipe on Facebook" (in Swedish).

The macro that is embedded in this tag (GetNiceLink) corresponds to an XSLT-script that looks like this:

Code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
    xmlns:umbraco.library="urn:umbraco.library"
    exclude-result-prefixes="msxml umbraco.library">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>
<xsl:variable name="sourceUrl" select="/macro/sourceUrl"/>

<xsl:template match="/">
<xsl:choose>
<xsl:when test="$sourceUrl != ''">
    <xsl:value-of select="umbraco.library:NiceUrl($sourceUrl)"/>
</xsl:when>
<xsl:otherwise>
    <xsl:value-of select="umbraco.library:NiceUrl($currentPage/@id)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>


It's a quite simple: either it takes a macro parameter in form of a page ID (sourceUrl) and converts that into a readable URL, or it takes the ID of the current page and does the same thing with that.

One thing that I haven't been able to figure out is how to make the Facebook sharing function pick the recipe image instead of the page head image. What it does now is that it simply picks the first image that it finds on the page so I guess one way of accomplishing that would be to alter the CSS and make the recipe image appear first in the HTML-code. That can be somewhat tricky though...

/Thomas K

Web Developer at Kärnhuset - http://www.karnhuset.net - Stockholm, Sweden
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.