Ning Developer Network

Phil Williams

How Can I Change The Page Titles On My Network Using JavaScript?

Hi,

On Ning Network Creators Brad replied to my post and said I can change titles of pages using JavaScript. See original thread here:

http://networkcreators.ning.com/forum/topic/show?id=492224%3ATopic%...

Could someone please advise how I can go about doing this? I'll need step by step instructions please as am not a hardcore developer like you guys :-)

Phil

Share Twitter

Reply to This

Replies to This Discussion

Yes I did but couldnt find it there. I'm trying to change the title that appears in the browser bar up the top...think I might be able to do it in the Language Editor, but not sure this will definately work for all pages...

Reply to This

Paste the code below in the 'Analytics' box of your 'Manage' page:
x$(document).ready(function() {
url = document.URL;
if (url == 'http://yoursiteurl') {
title = "Your chosen title";
x$('title').html(title);
}
});

[Replace 'yoursiteurl' and 'your chosen title' as appropriate]

Reply to This

Hi Ravi,

Thanks for this....but can you please confirm if this just changes the title after the "actual" title loads, or does it permanently change the title. i.e will google index the title I put in the javascript or the actual title?

Thanks,

Phil

Reply to This

Hi Phil,

The change will be reflected only on Javascript capable browsers. So, Google bot will not see this changed title, but only the title served from server-side.

If, for SEO purposes, you want to change the title at the server-side (assuming you have source code access), make the following change to 'widgets/index/templates/embed/header.php:
Find the line "<title><%= $title %></title>" in the above file, and change it to "<title>Your chosen title</title>". With this, 'Your chosen title' becomes visible to Google and other bots as well.

Reply to This

Yeah...my problem is I don't have source access and don't really want to get it....

I take it there's no other way around this other than to rename my whole network to the title I want to see?

Reply to This

I am also interested in altering the title bar so that it will be optimized for SEO...

It seems like this can just be done in the Network Information section of the Manage tab. However I would rather not change the name of my network to some keywords, just so that I can have them placed first in my title bar!

Anyone have any ideas?

Reply to This

Reply to This

RSS

© 2010   Created by Ning Developer Admin

Badges  |  Report an Issue  |  Privacy  |  Terms of Service