Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support facebook SDK #410

Merged
merged 1 commit into from
Oct 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions layout/_macro/post.swig
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
</span>
{% endif %}
{% endif %}
{% if not is_index and theme.facebook_sdk.enable and theme.facebook_sdk.like_button %}
&nbsp; | &nbsp;
<div class="fb-like" data-layout="button_count" data-share="true"></div>
{% endif %}
</div>
</header>

Expand Down
5 changes: 5 additions & 0 deletions layout/_partials/head.swig
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@
sidebar: '{{ theme.sidebar }}'
};
</script>

{% if theme.facebook_sdk.enable and theme.facebook_sdk.webmaster %}
<meta property="fb:admins" content="{{ theme.facebook_sdk.fb_admin }}" />
<meta property="fb:app_id" content="{{ theme.facebook_sdk.app_id }}" />
{% endif %}
3 changes: 2 additions & 1 deletion layout/_scripts/analytics.swig
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{% include 'analytics/facebook-sdk.swig' %}
{% include 'analytics/google-analytics.swig' %}
{% include 'analytics/baidu-analytics.swig' %}
{% include 'analytics/baidu-analytics.swig' %}
19 changes: 19 additions & 0 deletions layout/_scripts/analytics/facebook-sdk.swig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% if theme.facebook_sdk.enable %}
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '{{ theme.facebook_sdk.app_id }}',
xfbml : true,
version : 'v2.5'
});
};

(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/{{ config.language|replace('-', '_') }}/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
{% endif %}