0

I have a link that I know is shared 162 times on facebook. but when I use facebook share link.

  <div class="fb-like" data-href="http://codem.dk/blog/artikel/item/ungdomsspiller-i-overhalingssporet-fra-droemme-til-kollaps-det-at-skifte-klub-for-tidligt/" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>

Like this its working, but show the same shared link on all my pages, if i then use

  <div class="fb-like" data-href="http://codem.dk/blog/artikel/item/{newsItem.uid}" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>

It's not working bc. its looking at artikel/item/18 bc of the ID.

How can I get the current url inside data-href="....."

Thomas BP
  • 1,187
  • 3
  • 26
  • 62

1 Answers1

0

sry I got it fix.

          <script>
            var url = document.URL;
            var html = '<div class="fb-like" data-href="'+url+'" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>';
            document.write(html);
          </script>
Thomas BP
  • 1,187
  • 3
  • 26
  • 62