Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Emmab21 5 posts 25 karma points
    Jul 05, 2011 @ 11:50
    Emmab21
    0

    Google +1 button

    Has anyone else had issues this adding the Google +1 button to their site?

    The template allowed me to add the required code into the head tag but not the

    <g:plusone></g:plusone> redering code. Can anyone help?

  • Rich Green 2246 posts 4008 karma points
    Jul 05, 2011 @ 11:52
    Rich Green
    0

    Hi Emma,

    Welcome to the forum!

    Umbraco doesn't change any code you put directly into a template, so this shouldn't be a problem.

    Can you confirm you're putting this into a template directly and not via a Rich Text Editor or a macro?

    Rich

  • Emmab21 5 posts 25 karma points
    Jul 05, 2011 @ 11:56
    Emmab21
    0

    Thanks :)

    I'm putting it in our footer.xslt file next to our social bookmark code.

  • Rich Green 2246 posts 4008 karma points
    Jul 05, 2011 @ 12:04
    Rich Green
    0

    Try putting it in your xslt like this:

    &lt;g:plusone&gt;&lt;/g:plusone&gt;

    Rich

  • Emmab21 5 posts 25 karma points
    Jul 05, 2011 @ 12:18
    Emmab21
    0

    No that hasn't worked, it just displays "<g:plusone></g:plusone>" in actual text rather than displaying the +1 button

  • Rich Green 2246 posts 4008 karma points
    Jul 05, 2011 @ 12:39
    Rich Green
    0

    Hey Emma,

    This is a bit long winded but it'll work

    <xsl:variable name="google"><xsl:text>&lt;g:plusone&gt;&lt;/g:plusone&gt;</xsl:text></xsl:variable>
    <xsl:value-of select="$google" disable-output-escaping="yes"/>

    Rich

  • Sebastiaan Janssen 5045 posts 15478 karma points MVP admin hq
    Jul 05, 2011 @ 12:51
    Sebastiaan Janssen
    1

    You should be able to get away with defining the namespace:

    <g:plusone xmlns:g="urn:g">
       Something here
    </g:plusone>
  • Emmab21 5 posts 25 karma points
    Jul 05, 2011 @ 12:55
    Emmab21
    0

    That has worked. Thanks very much for your help :D

  • Rich Green 2246 posts 4008 karma points
    Jul 05, 2011 @ 12:57
    Rich Green
    0

    A much nicer solution Sebastiaan :)

    @Emma The variable won't be needed so the simple solution is just to paste this into your xslt file

    <g:plusone xmlns:g="urn:g">g:plusone>

    Rich

    edit: cross post, glad you got it working

  • Emmab21 5 posts 25 karma points
    Jul 05, 2011 @ 12:58
    Emmab21
    0

    FYI <g:plusonexmlns:g="urn:g">g:plusone> didn't work, had to use the long winded version. However desired effect achieved.

  • Sebastiaan Janssen 5045 posts 15478 karma points MVP admin hq
    Jul 05, 2011 @ 13:38
    Sebastiaan Janssen
    0

    Ah well, there IS a "<" character missing in there, so that could be the reason, even shorter could work as well:

    <g:plusone xmlns:g="urn:g"/>

    If not, then surely this should work?

    <g:plusone xmlns:g="urn:g"></g:plusone>
  • Rich Green 2246 posts 4008 karma points
    Jul 05, 2011 @ 13:43
    Rich Green
    0

    Ahh, my bad it's because I edited my post and the code got messed up.

    Sebastiaans solution is the neatest by far and works a treat, but either way you have it working :)

    Rich

  • Dan Høegh 14 posts 34 karma points
    Sep 23, 2011 @ 13:36
    Dan Høegh
    0

    This worked for me:

    <xsl:text disable-output-escaping="yes"><![CDATA[<g:plusone size="medium"></g:plusone>]]></xsl:text>

Please Sign in or register to post replies

Write your reply to:

Draft