Archive for the 'Web' Category

Highlighting External Links within WordPress

You may have seen this symbol  next to links on various pages of the Web. It denotes that the link (which is usually placed before the symbol) is an external link.

If you’ve ever wanted to differentiate internal links from external links on your blog, there is a fairly simple way of doing it, and all it requires is a few lines of text added to your stylesheet.

In this post, we’ll show you how to do it.

Why differentiate between internal and external links?

Today, most people scan, they don’t read the full text of a blog. By representing your external links visually, visitors can see - at a glance - that you’ve given them quick access to relevant and related content that is not solely on your site. This is significant because the easier you make it for your visitors; the more information you supply, the more likely they are to subscribe to your RSS feed, or return to your site next time around.

How to differentiate between internal and external links on your blog

You won’t need to change anything on your existing posts; you’ll just need to make a few small changes to your style sheet.

This change will automatically update every post you have ever written.

Step 1: Copy the ‘external’ Image File

You need to copy the image file, external.gif, to the images sub-folder within your current WordPress theme folder.

Step 2: Add ‘external’ Image to Links

To create links that appear within posts as:

Add the following to your style sheet:

a
{
  background: url(/category/web_basics/images/external.gif) no-repeat right top;
  padding-right: 12px;
}
 

The right padding value of 12 pixels ensures that the image does not overlap the text of the link.

Step 3: Differentiate Between Relative and Absolute Links

A handy feature of CSS is that you can apply a style not only to a HTML tag, but optionally based on the contents of any of the HTML tag’s attributes.

For example, to apply the above style to only those link references which contain “http:”, you modify the style sheet entries as follows:

a[href^="http:"]
{
  background: url(/category/web_basics/images/external.gif) no-repeat right top;
  padding-right: 12px;
}
 

But this is only useful, if links to other posts are relative and not absolute links. An example of a relative link is ‘<a href=”another-post”>…</a>‘; whereas, an absolute link is ‘<a href=”http://blog.example.com/another-post”>…</a>‘.

Step 4: Exclude Absolute Links to Your Blog or Web Site

Now WordPress always uses absolute links. So to ensure that any link to your own blog or Web site does not have the external image applied, you follow the above style with entries which undo this change. The entries are specific to domain name of the blog or Web site.

For BlogWell, all our links start with http://blog-well.com. You will need to replace “http://blog-well.com” in the entries below with the domain name of your blog or Web site:

a[href^="http:"]
{
  background: url(/category/web_basics/images/external.gif) no-repeat right top;
  padding-right: 12px;
}
a[href^=http://blog-well.com]
{
  background: none;
  padding-right: 0px;
} 

Step 5: Add a Class to Exclude the ‘external’ Image

Sometimes you may want some links which go outside of your blog or Web site to not have the external image applied. You can do this on a case by case basis by using a link class of ‘noexternallink’. Within your post you would write the link as:

<a class='noexternallink' href='http://example.com'>Example</a>

And the style sheet would contain:

a[href^="http:"]
{
  background: url(/category/web_basics/images/external.gif) no-repeat right top;
  padding-right: 12px;
}
a.noexternallink[href^="http:"],
a[href^=http://blog-well.com]
{
  background: none;
  padding-right: 0px;
}

Note than ‘a.noexternallink[href^="http:"]‘ and ‘a[href^="/index.html"]‘ are separated by a comma. This is very important, since it ensures that the background of none and right padding of 0 pixels are applied to both ‘a.noexternallink[href^="http:"]‘ and ‘a[href^="/index.html"]‘. If you forget the comma, then it will only be applied, should ‘a[href^="/index.html"]‘ follow a ‘a.noexternallink[href^="http:"]‘.

Step 6: Exclude ‘external’ Image from Header and Footer Items

Within BlogWell’s theme we did not want any links within the header or footer to use the external image. Our theme uses the DIV HTML tag to identify the header and footer, and use the ID values of ‘header’ and ‘footer’ for each respectively.

<div id='header'>
...
</div>
...
<div id='footer'>
...
</div>

Without having to change all the links within the header and footer to use the ‘noexternallink’ class for links, we can easily prevent any links within the header and footer DIVs by using the following:

a[href^="http:"]
{
  background: url(/category/web_basics/images/external.gif) no-repeat right top;
  padding-right: 12px;
}
#header a[href^="http:"],
#footer a[href^="http:"],
a.noexternallink[href^="http:"],
a[href^=http://blog-well.com]
{
  background: none;
  padding-right: 0px;
}

Step 7: Exclude ‘external’ Image from Sidebar Items

If you didn’t want the external image to be applied to any links within any of the sidebars, you can do the following:

a[href^="http:"]
{
  background: url(/category/web_basics/images/external.gif) no-repeat right top;
  padding-right: 12px;
}
#header a[href^="http:"],
#footer a[href^="http:"],
#sidebar a[href^="http:"],
a.noexternallink[href^="http:"],
a[href^=http://blog-well.com]
{
  background: none;
  padding-right: 0px;
}

Step 8: Include Both Normal and Secure HTTP Links

If you use Secure HTTP, then your links will start with “https:”. To handle either standard HTTP (http://) or Secure HTTP (https://), then the above style sheet entries would be:

a[href^="http:"], a[href^="https:"]
{
  background: url(/category/web_basics/images/external.gif) no-repeat right top;
  padding-right: 12px;
}
#header a[href^="http:"], #header a[href^="https:"],
#footer a[href^="http:"], #footer a[href^="https:"],
#sidebar a[href^="http:"], #sidebar a[href^="https:"],
a.noexternallink[href^="http:"], a.noexternallink[href^="https:"]
a[href^="/index.html"], a[href^=https://blog-well.com]
{
  background: none;
  padding-right: 0px;
}

Step 9: Review Padding Styles for Existing Links in Your Theme

A word or caution, as now links within the blog or Web Site will have a right padding of 0 pixels. If your theme explicitly sets the right padding for some items, then you will need to mark these settings as important which will ensure that value is used instead of the new value of 0 which is set in the above style sheet entries.

For example, BlogWell’s menu in the header, uses links which have a right padding of 20 pixels. So after adding the above entries to our theme’s style sheet, our menu appeared as:

The style entry which sets the menu’s right padding is:

#topnav ul li a
{
  padding-right: 20px;
}

CSS allows style sheet attributes to be marked as important, which means they will not be overridden by other style sheet entries. We can use the “!important” tag to ensure that the right padding of 20 pixels is used rather than it be overridden by the 0 pixel padding of our external link entries.

#topnav ul li a
{
  padding-right: 20px !important;
}

Our menu is now restored to its correct state:

Step 10: Review

To highlight external links within your blog or Web site do the following:

1) Copy external.gif to the images sub-folder of your current WordPress’ theme folder.

2) Add the following lines to your style sheet:

a[href^="http:"], a[href^="https:"]
{
  background: url(/category/web_basics/images/external.gif) no-repeat right top;
  padding-right: 12px;
}
#header a[href^="http:"], #header a[href^="https:"],
#footer a[href^="http:"], #footer a[href^="https:"],
#sidebar a[href^="http:"], #sidebar a[href^="https:"],
a.noexternallink[href^="http:"], a.noexternallink[href^="https:"]
a[href^="/index.html"], a[href^=https://blog-well.com]
{
  background: none;
  padding-right: 0px;
}

3) Review your style sheet to see if any entries explicitly set the right padding value, in which case you may need to mark them with the “!important” tag.

A Final Word on Browsers

Should the link wrap around to a new line, Mozilla Firefox will display the external image correctly, following the end of the link on the new line.

 

However, Microsoft Internet Explorer will display the external image incorrectly at the end of the first line without any margin so it overlaps the text.

 

Sphere: Related Content

Go Daddy: King of Cyber Squatting?

Last month, Go Daddy decided to try and hit us for $180 to reregister two domains that we had let lapse for several weeks. Cybersquatting at its best if you ask me, considering the usual price for registering a dot com domain at Go Daddy is $9.99.

According to the Anti-Cybersquatting Consumer Protection Act, cybersquatting, on a basic level, is using a domain name with bad-faith intent to profit.

From the ACPA report to congress ( PDF):

Registration by another person as a domain name for the purposes of profiting from the sale or transfer of the domain name

The moral of this story; pay on time and don’t let them squat your name.

Here’s what happened.

We’ve got two kids, so we thought we’d get a domain name for each. The plan was not to do anything with them until our little people are old enough to choose whether they wanted to use them.

Originally we paid Go Daddy their standard domain name registration fee (about 8 bucks a pop) and let the domains just sit.

In all fairness, when the renewal came up this year, Go Daddy sent us a reminder. Life got in the way, we forgot, no big drama.

They give you a 30 day grace period.

After the grace period had expired (by a few days), we logged into Go Daddy and tried to renew the domains - but it wasn’t an available option. We could not repurchase them, because the domain names were already in use.

According to Whois, we were listed as the domain owners.

So we contacted Go Daddy support with the ‘what gives’ question.

Their reply was that the domain names were in a 30 day redemption period and “your [credit] card will be charged 90.19(USD) per domain” to renew.

A 941% premium.

Click here if you want to read the entire e-mail.

While we admit we were remiss in not registering on time, it just doesn’t seem right.

Who would want the domain names of our children except those wanting to make a buck on it?

We ended up forgoing the original domain names and purchased new domains (that the kids chose) at $10 a year.

It just seems that the fair thing would be to put the names back into the pool of available domain names. It will be interesting to see what happens at the end of the ‘redemption period.’

Does that make Go Daddy the king of cybersquatters? It ain’t valuable until someone wants it.

Lesson: Don’t let your domain name expire.

PS. Go Daddy hosts this blog; wish us luck. ;)

Recent and Related posts on the Web about Go Daddy:

From Tom Espiner, ZD Net: Caught in the Go Daddy Red Tape

From Prof. Marc Randazza: Is Godaddy a Mass Cybersqatter?

Sphere: Related Content

Covering Structure 08 for Read Write Web

Last week I covered Structure 08 for Read Write Web:

Working the Clouds: Report from Structure 08

“In a recent report, Gartner predicted that early adopters will forgo capital expenditures, and instead purchase 40% of IT infrastructure as a service by 2011. Alistair Croll, senior analyst at Bitcurrent, and MC for the first Structure 08 conference in San Francisco, sees things differently. According to Croll it will be a lot sooner.”

Salesforce.com: Lessons from the Trenches:

“According to Harris, in the consumer world, everyone must think not only on one level, but on several. Salesforce.com thought about software, scale and the Internet; questioning what it would take to build this ‘thing’ they were thinking about.

I’d love to know what you think!

Sphere: Related Content

6 Google Shortcuts to Save You Time

Google can do more than just help you search websites. So if you can use it to save time, why not? Here are six shortcuts (aka Advanced Operators) to start you off:

1. Weather

If you want to know weather conditions for a particular city, type the word weather before the city name or zip code. For instance:

Weather San Francisco, or Weather Melbourne

2. Basic Calculator

Sometimes it is just quicker to type your query into Google than to pull out your calculator, or bring up calculator software. Use these for simple sums:

Addition: + e.g. 17 + 7

Subtraction: - e.g. 23 - 17

Division: / e.g. 23 / 17

Multiplication: * e.g. 23 * 17

Percent: % of e.g. 17% of 23

3. Measurements and Conversions

All measurements and conversions can be calculated by using the word in between various units. For instance:

Currency: - AUD, USD, EURO, GBP: e.g. 43AUD in USD

Mass - kg, lb, gram or g, tons: e.g. 25kg in lb

Numbering Systems - hex, binary, decimal, roman: e.g. LVII in decimal

Volume - gallons, liters or l, teaspoons, pints: e.g. 2 liters in pints

Time - seconds, minutes, days, years, fortnights, decades, centuries: e.g. 1 year in seconds

4. Package Tracking

Instead of going to Fedex, UPS, or USPS, you can now track your package directly through Google. Type the provider first; reference number second and Google will give you the link for your package: For instance:

Fedex 171717171717

5. Booking Flights

By typing in the departing city, followed by the arriving city, Google will offer up a choice of dates and services. For instance:

Melbourne Sydney, or, San Francisco New York.

6. Status of flights

You want to know if a flight is delayed or on time? Just type the airline name or code and a flight number to see the status of a particular flight. For instance:

Qantas 271 or United 77

For more detailed information about advanced operators, check out the Google Guide

Sphere: Related Content

What is: Digg, Reddit, Fark, StumbleUpon, Del.icio.us?

stumbleupon.jpg digg.jpg reddit.jpg fark.jpg delicious.jpg

Digg, Reddit, Fark, StumbleUpon, and Del.icio.us are only five of the many Web sites known as social bookmarking sites or social networking sites (but for Delicious, which is more about bookmarking only). They all fall under the social media umbrella.

They provide an online home for people to save stories, videos, and podcasts. Rather than fill your favorites folder to the point of overkill, use an online bookmarking tool, and have the ability to access it from any computer.

Additionally, all of these sites provide a way for you to share the stories that you love, with other people.

Anyone can visit these sites for information (they’re a great way of learning what is being talked about in the blogosphere; staying current), but if you want to submit content or vote, you usually need to become a member.

Also often referred to as folksonomy, because folks generate the taxonomy, these sites categorize Web content by using tags (specific categories). The ultimate aim of these Web sites is to make searching and navigating the Web a lot easier.

It’s a simple process. When you find something on the Internet that you love, bookmark it. Other members of the site, or the site’s community, then have the opportunity to rank it. This drives the better stories to the top of the list and pushes the shockers down, or even out.

A recent Wall Street Journal article, The Wizards of Buzz, defines social bookmarking sites as “A new kind of Web site turning ordinary people into hidden influencers, shaping what we read, watch and buy.”

If a story becomes popular it can literally drive thousands of visitors to a Web site within minutes.

The WSJ article mentions Henry Wang, a high school senior in the United States, who pointed out a site called Famster, on Digg. After getting 1,700 votes from the Digg community, Henry’s influencing power became evident; he drove Famster’s daily visitors to 50,000 within days.

Henry didn’t do too badly either; he now earns $1,000 a month from Netscape, doing what he loves best, searching the Internet for great stories in his down time. Not bad for a part time influencer.

For writers, social bookmarking sites are a brilliant starting point for research.

The information is usually topical and current, and the need to rummage around the Internet for hours is eliminated; someone else has done the work for you. All you need to do is find a bookmarking site you like, and then find the tag that best fits the information you are looking for.

So next time you’re checking out Web sites and come across one of these buttons, click it, and let the writer/producer—and the world—know you enjoyed it.

Information around the Web that may interest you about this topic

Updated: June 2008

Sphere: Related Content