Software, your way.
burger menu icon
WillMaster

WillMaster > LibraryGenerators and Converters

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Generate Tweet and Share Links for Newsletters, Forums, Et Cetera

When you want to post a tweet or share link on a forum or publish it in your newsletters, you can. And any other relevant location available to you.

Generate the link URL with the form below and copy it. Then paste it where you want it to appear as a link.

Post the generated link in blog comments that allow URLs. (Links with rel="nofollow" work just fine. You're not looking for link juice, but to have people actually click on it.)

You can even post the link in a tweet and in Facebook entries themselves.

An amusing thought, isn't it, to tweet a link to tweet something. Or to post a Facebook entry with a link to share the post, or a link to tweet the post.

Well, let's move past the amusement.

To generate the Facebook link, you only need the URL of the web page you're sharing.

To generate the tweet link, you need the URL and, optionally, some words. The words can be the title of the page or anything else you want to say.

Pop the URL and message into the generator and out come the tweet and share links to copy and paste.

Here, give it a try:

The URL.

The message (optional).

The generator automatically truncates messages too long to fit into a tweet.

Feel free to use the generator whenever and as often as you wish.

The generator creates the URL for the share link. Many, if not most, places let you paste the generated URL in directly and the software turns it into a link. But some places, like forums when you want link text that's different than the link URL, may require special code.

If you're interested in putting the tweet and facebook link generator on your own personal portal page or on your own website, here's the code. Copy it and paste it where you will. There's nothing that needs to be modified. It's even responsive to variable widths.

<p style="margin-bottom:3px;">
The URL.
</p>
<input 
   id="link-generator-url"
   type="url" 
   style="
      font-size:1em;
      width:100%;
      max-width:600px;
      -moz-box-sizing:border-box; 
      -webkit-box-sizing:border-box; 
      box-sizing:border-box;
      border:1px solid black;
      border-radius:5px;
      padding:3px;
      ">
</p>
<p style="margin-bottom:3px;">
The message (optional).
</p>
<textarea 
   id="link-generator-message"
   style="
      font-size:1em;
      height:60px;
      width:100%;
      max-width:600px;
      -moz-box-sizing:border-box; 
      -webkit-box-sizing:border-box; 
      box-sizing:border-box;
      border:1px solid black;
      border-radius:5px;
      padding:5px;
      ">
</textarea>
</p>
<div 
   id="generated-link-container"
   style="
      display:none;
      font-size:1em;
      padding:15px;
      border:3px solid #ccc;
      border-radius:15px;">
<p style="margin-top:0;">
Click to select the generated link URLs.
</p>
<p style="margin-bottom:3px;">
Facebook:
</p>
<input 
   id="facebook-generated-link-url"
   type="text" 
   onclick="select()"
   style="
      font-size:1em;
      width:100%;
      max-width:600px;
      -moz-box-sizing:border-box; 
      -webkit-box-sizing:border-box; 
      box-sizing:border-box;
      border:1px solid #ccc;
      border-radius:5px;
      padding:3px;
      ">
<p style="margin-bottom:3px;">
Twitter:
</p>
<input 
   id="twitter-generated-link-url"
   type="text" 
   onclick="select()"
   style="
      font-size:1em;
      width:100%;
      max-width:600px;
      -moz-box-sizing:border-box; 
      -webkit-box-sizing:border-box; 
      box-sizing:border-box;
      border:1px solid #ccc;
      border-radius:5px;
      padding:3px;
      ">
</div>   
<p>
<input 
   type="button" 
   value="Generate Link URLs"
   onclick="GenerateLinkURL()"
   style="
      width:100%;
      max-width:600px;
      -moz-box-sizing:border-box; 
      -webkit-box-sizing:border-box; 
      box-sizing:border-box;
   ">
</p>
<script type="text/javascript">
/* 
   Tweet and Facebook Share Link Generator
   Version 1.0
   May 4, 2015

   Will Bontrager Software LLC
   https://www.willmaster.com/
   Copyright 2015 Will Bontrager Software LLC

   This software is provided "AS IS," without 
   any warranty of any kind, without even any 
   implied warranty such as merchantability 
   or fitness for a particular purpose.
   Will Bontrager Software LLC grants 
   you a royalty free license to use or 
   modify this software provided this 
   notice appears on all copies. 
*/
function GenerateLinkURL()
{
   var url = new String();
   url = document.getElementById("link-generator-url").value;
   var fb = new String( "https://www.facebook.com/sharer.php?u=" + encodeURIComponent(url) );
   message = document.getElementById("link-generator-message").value;
   if( message.length > 117 ) { message = message.substr(0,114) + "..."; }
   var tw = new String( "https://twitter.com/intent/tweet?text=" + encodeURIComponent(message+" "+url) );
   document.getElementById("generated-link-container").style.display = "block";
   document.getElementById("facebook-generated-link-url").value = fb;
   document.getElementById("twitter-generated-link-url").value = tw;
}
</script>

There you are, a way to generate tweet and Facebook links. You can even install the generator for yourself — if you prefer not to come to this page when you're ready to grab another URL or two.

Use the generated URLs in email, forum signatures, blog comments, even in articles or the author's resource box if you do article marketing.

These articles also address the creation and publishing of share links:

Tweet and Share Buttons Your Way shows how to automatically insert share buttons into web pages without using Twitter or Facebook's API.

Twitter and Facebook Share Links presents the URLs and their formats for manually constructing share links.

(This article first appeared in Possibilities ezine.)

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC