Comment on WordPress Image Slideshow by SEO Dave.

WordPress Slideshow My comment was from 2012, I’d forgot all about it.

I don’t know if I fixed the Subscribe to Comments Reloaded Plugin Broken Canonical URLs PHP code at the time (I modify a LOT of plugins), but right now (I still use the plugin) the canonicals are still broken. So if I did fix it I’ve long since lost the code fix.

I do recall my solution to the subscribe text links passing SEO benefit, I develop the Stallion Responsive theme code and it includes a built in javascript based link cloaking script, so I converted the “Subscribe” text link to a cloaked link which Google doesn’t see as a text links.

Users with javascript enabled see a text link which takes them to the subscribe page, but Google just sees the text “subscribe” and doesn’t pass link benefit. I also added a noindex meta tag to the output as well.

Since no link benefit flows from the Subscribe links and the pages aren’t indexed I didn’t have to worry about the broken canonical URLs. Ideally they’d be fixed by the plugin developer.

If you use Stallion Responsive and want to use the link cloaking script it’s under “Stallion SEO Theme” >> “Advanced SEO Options” : “Cloak Affiliate Links”.

When either these options are set:

Cloak Affiliate Links JS File ON
Cloak Affiliate Links Inline JS ON

You can modify the Subscribe to Comments Reloaded Plugin options like I use.

Under “StCR” >> “Comment Form” change “Messages for your visitors – Default label” to

Notify me of followup comments via e-mail. You can also <span class='affst' title='tests' id='[subscribe_link]'>subscribe</span> without commenting.

There are other links in the other options you could change, but they aren’t shown to Google so no reason to cloak them.

To add the noindex tag:

Under “StCR” >> “Management Page” change “Custom HEAD meta” to

<meta name='robots' content='noindex'>

If you aren’t a Stallion Responsive theme user the second option change will at least noindex those webpages, but you’ll still be passing link benefit through the subscribe links.

I suppose you could steal my link cloaking script, it’s this code:

It’s the content of the “/stallion-responsive/js/links.js” file:

function hasClass(e, c) {
if (typeof e === "string") e = document.getElementById(e);
var classes = e.className;
if (!classes) return false;
if (classes === c) return true;
return e.className.search("\\b" + c + "\\b") !== -1;
};
function affLnks(){
var theURL, theAnchorText, theTitle, theId;
var spans = document.getElementsByTagName('span');
for (var i = 0; i<spans.length; i++){
if (hasClass(spans[i], 'testing|affst')){
theAnchorText = spans[i].innerHTML;
theTitle = spans[i].title.toLowerCase().replace(/^\s+|\s+$/g,"");
theId = spans[i].id.replace(/^\s+|\s+$/g,"");
switch (theTitle) {
case 'tests': theURL = ''; break;
case 'tests2': theURL = 'https://stallion-theme.co.uk/go/go.php?id='; break;
case 'testing': theURL = 'https://stallion-theme.co.uk/go/go.php?id='; break;
case 'testing2': theURL = 'https://stallion-theme.co.uk/go/go.php?id='; break;
case 'outbound': theURL = 'https://stallion-theme.co.uk/go/go.php?id='; break;
case 'outboundz': theURL = 'https://stallion-theme.co.uk/go/go.php?id='; break;
default: theURL = '/#';
}
spans[i].innerHTML = '<a target="_blank" href="' + theURL + '' + theId + '" class="' + spans[i].className + '">' + theAnchorText + '</a>';
spans[i].removeAttribute('title');
}
}
}
window.onload = function(){
affLnks();
};

It basically converts the contents of a span tag with a specific CSS class to be served as a text link (the ID contents is the URL) using javascript. The list of cases are CSS classes I’ve used with a redirection link script (the /go/go.php file linked above) I use for affiliate links. You can safely delete the 5 lines with the Stallion Theme URLs: they areonly used for span tags with the relevant CSS classes like “outboundz”.

Basic usage is replace a standard text link with this code:

<span class='affst' title='tests' id='URL-HERE'>ANCHOR-TEXT-HERE</span>

When the above javascript is installed (like with Stallion Responsive) the javascript converts the span tag to a clickable link.

For advanced use (for affiliate links say) use something like this:

<span class='affst' title='outboundz' id='1'>ANCHOR-TEXT-HERE</span>

Modify the javascript “case ‘outboundz’: theURL = ‘https://stallion-theme.co.uk/go/go.php?id=’; break;” to use your script (change the script URL) and change the id=”1″ to whatever code the the script uses: the script I use uses numbers 1,2,3,4,5… The above code basically creates this link https://stallion-theme.co.uk/go/go.php?id=1 which is a WPRobot plugin affiliate link.

David Law