Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Dear people from sharthis module,
First of all, I love your module. However, there is 1 minor point that needs to be fixed. If i put the share this links, on my front page, in a block, it doesn;t share the base url (example.com) but the more extended url (example.com/node). This is not as it should be. Could you make it so that it only shares example.com, when on front page?
I have now done this dirty by changing the sharethis_block_contents() :
function sharethis_block_contents() {
if (variable_get('sharethis_location', 'content') == 'block') {
// First get all of the options for the sharethis widget from the database:
$data_options = sharethis_get_options_array();
$path = isset($_GET['q']) ? $_GET['q'] : '<front>';
if ($path == "node") $path = "<front>"; // but this only works when front page is node...
$mPath = url($path, array('absolute' => TRUE));
$mTitle = drupal_get_title();
//watchdog("debug", "<pre>data_options:".print_r($data_options, true)."path:".$path.print_r($mPath, true)."title".print_r($mTitle, true)."</pre>");
return sharethis_get_button_HTML($data_options, $mPath, $mTitle);
}
}
Comment | File | Size | Author |
---|---|---|---|
#3 | sharethis-frontpage-1536630-3.patch | 738 bytes | codesmith |
Comments
Comment #1
smitty CreditAttribution: smitty commentedFor detecting whether it's the frontpage or not we can take the variable site_frontpage. So change the line 7 in the above snippet to:
Comment #2
codesmithThis is still an issue - updating to dev.
Comment #3
codesmithHere's a patch to fix the issue.
Comment #4
Gaofengzzz CreditAttribution: Gaofengzzz commentedThank you, @GBurg and @codesmith. This patch is tested and commited in 9b6fa48.
Comment #5
Gaofengzzz CreditAttribution: Gaofengzzz commentedChange ticket status.