I found a javascript breadcrumb trail that will display the home page, what folder the webpage is in, and then it displays the page title to show you the page that you are currently on.
Since my page titles are defined as: Page Name – Folder – Company, I would rather that it not display that whole title. I have defined a variable instead, but that means I need to enter a custom variable on every page.
Is there a way to have javascript write the title but only before the dash?
So instead of writing Page Name – Folder – Company. It would only write what is before the first dash?
if ( typeof pageName != 'undefined') {
document.write(output + pageName);
}
else {
document.write(output + document.title);
}
You can use the
string.split()method. Then each part of the title will become its own array element.