...

View Full Version : Showing link on only one URL of a Typepad blog?



panzner
12-22-2010, 03:14 AM
I am a blogger but not a programmer. However, I have an advertiser that wants to pay me for a link that only appears on my blog "home" page (or main landing URL), but not on any of the individual blog post pages. This is the code that I got from Typepad, my blog hosting company:


<div id="displayAdDiv" style="display:none;">
<a href="http://www.advertiserwebpage.com">Advertiser</a>
</div>
<script language="javascript">
var AdDiv = document.getElementById("displayAdDiv");
if ( window.location == "http://www.bloghomepage.com/" )
{
AdDiv.style.display="block";
} else {
AdDiv.style.display="none";
}
</script>

This works as expected (i.e., the link only appears on the main page).

However, the advertiser now says that in addition to not having the link show up anywhere else but on the home page, they don't want the advertiser link page URL appearing in the source code for any other page of my blog but the home page. I'm assuming that this whole thing has something to do with SEO, but I can't say for sure.

Anyway, I'm not even sure this is possible using javascript, but I was wondering if there is a way to:

a) read or "call" the link from another file (e.g., txt, js, xml), or possibly even concatenate two or more variables on the fly so that it only shows up in the source code associated with the home page URL; and,

b) only display the link to visitors to the home page URL.

As a point of reference, the advertiser did show me how the coding was done for another blogging platform, Wordpress:


<?php if ($_SERVER["REQUEST_URI"] == "/" || $_SERVER["REQUEST_URI"] == "/index.php") { ?>

Advertising link goes here...

<?php } ?>

OR the following widget:


It is called the widget-context plugin. Go to plugins -> add new
searched for - widget context - and install it.

Again, I am not a programmer, but I get the distinct impression that this approach would not work with Typepad (because they don't use PHP and/or allow users to do things that affect code on the server side?).

Any help would be appreciated!

Old Pedant
12-22-2010, 03:47 AM
Several ways to do this, but the simplest change to what you have:


<script language="javascript">
var AdDiv = document.getElementById("displayAdDiv");
if ( window.location == "http://www.bloghomepage.com/" )
{
AdDiv.style.display="block";
} else {
AdDiv.innerHTML = ""; // remove all contents
AdDiv.style.display="none";
}
</script>


Oh, wait! That will *NOT* prevent the search engines from seeing it, because the search engines will ignore the JS!!!

You'll have to do this server-side, after all.

panzner
12-22-2010, 03:53 AM
OK, thanks anyway for trying.

Old Pedant
12-22-2010, 04:00 AM
You could hide the URL from search engines on *all* pages, but that would presumably be even worse.

panzner
12-22-2010, 04:05 AM
Yes, indeed.:rolleyes:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum