HTML trouble

Permalink 1 user found helpful
I have some trouble with some HTML blocks on my pagehttp://www.svenskproffscykling.se


For starters the FB feed code works perfectly on the front page but the same code doesn't work on subpages ashttp://svenskproffscykling.se/index.php/sociale-media...
Same problem with code to a different FB-page in the right bar onhttp://svenskproffscykling.se/index.php/blog/2017/med-cykeln-pa-fly...

I've tried experimenting with different versions of the FB code but that doesn't change anything. The code is generated via the official tool from Facebook.
<div class="fb-page" data-href="https://www.facebook.com/SvenskProffscykling/" data-tabs="timeline" data-width="500" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><blockquote cite="https://www.facebook.com/SvenskProffscykling/" class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/SvenskProffscykling/">Svensk Proffscykling</a></blockquote></div>


Same problem when I try to put in a few Google ad blocks. Simply doesn't show up on the page.

AllanHG
 
jero replied on at Permalink Best Answer Reply
jero
Your home page loads the Facebook SDK, but the others do not.

You need to add

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/sv_SE/sdk.js#xfbml=1&version=v2.10";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>


into your other pages. This should be as close to the <body> tag as possible, but after it, not before. It's probably best to add this into the header element, assuming it has the <body> tag. That way it will be on all pages. Alternatively add this in an html block and place it as close to the top of the page as you can.

You also appear to have extra <head> tags around your google syndication code.
AllanHG replied on at Permalink Reply
AllanHG
Thanks a lot! Putting that code in a HTML block in the sitewide header did the trick.

Perhaps the same thing was the problem with the Google AdSense code?
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-7354733537108668",
    enable_page_level_ads: true
  });
</script>

I put it in HTML blocks believing that this code would generate the visual ad but I assume now that might be wrong and it needs to be entered in the same way as the FB code you gave me?
jero replied on at Permalink Reply
jero
I've no idea about the google ads, but I'd suspect something else is the issue here.