Skip to content

Commit

Permalink
Fix Facebook href to point to Canonical URL (#123)
Browse files Browse the repository at this point in the history
* Fix Facebook href to point to Canonical URL

* Update setuptools version

* Fix changelog

* Set recommended versions of flake8 and friends

* Remove flake8 pinnings

Refs. collective/buildout.plonetest#29
  • Loading branch information
rodfersou authored and hvelarde committed Aug 2, 2017
1 parent 6411fc2 commit a834ab9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ There's a frood who really knows where his towel is.
2.10.1 (unreleased)
^^^^^^^^^^^^^^^^^^^

- Fix ``data-href`` attribute on Facebook plugin to point to canonical URL;
this should finally fix the counter on the widget.
[rodfersou]

- Fix Canonical URL updater form;
a new upgrade step is provided to update the ``objects_provides`` catalog index (fixes `#115 <https://github.com/collective/sc.social.like/issues/115>`_).
[hvelarde]
Expand Down
5 changes: 2 additions & 3 deletions sc/social/like/plugins/facebook/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,11 @@ def type(self):
return 'article'

def share_link(self):
absolute_url = self.url
params = dict(
app_id=self.app_id,
display='popup',
href=absolute_url,
redirect_uri=absolute_url,
href=self.canonical_url,
redirect_uri=self.url,
)
url = 'https://www.facebook.com/dialog/share?' + urlencode(params)
return url
6 changes: 3 additions & 3 deletions sc/social/like/plugins/facebook/templates/plugin.pt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Facebook -->
<div class="fb-like"
tal:condition="view/fbshow_like"
tal:attributes="data-href view/url;
tal:attributes="data-href view/canonical_url;
data-send string:false;
data-action view/fbaction;
data-layout view/typebutton;
Expand All @@ -12,5 +12,5 @@
<div class="fb-share-button"
tal:condition="python: view.fbshow_share and not view.fbshow_like"
tal:attributes="data-layout view/typebutton;
data-href view/url;"></div>
</tal:fb>
data-href view/canonical_url;"></div>
</tal:fb>

0 comments on commit a834ab9

Please sign in to comment.