edit Canonical url in IIS

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
I am using NopCommerce 3.7 with a plugin for affiliates.  The issue I am running into is Google is seeing each affiliate page as a duplicate link.  When I enable Canonical urls, the url produced is not the base url.
Examples -

Here is what I want the canonical url to be whether there is a affiliate or not.

<link rel="canonical" href="http://metest.mebulbs.com/a/cd/p1x135" />

Here is what the plugin produces if there is a affiliate-

<link rel="canonical" href="http://metest.mebulbs.com/a/joeblow/p1x135" />

Is it possible to write a rule in IIS to replace anything after the "/a/" and before the last "/" with "cd" ?

If I can do this as page is being published, Google will see the default page and ignore all the duplicate affiliate pages.
6 years ago
You might as well hardcode this in the View?
6 years ago
Which file would that be?  It's not totally a hard coded string, I need to append whatever product link browser is going to.

The /cd/ in actually defined as a default affiliate.
6 years ago
Attempting to use All in One widget to put java script in to make canonical link.

<p id="gcanonical">&nbsp;</p>
<p>
<script>// <![CDATA[
var a = window.location.href;
var b = a.split("/");
var c = b[3];
var d = '<link rel="canonical" href="http://metest.mebulbs.com/a/cd/' + c + '"/>'
alert(c);
alert(d);
document.getElementById("gcanonical").innerHTML = d;
// ]]></script>
</p>

The alerts show the proper strings in var's, but when view source is used, the finished var does not appear.

What am I missing?
6 years ago
View Source shows unprocessed source. If you want to see the DOM after JS has run, use Inspect in Chrome.

And I am not sure if Google will consider adding canonical tag using JS.



6 years ago
http://searchengineland.com/tested-googlebot-crawls-javascript-heres-learned-220157

Info on Google & js
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.