Custom Share Links.

  • 2
  • Question
  • Updated 9 years ago
  • Answered
Hi All,

I have custom share links on my site pages.

I wanted to know if there was a way i could copy in the code to a new page and somehow auto set the share link to that page rather than edit each one manually?

For example facebook.com/share.php?u=http://www.hexham.info/CURRENTPAGE

I hope that makes sense.

I know the page has a base href listed, could i somehow point to this?

Thanks Lee.
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes

Posted 9 years ago

  • 2
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
anyone 1 know?

Officially BUMPED - sorry. :)
Photo of Emmy

Emmy

  • 5892 Posts
  • 299 Reply Likes
Hi Lee,

Sorry, but I am not quite sure I understand :) Can you tell us a bit more and we'll try to help.

Thanks,
Emmy
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
Hi Emmy,

I use custom share links to social media sites.

Lets use facebook as an example.

If i add the code to my home page it looks like this:
facebook.com/share.php?u=http://www.hexham.info

If i want to copy that to another page the code remains the same but i want to share the new page name eg. hexham.info/business

So i have to edit the code manually to read
facebook.com/share.php?u=http://www.hexham.info/business

I want to know if there is a way to auto point it to the current page, every page has a base href but im not sure if that is the way to acheive it, just a guess.

Does that make any more sense. Maybe one of the programmers will know.

As the page is already in the code (the base href) i'm preying i can somehow auto set it to go to that - its a lot of work adding the URL of the new page everytime i add it.

Lee.
Photo of Emmy

Emmy

  • 5892 Posts
  • 299 Reply Likes
Ok, I see what you are saying. There would not be a way to auto set that in the Site Builder as there is not a feature that will automatically create data, everything needs to be manually entered into the pages.

Does that answer your question?
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
oh well,

Is there not away you can link to the base href? - Its already in the page code.

I guess i'll have to decide if its worth it or just use 1 of them 'share' things you get of the web,

Thanks - Lee.
Photo of the_pete

the_pete

  • 65 Posts
  • 16 Reply Likes
Hey Lee - there might be a way to do this with javascript. Your link could look like this...

<a href="facebook.com/share.php" onclick="window.open(this.href + "?u=" + window.location); return false;">Share</a>

There is a minor problem with this approach - if the user has javascript disabled the link will go to "facebook.com/share.php" without the "?u=yourpage". I wouldn't worry though - 99.9% of people have javascript turned on.

If you don't have any luck with this - post a copy of the code you're using and I'll try make the modifications for you.
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
<!--
Hi Pete,

Thank you so much for your reply,

That dosent seem to work on my site. It returns a 404 address.
This is my code in full.

<a class="linkopacity" title="share this site on delicious.com" href="http://del.icio.us/post?url=http://ww..." target="_blank"><img style="margin: 4px; padding: 0px;" src="resources/delicious-32x32.png?timestamp=1251473303040" alt="delicious" border="0"></a> 

<a class="linkopacity" title="Share this site on Facebook" href="http://www.facebook.com/share.php?u=h..." target="_blank"><img style="margin: 4px; padding: 0px;" src="resources/facebook-32x32.png?timestamp=1251473320004" alt="facebook" border="0"></a>

<a class="linkopacity" title="Share this site on Twitter" href="http://twitter.com/home/?status=http:..." target="_blank"><img style="margin: 4px; padding: 0px;" src="resources/twitter-32x32.png?timestamp=1251473366396" alt="twiiter" border="0"></a>

<a class="linkopacity" style="text-decoration: none;" title="digg this site" href="http://digg.com/submit?url=http://hex... style="margin: 4px; padding: 0px;" src="resources/digg-32x32.png" alt="digg it" border="0"> </a>
</p>

-->

Thanks again for your help, i know you must be a busy man.

Lee.
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
PS> If you are reading the last reply from a email please see the thread for a updated version.
Photo of Marije

Marije, Official Rep

  • 4636 Posts
  • 237 Reply Likes
Hey Lee - I've reminded Pete to come and help you and I'm sure he'll get back to you later (it's not working hours in SF yet :)
Photo of UK Duke

UK Duke, Champion

  • 3321 Posts
  • 213 Reply Likes
Thanks Marije, no problem at all - there is no rush - i'm greatful he's even trying to help.