PHP
  Home arrow PHP arrow Standards-compliant Link Targets with Wordpress
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PHP

Standards-compliant Link Targets with Wordpress
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 4
    2007-12-19


    Table of Contents:
  • Standards-compliant Link Targets with Wordpress
  • Dynamically adding rel=’no follow’
  • JavaScript link targets
  • Putting it all together

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Standards-compliant Link Targets with Wordpress
    ( Page 1 of 4 )

    Wordpress is an extremely popular site blogging software written in PHP. It does a great job of creating standards-compliant web sites. Plus it’s a good idea to continue with that effort when adding modifications.

    I ran into an issue on one of my own Wordpress sites the other day, so I decided to share with you my solution.  What happened was I added an SEO modification to my site that finds all external links in my page and adds a rel=”nofollow” attribute to them.  However, I also like to target my external links to new windows, but the target attribute for the “a” tag has been depreciated and will not validate under XHTML strict.

    So I decided to combine a solution for both.  I wanted to create a PHP script that finds all links and checks the URL to see whether the destination is inbound or outbound.  If it is outbound, it adds a rel=”nofollow” attribute to the link.

    Once the page loads, a JavaScript scans for all outbound links and dynamically targets them to a new window.  This results in outbound links that open in new windows, while keeping the site both SEO friendly and standards compliant.

    For those who don’t understand the need for using the rel attribute on outbound links, this is a technique used by web masters to help preserve PageRank and increase search engine ranking.  I’ll try to explain this very briefly.

    Search engines rank pages based on a number of different criteria.  Two of these are inbound and outbound links.  As a web master, you can only control the second.  These outbound links are followed by the search engine spider, which determines how well they relate to your site.  The more closely related they are, the better your site will rank because the search engines have determined that this is more useful to end users.

    But imagine for a second that you are hosting a site about cooking and a user in your forums posts a link to a site about cars.  Now what?  A search engine robot is going to determine that this site is unrelated and may penalize your ranking!  Adding the rel attribute will instruct the robot not to, preventing any loss to your site.

    Now, this is certainly less of a concern if you do not have any publicly created content, but you’re certainly not out of the woods yet.  Perhaps you have an about page that links to your favorite band.  Or maybe you have a page that links to all of your clients.  All of these scenarios result in outbound links to sites that do not directly relate to your site’s main content.



     
     
    >>> More PHP Articles          >>> More By Nilpo
     

       

    PHP ARTICLES

    - Implementing Factory Methods in PHP 5
    - Merging a File Split for FTP Upload using PHP
    - Getting Data from Yahoo Site Explorer Inboun...
    - Method Chaining: Adding More Selecting Metho...
    - How to Split a File During an FTP Upload Usi...
    - Expanding a Custom CodeIgniter Library with ...
    - Using the Yahoo Site Explorer Inbound Links ...
    - Building a CodeIgniter Custom Library with M...
    - Building an E-mini Trading System Using PHP ...
    - Completing the MySQL Class with Method Chain...
    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek