Is there some way to do this? I don't see a block to work with and the links are not appearing. (I have the module configured to add the icons to every content type except webforms.) Thanks!

Comments

jvalencia’s picture

I've had no problems doing this,
What is your homepage nodetype?

m.e.’s picture

Can you tell me how to find this information in the source code? The theme I'm using is complex.

m.e.’s picture

Just a poke to see if you can help me get the info you need. Thanks.

jvalencia’s picture

The sharethis code gets all the nodes that are registered with drupal:

// Create an array of node types.
  $node_type_array = node_type_get_types();
  $node_type_options = array();
  foreach ($node_type_array as $k => $v) {
    $node_type_options[$k] = $v->name;
  }

Then it saves to the database those that the user selects in the config page.
At display time, it checks to see if the node being displayed is the same type as that saved in the DB:

if (strpos($data_options['nodeType'], $node->type) !== FALSE) {

You could output the $node->type to check why it isn't displaying on your homepage.

m.e.’s picture

Ok, my homepage type is blogpost.

In module configuration, blogpost is definitely selected as one of the node types where buttons should appear.

jvalencia’s picture

Two possible thoughts,
First do you have teaser mode enabled? and is your front page a teaser view? (If you click on the title, does it take you to a page where the buttons show up with the article?)
Second, is blogpost ajax? Because that would be a different issue altogether...

m.e.’s picture

I have no idea if blogpost is ajax ....

I don't have teaser mode enabled. I can see the links on individual articles when I click in from the teaser.

Just to be clear, I am not looking for links on front page teasers. I am looking for a way to have the links show up on my front page so that my primary URL / homepage itself can be shared independently of inner content.

jvalencia’s picture

I see,
Currently the 7x branch only adds to a node. Since your front page sounds like it contains node(s), it will try to add to those.
In that case, you might want to add the script and span tags to the front page directly: (through templates)

ie:

<span  class='st_twitter_large' ></span>
<span  class='st_facebook_large' ></span>
<span  class='st_yahoo_large' ></span>
<span  class='st_gbuzz_large' ></span>
<span  class='st_email_large' ></span>
<span  class='st_sharethis_large' ></span>

<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher:''});</script>

As time permits I am working on a block version of the module (instead of node-centric). That may eventually serve your needs better.

m.e.’s picture

Excellent - I will look forward to the block, but meanwhile I was able to perform the hack you suggested and it's working fine. Thanks!

jvalencia’s picture

Status: Active » Needs review

7.2 adds the block

robloach’s picture

Status: Needs review » Postponed (maintainer needs more info)
m.e.’s picture

I'm now using the block on most of my content. Excellent new feature! Thanks!

For my front page, I actually ended up leaving in the hack because the ShareThis icons need to display in a totally different region than on inner pages.

jvalencia’s picture

Assigned: Unassigned » robloach

You can modify the theme to have a region only on the front page which you can place the block in.

However, it looks like you might need two blocks for this? Unfortunately this is where my Drupal knowledge is deficient. Perhaps Rob knows the answer...

robloach’s picture

Maybe adding Context module support so we can put the ShareThis widget in any region depending on a given set of parameters? Not sure... What exactly did you want to accomplish?

m.e.’s picture

Context might work for that .... I haven't tried it. Right now I'm satisfied with where things stand, really.

robloach’s picture

Title: Display links on home page » Context module support
Version: 7.x-1.1 » 7.x-2.x-dev
Status: Postponed (maintainer needs more info) » Postponed

I'll set this to postponed for if someone wants Context support.

vladimiraus’s picture

Issue summary: View changes
Status: Postponed » Closed (outdated)

Issue was inactive for more than 9 years. Closing.
Feel free to reopen if you feel that it is still relevant. ⏳