Bhomiyo.com

Open the same post when clicked on Transliteration link.

Advertisements

Currently, when you click on a Transliteration link, it opens up the main blog link. I heard from one of the user that he wants to open the same post (that currently user is reading) when clicked on Transliteration link.

This is possible using a small Javascript. Here is how you do it using BlogSpot.

1) Click on Template -> Page Elements in your blogger menu. You will see following type of screen.

You should have one Page Element for Transliteration Links. Click to Edit the Element.

Enter the following Code in the Edit Window and Save Changes. And test the code. Site [http://pranjalbhatt.blogspot.com/] is used here as example, but you can use your site address.

<script language="javascript">
<!--
function xliterate(obj)
{
var href = obj.href;
var ndx = href.indexOf(".xliterate");
if (ndx > 0)
href = href.substr(0, ndx + 11);
var host = location.hostname;
var path = location.pathname;
ndx = location.pathname.indexOf(".xliterate");
if (ndx > 0)
{
host = ''
path = location.pathname.substr(ndx+11);
}
var url = href + host + path;
//alert(url);
window.open(url, "bhomiyo");
return false;
}
//-->
</script>

<a href="http://bhomiyo.com/en.xliterate/pranjalbhatt.blogspot.com&#34; onclick="xliterate(this);return false;">Roman Hindi</a>

<a onclick="xliterate(this);return false;" href="http://bhomiyo.com/gu.xliterate/pranjalbhatt.blogspot.com">Gujarati</a&gt;

When you copy above code and paste it in your editor, make sure that all the html tags are intact and in correct syntax. You can copy and paste it to NOTEPAD first and then copy from NOTEPAD and paste it into other editor to avoid any errors. Specially there is issue with the quotes when WordPress renders it. So, be careful for quotes.

If you can’t get it working – send me an email (INFO at BHOMIYO dot COM) and I will send you this code file as attachment.

Advertisements