Get rid of the same boring title on every page...

1246

Comments

  • jasoncainejasoncaine Registered Users Posts: 116 Major grins
    edited November 28, 2007
    Can I get BUMP?!

    I am using the same code as above and to no avail.
    Is this the most recent code?

    My page name stays the same ... checked in Firefox and in Safari.
  • denisegoldbergdenisegoldberg Administrators Posts: 14,369 moderator
    edited November 29, 2007
    jasoncaine wrote:
    Can I get BUMP?!

    I am using the same code as above and to no avail.
    Is this the most recent code?

    My page name stays the same ... checked in Firefox and in Safari.
    Jason -
    For some reason I wasn't able to get Gary's code to work for me either. It clearly works for him though...

    At the time I was fighting with this, I went through the entire thread and found that there were a couple of variations of the code. The javascript that worked for me is in this post (earlier in this thread) - http://www.dgrin.com/showpost.php?p=546098&postcount=76. Maybe that version will work for you too - obviously after editing to remove my title and breadcrumb start).

    --- Denise
  • jasoncainejasoncaine Registered Users Posts: 116 Major grins
    edited November 29, 2007
    Jason -
    For some reason I wasn't able to get Gary's code to work for me either. It clearly works for him though...

    At the time I was fighting with this, I went through the entire thread and found that there were a couple of variations of the code. The javascript that worked for me is in this post (earlier in this thread) - http://www.dgrin.com/showpost.php?p=546098&postcount=76. Maybe that version will work for you too - obviously after editing to remove my title and breadcrumb start).

    --- Denise

    Sweet! That did it ... all the right stuff is showing up on the headlines now.
    I think thats the good code!!
    Will all of those headlines be indexable (is that a word?!) by Google?
  • omgitsacameraomgitsacamera Registered Users Posts: 55 Big grins
    edited December 9, 2007
    I'm having problem where in a individual gallery, it always shows edit after the gallery name. Any ideas on why this could be?
  • Gary GlassGary Glass Registered Users Posts: 744 Major grins
    edited December 23, 2007
    There is, of course, no "official" version of this code, but I would like for mine to become the best-supported version (not because it's mine because it's the most recent of the various revisions -- in fact, I don't care if somebody else wants to own it). So I would like to be able to fix whatever it is that was wrong with it in your galleries. If you're game, let's set something up? Maybe you could just create a non-public gallery and dump my script into it?
  • Gary GlassGary Glass Registered Users Posts: 744 Major grins
    edited December 29, 2007
    I've added a few tweaks to the code and posted it on the wiki. Here's a link:

    http://wiki.smugmug.com/display/SmugMug/Titlebar+Customizer

    Have at it.
  • RogersDARogersDA Registered Users Posts: 3,502 Major grins
    edited January 23, 2008
    Gary Glass wrote:
    I've added a few tweaks to the code and posted it on the wiki. Here's a link:

    http://wiki.smugmug.com/display/SmugMug/Titlebar+Customizer

    Have at it.

    FYI I got this and it appears to be functioning on FF 2.0.0. I haven't looked at IE or Safari (yet).
  • xposedphotographyxposedphotography Registered Users Posts: 16 Big grins
    edited February 26, 2008
    works for me
    This morning I went back through this entire thread, clicking on galleries to see if anyone else's customization still worked. I found that most of the people who posted in this thread are back to the standard title bar with no indication of where the viewer is in the site. The only person who had a changing title bar was Mike Fried. So, I changed my customization from the one I posted in this entry - http://www.dgrin.com/showpost.php?p=544195&postcount=74 - to one that looks like Mike's. I just needed to add in some code for subcategories.
    added at 3:14PM EDT - Gary Glass's title bar also still shows the gallery name; somehow I missed it on my initial wander through the different galleries referenced in this thread.
    The code that is currently working for me:
    // On IE/FF set the title before the Document OnLoad takes place
    document.title = "from the eyes of Denise Goldberg";
    addEvent( window, "load", CustomizeTitle );
    function CustomizeTitle()
    {
        var baseTitle = "from the eyes of Denise Goldberg";
        var separator = " - ";
        var albumTitle = GetText( document.getElementById("albumTitle") );
        var galleryTitle = GetText( document.getElementById("galleryTitle") );
        var subCatTitle = GetText ( document.getElementById("subCatGalleryTitle") );
        var singleImage = document.body.className && document.body.className.indexOf("singleImage") > -1 ? true : false;
        var pageTypeDefined = typeof( pageType ) != "undefined";
        var pageTypeDetailsDefined = typeof( pageTypeDetails ) != "undefined";
    // Don't change the title from the above document.title on the homepage
        if( document.body.className && document.body.className.indexOf("homepage") > -1 )
        {
            document.title = baseTitle + separator + "Home";
            return;
        }
     
    // An album page (holds a bunch of photos, could be "zoomed in" on a specific photo)
        if( albumTitle )
        {
            var photoTitle = GetPhotoTitle();
            if( photoTitle )
                document.title = baseTitle + separator + albumTitle + separator + photoTitle;
            else
                document.title = baseTitle + separator + albumTitle;
            return;
        }
    // A gallery page (holds a bunch of albums and/or a bunch of sub categories)
        if( galleryTitle )
        {
    // Strip " sub-categories" off the end of the category text
            var finalPositionCategory = galleryTitle.indexOf(" sub-categories");
            if( finalPositionCategory > -1 )
                galleryTitle = galleryTitle.substr( 0, finalPositionCategory );
            else
                {
    // Strip " galleries" off the end of the category/sub-category text
                  var finalPositionSubCategory = galleryTitle.indexOf(" galleries");
                  if( finalPositionSubCategory > -1 )
              galleryTitle = galleryTitle.substr( 0, finalPositionSubCategory );
                 }
     
                document.title = baseTitle + separator + galleryTitle;
        return;
        }
    // Pick up sub-category
        if( subCatTitle )
        {
    // Strip " sub-categories" off the end of the category text
            var finalPositionCategory = subCatTitle.indexOf(" sub-categories");
            if( finalPositionCategory > -1 )
                galleryTitle = subCatTitle.substr( 0, finalPositionCategory );
            else
                {
    // Strip " galleries" off the end of the category/sub-category text
                  var finalPositionSubCategory = subCatTitle.indexOf(" galleries");
                  if( finalPositionSubCategory > -1 )
              galleryTitle = subCatTitle.substr( 0, finalPositionSubCategory );
                 }
     
                document.title = baseTitle + separator + galleryTitle;
        return;
        }
     
    // A single image (like the kind you get when you click an image in a keyword page)
        if( singleImage )
            {
     var photoTitle = GetPhotoTitle();
     if( photoTitle )
                document.title = baseTitle + separator + photoTitle;
     else
         document.title = baseTitle + separator + "untitled photo";
     return;
     }
    // A single keyword page
        if( pageTypeDefined && pageType == 'Keyword' && pageTypeDetailsDefined )
     {
    // Keyword page
                 document.title = baseTitle + separator + "Keyword: " + pageTypeDetails;
         return;
     }
    // A multiple keyword page
        if( pageTypeDefined && pageType == 'Keywords' && pageTypeDetailsDefined )
     {
    // Multiple keywords page
    // Put " + " between each keyword instead of -
                 var keywordList = pageTypeDetails;
         keywordList = keywordList.replace(/\-/g, " + ");
         document.title = baseTitle + separator + "Keywords: " + keywordList;
         return;
     }
    // The main keywords page. Note: single image takes precedence over this type
        if( document.body.className && document.body.className.indexOf("keywordPage") > -1 )
            {
    // Main Keywords Page
                document.title = baseTitle + separator + "Keywords";
                return;
     }
    // None of the rules above set the title! Oh well, fall back on the base title.
        document.title = baseTitle;
    } // CustomizeTitle
    function Trim( text )
    {
        text = text.replace(/(^\s+)|(\s+$)/g, ""); // trim leading and trailing white space
        return text;
    } // Trim
    function GetText( node )
    {
        if( !node )
            return "";
        if( node.innerText )
            return Trim( node.innerText ); // For IE
        if( node.textContent )
            return Trim( node.textContent ); // For others
        return "";
    } // GetText
    function GetPhotoTitle()
    {
    // If the photo title is set, it starts with the breadcrumb.
        var breadCrumbStart = "Denise Goldberg > ";
        var mainPhoto = document.getElementById("mainPhoto");
        if( !mainPhoto || !mainPhoto.title || mainPhoto.title.indexOf( breadCrumbStart ) != 0 )
     return "";
        return Trim( mainPhoto.title.substr( breadCrumbStart.length ) );
    } // GetPhotoTitle
    

    I'd love to know why my previous code (basically copied from devbobo's entry) stopped working. But for now I guess I just have to accept reality...

    --- Denise

    If anyone is still wondering about this, the code above worked fine for me. I simply placed the code in javascript, changed the titles, and that's it. Pretty good for cut and pasters like myself!
  • davidweaverdavidweaver Registered Users Posts: 681 Major grins
    edited February 27, 2008
    Bump.

    Can't get it to work. Using the Dummies version.

    Could we get a "what parts go where" in the wiki please?
  • denisegoldbergdenisegoldberg Administrators Posts: 14,369 moderator
    edited February 27, 2008
    Bump.

    Can't get it to work. Using the Dummies version.

    Could we get a "what parts go where" in the wiki please?
    David -
    The code all goes in your javascript box.

    --- Denise
  • Gary GlassGary Glass Registered Users Posts: 744 Major grins
    edited February 28, 2008
    You also have to have a call to ContextualizeTitle() somewhere. I would update the wiki with a "how to" but now when I log in I go to a page that says "You are not permitted to perform this operation." Anybody else have this trouble?
  • AsafAsaf Registered Users Posts: 8 Beginner grinner
    edited May 26, 2008
    Very cool, it mostly worked. It does recognize my Galleries page as Home though since it was created as a copy of the homepage. What's the best way to detect that and swap the name to Galleries? Can I just detect the .galleries class?

    Site is: http://asaf.smugmug.com
  • rfreschnerrfreschner Registered Users Posts: 58 Big grins
    edited October 26, 2008
    Gary Glass wrote:
    You also have to have a call to ContextualizeTitle() somewhere. I would update the wiki with a "how to" but now when I log in I go to a page that says "You are not permitted to perform this operation." Anybody else have this trouble?

    Gary - it doesn't look like you ever got a chance to update this as the Wiki was last updated a couple of months before this post. Where do you need to add this call? TIA.
  • rfreschnerrfreschner Registered Users Posts: 58 Big grins
    edited October 26, 2008
    rfreschner wrote:
    Gary - it doesn't look like you ever got a chance to update this as the Wiki was last updated a couple of months before this post. Where do you need to add this call? TIA.

    Never mind Gary. I found that it needs to go in the Footer Javascript (at least that's where it works for me). Thanks a lot for putting this code out there. thumb.gif
  • digitalpinsdigitalpins Registered Users Posts: 448 Major grins
    edited December 11, 2008
    Hello everyone I would like to do this but I am really lost and confused after reading all the post here I dont know what to do or what goes where or what code to use..

    My website is http://digitalpins.smugmug.com/ if any of you can help and tell me what to remove or what to past where that would be greatly appreciated.
    www.lamontphotography.com
    Canon 60D
    Canon Rebel XTi (400)
    Canon 10-22mm, Canon 50mm f/1.8 II
    MacBook, MacPro
  • digitalpinsdigitalpins Registered Users Posts: 448 Major grins
    edited December 11, 2008
    I just discovered this which is weird if I search for my website lamontphotography in google I get it looking the way below

    434739528_rmRVE-M.png



    And then if I search for www.digitalpins.smugmug.com in google I get it looking the way I want

    434739566_hLyge-M.png

    Why for my custom domain when I search for my website in google the description is all wrong..... and how can how can I take out that smugmug description text below my name and replace it with my own description text

    Again if anyone can help its greatly appreciated..
    www.lamontphotography.com
    Canon 60D
    Canon Rebel XTi (400)
    Canon 10-22mm, Canon 50mm f/1.8 II
    MacBook, MacPro
  • denisegoldbergdenisegoldberg Administrators Posts: 14,369 moderator
    edited December 14, 2008
    I just discovered this which is weird if I search for my website lamontphotography in google I get it looking the way below...

    And then if I search for www.digitalpins.smugmug.com in google I get it looking the way I want

    Why for my custom domain when I search for my website in google the description is all wrong..... and how can how can I take out that smugmug description text below my name and replace it with my own description text.
    I can't answer why your two urls show different text.

    But - the text in google's search results comes from your bio box. Scroll down to "Gotcha" in the Flash slideshow help for information on how to make your search results look better - http://wiki.smugmug.net/display/SmugMug/Flash+Slideshow.

    --- Denise
  • digitalpinsdigitalpins Registered Users Posts: 448 Major grins
    edited December 15, 2008
    I can't answer why your two urls show different text.

    But - the text in google's search results comes from your bio box. Scroll down to "Gotcha" in the Flash slideshow help for information on how to make your search results look better - http://wiki.smugmug.net/display/SmugMug/Flash+Slideshow.

    --- Denise

    Ok thanks denise I tried different things this weekend and I still cant figure out why my two urls show different text.....

    but thanks for the "Gotcha" info I will fix that little part for now...

    Thank you
    Ryan
    www.lamontphotography.com
    Canon 60D
    Canon Rebel XTi (400)
    Canon 10-22mm, Canon 50mm f/1.8 II
    MacBook, MacPro
  • photolordphotolord Registered Users Posts: 43 Big grins
    edited December 18, 2008
    Tweaking Titlebar Code Even More
    clap.gif

    I saw this awesome work on SmugMug's Titlebar customization. I had 3 questions.

    1. Is it possible to come up with code that would reverse the order of the Main site title with the gallery title with the hidden powered by SmugMug part at the end? Example:

    White Water Rafting: Matt George Photography (Hidden - powered by SmugMug)

    Having the gallery title at the beginning of the title tag will give it more SEO relevance in Google. I mention the hidden - powered by SmugMug title because even though it is hidden when browsing, it will still come up in Google's index and for this reason it's best to stay at the end for less SEO competition with the main title keywords.

    2. Is it possible to switch out the main site title with a generic user created keyword term? Instead of Matt George Photography, use photos instead.
    Example:

    White Water Rafting: Photos (Hidden - powered by SmugMug)

    3. Is it possible to completely eradicate the main site title from a gallery and category page title tags? Example:

    White Water Rafting (Hidden - powered by SmugMug)


    Thanks everyone for your work on this awesome alternative to SmugMug's default titlebar system.
    Best regards,

    Matt George
  • Gary GlassGary Glass Registered Users Posts: 744 Major grins
    edited December 19, 2008
    Good ideas. Can be done. If I get some time, I'll work on it this weekend.
  • Gary GlassGary Glass Registered Users Posts: 744 Major grins
    edited December 20, 2008
    Well it ended up being a substantial rewrite. But it's a lot easier to follow now. Here we go:
    /*
    --------------------------------------------------
    	customize page title settings
    --------------------------------------------------
    */
    var titleSettings = {
    	separator    : ": ",    // Text to insert between parts of title.
    	maxLength    : -1,      // Limits length of title (-1 == no limit).
    	doPhotos     : true,    // true == append photo captions
    	doAlbums     : true,    // true == append album names
    	doGalleries  : true,    // true == append gallery names
    	stripSmugmug : true,    // true == remove " - powered by SmugMug" from title bar text
    	inverse      : false,   // true == reverse order of home/gallery/album/photo
    	siteTitle    : null     // null == use normal site title. "" == suppress site title. "Any Value" == replaces normal site title.
    };
    
    function ContextualizeTitle ()
    {
    	var pieces = new TitlePieces();
    	var newTitle = "";
    	if (titleSettings.inverse)
    	{
    		newTitle = MakeTitleBackward();
    	}
    	else
    	{
    		newTitle = MakeTitleForward();
    	}
    	if (titleSettings.maxLength > -1)
    	{
    		newTitle = newTitle.substr(0, titleSettings.maxLength);
    	}
    	if (titleSettings.stripSmugmug == false)
    	{
    		newTitle += " - powered by SmugMug";
    	}
    	document.title = newTitle;
    	
    	// METHODS
    	
    	function MakeTitleBackward ()
    	{
    		var title = "";
    		title += pieces.Photo
    		if (title.length > 0
    			&& pieces.Album.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Album;
    		if (title.length > 0
    			&& pieces.Gallery.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Gallery;
    		if (title.length > 0
    			&& pieces.Main.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Main;
    		return title;
    	}
    	
    	function MakeTitleForward ()
    	{
    		var title = "";
    		title += pieces.Main;
    		if (title.length > 0
    			&& pieces.Gallery.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Gallery;
    		if (title.length > 0
    			&& pieces.Album.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Album;
    		if (title.length > 0
    			&& pieces.Photo.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Photo
    		return title;
    	}
    	
    	// CLASSES
    	
    	function TitlePieces ()
    	{
    		this.Main = GetMainTitle();
    		this.Gallery = GetGalleryTitle();
    		this.Album = GetAlbumTitle();
    		this.Photo = GetPhotoTitle();
    	    
    		function GetMainTitle ()
    		{
    			var value = titleSettings.siteTitle;
    			if (value == null)
    			{
    				var index = document.title.indexOf("- powered by SmugMug");
    				value = document.title.substr(0, index);
    			}
    			return value;
    		}
    		 
    		function GetGalleryTitle ()
    		{
    			var value = "";
    			if (titleSettings.doGalleries)
    			{
    				var element = document.getElementById("galleryTitle");
    				if (element)
    				{
    					value = GetTextContent(element);
    					if (value.length > 0)
    					{
    						 // remove " galleries" from title
    						var index = value.indexOf(" galleries");
    						if (index > -1)
    						{
    							value = value.substr(0, index);
    						}
    					}
    				}
    			}
    			return value;
    		}
    		
    		function GetAlbumTitle ()
    		{
    			var value = "";
    			if (titleSettings.doAlbums)
    			{
    				var element = document.getElementById("albumTitle");
    				if (element)
    				{
    					value = GetTextContent(element);
    				}
    			}
    			return value;
    		}
    		
    		function GetPhotoTitle ()
    		{
    			var value = "";
    			if (titleSettings.doPhotos)
    			{
    				var element = document.getElementById("caption_bottom");
    				if (!element)
    				{
    					element = document.getElementById("caption_top");
    				}
    				if (element)
    				{
    					value = GetTextContent(element);
    				}
    			}
    			return value;
    		}
    		
    	}
    	
    }
    
  • photolordphotolord Registered Users Posts: 43 Big grins
    edited December 21, 2008
    New Code not Working
    I tried implementing the new code and it doesn't seem to work. I'm using it in conjunction of



    All I get is my site title throughout my website.

    Any ideas what the problem is? And does it work on your site?

    Thanks everyone for all of your hard work towards this awesome project.
    Best regards,

    Matt George
  • Gary GlassGary Glass Registered Users Posts: 744 Major grins
    edited December 22, 2008
    Yes, it is working on my site. There is a setting you have to make on your site customization. It's been so long since I did it -- but I think maybe it's that you have to set a custom title (on the site wide customizations page). If you go back thru this thread you'll see somebody mentions it.
  • digitalpinsdigitalpins Registered Users Posts: 448 Major grins
    edited December 22, 2008
    Gary Glass wrote:
    Well it ended up being a substantial rewrite. But it's a lot easier to follow now. Here we go:


    Thanks so much that is working and fixed all the problems I had clap.gifwings.gifclap.gif
    www.lamontphotography.com
    Canon 60D
    Canon Rebel XTi (400)
    Canon 10-22mm, Canon 50mm f/1.8 II
    MacBook, MacPro
  • kkrasinkkrasin Registered Users Posts: 61 Big grins
    edited December 23, 2008
    photolord wrote:
    I tried implementing the new code and it doesn't seem to work. I'm using it in conjunction of

    <body onload="ContextualizeTitle();">

    All I get is my site title throughout my website.

    Any ideas what the problem is? And does it work on your site?

    Thanks everyone for all of your hard work towards this awesome project.

    I'm having the same problem. How did you fix this? Thanks!
  • photolordphotolord Registered Users Posts: 43 Big grins
    edited December 25, 2008
    This code worked for me - Titlebar Customization
    kkrasin wrote:
    I'm having the same problem. How did you fix this? Thanks!

    Unfortunately, I wasn't able to use the new code. Very sad indeed. I had to use the code from the wiki page in the top JavaScript portion of my site-wide customization page.

    Here is where the code is:
    http://wiki.smugmug.net/display/SmugMug/Titlebar+Customizer

    Then I put this code below on the Body Tag space on the site-wide customization page.
    body onload="ContextualizeTitle();"
    

    You will need to add < and > to the code above. < goes in front of the body onload code and this arrow > goes at the end of the body onload code. There are no spaces when you put the arrows in the code.

    Let me know if this works for you.
    Best regards,

    Matt George
  • Gary GlassGary Glass Registered Users Posts: 744 Major grins
    edited December 25, 2008
    I suspect I know what the problem is. I'm guessing you guys may have copied the new code I posted over the entire code in the previous version. I had only rewritten the Contextualize title class itself. I didn't change any of the little helper methods it relies on and I didn't re-post them. So if you replaced the previous version in its entirety with just the new class code, the new class won't work because it won't be able to find the helper methods. I'm re-posting here the entire thing. And I'm marking the utility methods especially. I'll also update the wiki.
    /*
    --------------------------------------------------
    	ContextualizeTitle Settings
    --------------------------------------------------
    */
    var titleSettings = {
    	separator    : ": ",    // Text to insert between parts of title.
    	maxLength    : -1,      // Limits length of title (-1 == no limit).
    	doPhotos     : true,    // true == append photo captions
    	doAlbums     : true,    // true == append album names
    	doGalleries  : true,    // true == append gallery names
    	stripSmugmug : true,    // true == remove " - powered by SmugMug" from title bar text
    	inverse      : false,   // true == reverse order of home/gallery/album/photo
    	siteTitle    : null     // null == use normal site title. "" == suppress site title. "Any Value" == replaces normal site title.
    };
    
    /*
    --------------------------------------------------
    	ContextualizeTitle Class
    --------------------------------------------------
    */
    function ContextualizeTitle ()
    {
    	var pieces = new TitlePieces();
    	var newTitle = "";
    	if (titleSettings.inverse)
    	{
    		newTitle = MakeTitleBackward();
    	}
    	else
    	{
    		newTitle = MakeTitleForward();
    	}
    	if (titleSettings.maxLength > -1)
    	{
    		newTitle = newTitle.substr(0, titleSettings.maxLength);
    	}
    	if (titleSettings.stripSmugmug == false)
    	{
    		newTitle += " - powered by SmugMug";
    	}
    	document.title = newTitle;
    
    	// METHODS
    
    	function MakeTitleBackward ()
    	{
    		var title = "";
    		title += pieces.Photo
    		if (title.length > 0
    			&& pieces.Album.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Album;
    		if (title.length > 0
    			&& pieces.Gallery.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Gallery;
    		if (title.length > 0
    			&& pieces.Main.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Main;
    		return title;
    	}
    
    	function MakeTitleForward ()
    	{
    		var title = "";
    		title += pieces.Main;
    		if (title.length > 0
    			&& pieces.Gallery.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Gallery;
    		if (title.length > 0
    			&& pieces.Album.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Album;
    		if (title.length > 0
    			&& pieces.Photo.length > 0)
    		{
    			title += titleSettings.separator;
    		}
    		title += pieces.Photo
    		return title;
    	}
    
    	// CLASSES
    
    	function TitlePieces ()
    	{
    		this.Main = GetMainTitle();
    		this.Gallery = GetGalleryTitle();
    		this.Album = GetAlbumTitle();
    		this.Photo = GetPhotoTitle();
    
    		function GetMainTitle ()
    		{
    			var value = titleSettings.siteTitle;
    			if (value == null)
    			{
    				var index = document.title.indexOf("- powered by SmugMug");
    				value = document.title.substr(0, index);
    			}
    			return value;
    		}
    
    		function GetGalleryTitle ()
    		{
    			var value = "";
    			if (titleSettings.doGalleries)
    			{
    				var element = document.getElementById("galleryTitle");
    				if (element)
    				{
    					value = GetTextContent(element);
    					if (value.length > 0)
    					{
    						 // remove " galleries" from title
    						var index = value.indexOf(" galleries");
    						if (index > -1)
    						{
    							value = value.substr(0, index);
    						}
    					}
    				}
    			}
    			return value;
    		}
    
    		function GetAlbumTitle ()
    		{
    			var value = "";
    			if (titleSettings.doAlbums)
    			{
    				var element = document.getElementById("albumTitle");
    				if (element)
    				{
    					value = GetTextContent(element);
    				}
    			}
    			return value;
    		}
    
    		function GetPhotoTitle ()
    		{
    			var value = "";
    			if (titleSettings.doPhotos)
    			{
    				var element = document.getElementById("caption_bottom");
    				if (!element)
    				{
    					element = document.getElementById("caption_top");
    				}
    				if (element)
    				{
    					value = GetTextContent(element);
    				}
    			}
    			return value;
    		}
    
    	}
    
    } // end of ContextualTitle class
    
    /*
    --------------------------------------------------
    	Utility Methods
    --------------------------------------------------
    */
    
    function GetPhotoCaption()
    {
    	var caption = "";
    	var photoTitle = document.getElementById("caption_bottom");
    	if(!photoTitle)
    	{
    		photoTitle = document.getElementById("caption_top");
    	}
    	if(photoTitle)
    	{
    		caption = GetTextContent(photoTitle);
    	}
    	return caption;
    }
    
    function GetTextContent(node)
    {
    	var text = "";
    	if(node)
    	{
    		if(node.children)
    		{
    			text = GetTextContent(node.firstChild);
    		}
    		else
    		{
    			if(node.nodeValue)
    			{
    				text = node.nodeValue; // IE
    			}
    			else
    			{
    				text = node.textContent; // mozilla
    			}
    		}
    	}
    	text = Trim(text);
    	return text;
    }
    
    function Trim(text)
    {
    	var regexp = /^\s+|\s+$/g;
    	text = text.replace(regexp, "");
    	return text;
    }
    
    function IsHomePage()
    {
    	var isHomePage = false;
    	// test for the "homepage" class name in the <BODY> tag
    	var classStr = document.body.className;
    	if (classStr && (classStr.indexOf("homepage") != -1))
    	{
    		isHomePage = true;
    	}
    	return isHomePage;
    }
    
  • kkrasinkkrasin Registered Users Posts: 61 Big grins
    edited December 26, 2008
    Gary Glass wrote:
    I suspect I know what the problem is. I'm guessing you guys may have copied the new code I posted over the entire code in the previous version. I had only rewritten the Contextualize title class itself. I didn't change any of the little helper methods it relies on and I didn't re-post them. So if you replaced the previous version in its entirety with just the new class code, the new class won't work because it won't be able to find the helper methods. I'm re-posting here the entire thing.

    That did it! Thank you!
  • BuffaloInFlamesBuffaloInFlames Registered Users Posts: 10 Big grins
    edited December 31, 2008
    kkrasin wrote:
    That did it! Thank you!

    Perfect! Thanks!
  • CharlesSACharlesSA Registered Users Posts: 63 Big grins
    edited January 5, 2009
    I hope someone here can help me.

    I have used the latest code in this post to customize my Page Titles. All is working fine, but I still want to achieve the following:
    • Change the name of my landing page from "Galleries" to "Home". My landing page (where bio info is) seems to be called "Galleries". I want this changed I do not know how??
    • Lastly, I want to reverse the order of my Page title by FIRST showing the "page name" followed by "page title text"
      • e.g. Go from: "PageTitleText: Packages" TO "Packages: PageTitleText" See example of someone else that achieved this HERE
    Please can someone help with this as I am not experienced with CSS and HTML.

    Thanks

    My website is HERE
    My website: HERE
Sign In or Register to comment.