Add a Facebook like button that validates to your website

Facebook logoAdding a ‘Like’ button to your site is very easy but the code Facebook gives you doesn’t validate correctly. In this post, we show you not only how to add it with valid code but also make it load last so your visitors aren’t waiting longer than they have to for your content.

Instead of pasting the copied FB code directly into your page, use the following (stuffing your copied FB code into line 4).

If you’re not happy editing your website code, we would be happy to add this for you, simply contact us.

Many thanks to Tian Valdemar Davis for this elegant solution. He also posted a similar answer for Twitter’s tweet button.

[Update] Now outdated, see the FB dev article.

Let us know what you think in the comments. If you found this useful, please give us a like on Facebook.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.