I am using the node/71 as a front page node. This is a plain page node type, it's path alias is "cimlap".

I enabled the service links to show on pages. Then I realised the facebook share and any other links are wrong because they are using the http://mysite.domain/cimlap path. But, I would like to share the http://mysite.domain/ only. There are no a "/cimlap" url really.

I made a patch against 2.x-dev.

I have just tested it, I seems work in the links and links in nodes places too.

Comments

TheCrow’s picture

Status: Needs review » Fixed

Reworked the patch and committed it, thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

2pha’s picture

I had the same problem with 6.x-2.1.

I just changed
if ($settings['link_to_front']) {
to
if ($settings['link_to_front'] || drupal_is_front_page()) {

in the _service_links_get_page_url function

worked for me

TheCrow’s picture

Thanks @2pha, pushed it!

donquixote’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Closed (fixed) » Needs work

Hi,
I have the same problem on D7, and I don't see any trace of the patch in the current 7.x-2.x-dev release.
Is this committed?

Thanks!

2pha’s picture

line 801 of service_links.module

2pha’s picture

Status: Needs work » Fixed
donquixote’s picture

Status: Fixed » Needs work

Thanks for the quick reply!

_service_links_get_node_path()

  $path = "node/$node->nid";
  if (isset($node->uri)) {
    if (((object)$node->uri['path'] == $front_page) || ($path == $front_page)) {
      $path = '<front>';
    }
  }

On my site, $node->uri is empty, so this does not work.
Instead, you need this:

  $path = "node/$node->nid";
  if (
    ($path == $front_page) ||
    (isset($node->uri) && ((object)$node->uri['path'] == $front_page))
  ) {
    $path = '<front>';
  }

(linebreaks added only for readability in this post)

2pha’s picture

IC, I can't help you with that, I never had the problem when using this module.

donquixote’s picture

Ok, I hope the maintainer will see this :)

juliangb’s picture

What is the status of this issue? (I've noticed the problem too).

simon georges’s picture

Status: Needs work » Needs review
StatusFileSize
new556 bytes

Corresponding patch.
All credit goes to donquixote.

juliangb’s picture

Status: Needs review » Needs work

I tested the patch (including clearing patches), but it didn't seem to work for me:

I was testing without using any short URLs, so that I could directly see the path that was being linked to.

When I clicked the Tweet button, there was still the /node path after my domain.

In otherwords:
- Expected to see: http://www.example.com
- Actually saw: http://www.example.com/node

Please let me know if there is anything different I should be doing to test this.

simon georges’s picture

I can confirm the patch works for me with the tweet button as well.
I don't understand what could possibly be happening for you, juilangb. Would you eventually use some modules that plays with the front page (like "Front page" or similar)?

juliangb’s picture

No, I don't use any modules like that.

The front page is just a view, directly set in the site settings.

simon georges’s picture

Oh... This patch only changes the node behaviour. Let me see what could happen for Views.

simon georges’s picture

Status: Needs work » Needs review

In the meantime, as the issue is only for nodes, let's put the status back to "Needs Review".

TheCrow’s picture

Status: Needs review » Fixed

Committed, thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.