One blog. Two websites
Posted in Web Design on Tuesday, 13th April 2010 at 1:53PM
Whilst developing siblify.com and msibley.com I was unsure how best to implement my blog which I wanted to be accessible from both sites. I considered having two blogs, one for art and one for web design, but I felt that the two should overlap and I wanted to find a middle ground where both topics could be discussed along with some more random thoughts when I felt like it. I was aware of the fact that duplicating content can cause problems with search engines and I felt that having two blogs with identical content may cause confusion amongst users so it was a bit of a conundrum.
I finally decided that the best solution was to host the blog on siblify.com as this was where I expected the majority of traffic to stem from and to link to it from msibley.com. Due to the fact the blog link was going to be in the main navigation, it was of prime importance that users were immediately aware of the fact they were now in a different domain and given a quick and easy method to return.
To deal with this problem I added a query string variable to the URL of the blog link to tell the landing page that the user has come from msibley.com and that a message needed to be displayed. The link was formatted as follows:
<a href="http://www.siblify.com/blog?sourcepage=msibley">blog</a>
The information after the question mark creates a new variable called sourcepage with a value of msibley which can be processed by the destination page and trigger the message. To do this I used the following piece of code at the top of the blog page:
<?php
//check if the variable sourcepage has been set
if (isset($_GET['sourcepage'])) {
//if it is, check whether it has a value of msibley
if ($_GET['sourcepage']==msibley) {
//If it does, write the message at the top of the page alerting the user
echo '<div id="uvleftmsibley"><p>You have left msibley.com to read Michael\'s blog at siblify.com - <a href="javascript:javascript:history.go(-1)">Click here to return »</a>
</p></div>';
}
}
?>
I kept the message simple but put it in red to make sure the user is immediately aware of it.
So now the user knows they have left msibley.com and has an option to return but how does the link know which web page to return the user to? Using a simple bit of javascript I’m able to redirect the user to the last page they were on. The link would look something like this:
<a href="javascript:javascript:history.go(-1)">
Now if the user visits my siblify blog from msibley.com they are alerted that they have left msibley.com and given the option to return to the page that they navigated from. Problem solved.

Add your comment