Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Showing link on only one URL of a Typepad blog?

    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:

    Code:
    <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:

    Code:
    <?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!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,438
    Thanks
    75
    Thanked 4,372 Times in 4,337 Posts
    Several ways to do this, but the simplest change to what you have:
    Code:
    <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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK, thanks anyway for trying.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,438
    Thanks
    75
    Thanked 4,372 Times in 4,337 Posts
    You could hide the URL from search engines on *all* pages, but that would presumably be even worse.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #5
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, indeed.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •