Revealed When Syndicated
Someone who syndicates content to other web sites had an interesting question:
Could a system be devised to allow some specific parts of content to be published on remote sites but not published on his own site, without requiring the creation of two different files?
This is the system we came up with.
Let's suppose your web pages have a copyright line already on your web pages. It could be redundant to publish a copyright line with your own articles on your website.
Yet, when the article is published on other sites, the copyright line should be there.
Create a CSS class name that is unlikely to be used on any of the other websites. In that class, specify a display:none rule. Example:
<style type="text/css"><!-- .unlikelytobeduuplicated { display:none; } --></style>
Now, put your copyright notice in the content on your web page at the location you want it printed when syndicated. Wrap the notice in span (or div or other) tags specifying the special class you made. Like:
<span class="unlikelytobeduuplicated"> © Bontrager 2007 </span>
The effect is that, on your website, the class hides the copyright notice. However, when the content is syndicated, the copyright notice is visible and printed where you want it. It works that way because the remote website does not have that particular class name defined.
Doing the Reverse
If your situation is the other way around, you publish content in your articles that should not be published when syndicated, like a site announcement, say, then it may be handled this way.
For an example, we'll suppose you want the word "Click here for a special announcement" to appear in the article on your website but not in the same article published on others.
Put this into your article:
<span id="unlikelyname" style="display:none;"> Click here for a special announcement. </span>
(It could be a div or other tag, instead of span.) The above will print only when certain JavaScript is run, JavaScript only on your website.
Put the JavaScript somewhere below the article and not part of the article:
<script type="text/javascript" language="JavaScript"><!-- document.getElementById("unlikelyname").style.display = "block"; //--></script>
Notice that the "unlikelyname" in the JavaScript is the same as the "unlikelyname" for the id in the span tag containing "Click here for a special announcement." They must be identical. If one "unlikelyname" is changed, both must be changed.
When the article loads on your website, the JavaScript runs. When the article loads on other websites, the JavaScript doesn't run, because it's not there.
Thus, their version of the article contains no "Click here for a special announcement."
Will Bontrager