Options

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

12346»

Comments

  • Options
    Got Grins?Got Grins? Registered Users Posts: 79 Big grins
    edited May 27, 2012
    Could someone please help me do this for my site. I am just starting out with the whole SEO thing and know I have a LONG way to go!!! Here is what I would like it to say

    <script language="javascript">document.title="Got Grins Photography - Lakeland, FL Premiere Children's, Teen and Senior Portrait Photgrapher"</script>

    I tried to put that in and it wouldnt let me. Thanks!

    www.GotGrins.com
    Got Grins? :D
    www.gotgrins.com
  • Options
    AndyAndy Registered Users Posts: 50,016 Major grins
    edited May 27, 2012
    You don't need this technique any more. Just use NiceNames for your Galleries and Categories and we do it automagically for you.
  • Options
    Got Grins?Got Grins? Registered Users Posts: 79 Big grins
    edited May 27, 2012
    I am starting WAY at the beginning. I was just reading about keywords and BEGAN to add them.... I need to see examples of steps for SEO. It there a post that does that. Like a step by step of importance:

    examples of a good caption (should they all be different?)
    I think I found keyword examples
    then this started with a good header title? I dont need that?
    What is a nicename for a gallery? Ive never even hear of that!!

    UGH! I am sorry!!!
    Got Grins? :D
    www.gotgrins.com
  • Options
    AllenAllen Registered Users Posts: 10,011 Major grins
    edited May 27, 2012
    Andy wrote: »
    You don't need this technique any more. Just use NiceNames for your Galleries and Categories and we do it automagically for you.
    I have to disagree, the length limit of niceNames severely limits this. You couldn't get remotely close to what he wants.
    title="Got Grins Photography - Lakeland, FL Premiere Children's, Teen and Senior Portrait Photgrapher"
    Al - Just a volunteer here having fun
    My Website index | My Blog
  • Options
    Got Grins?Got Grins? Registered Users Posts: 79 Big grins
    edited May 27, 2012
    Could you please go to this page: http://gotgrins.smugmug.com/gallery/23200203_frfPj8#!i=1870107071&k=MNkfMgZ and look at my nicename etc and tell me why the url looks like that and not the way I want it to?? Im totally confused!

    THANK YOU :)
    Got Grins? :D
    www.gotgrins.com
  • Options
    jfriendjfriend Registered Users Posts: 8,097 Major grins
    edited May 27, 2012
    Got Grins? wrote: »
    Could you please go to this page: http://gotgrins.smugmug.com/gallery/23200203_frfPj8#!i=1870107071&k=MNkfMgZ and look at my nicename etc and tell me why the url looks like that and not the way I want it to?? Im totally confused!

    THANK YOU :)
    This is the nicename URL for that gallery: http://www.gotgrins.com/LakelandFL-1/Senior-Portrait-Photographer/Senior-Portraits/23200203_frfPj8. I don't know where you got that other URL, but you should put the better one in your navbar instead of the one you have.

    You could further clean up the URL by removing the subcategory (in gallery settings) and only using a category since you aren't actually showing the category/sub-category hierarchy on your site.
    --John
    HomepagePopular
    JFriend's javascript customizationsSecrets for getting fast answers on Dgrin
    Always include a link to your site when posting a question
  • Options
    AllenAllen Registered Users Posts: 10,011 Major grins
    edited May 27, 2012
    Got Grins? wrote: »
    Could you please go to this page: http://gotgrins.smugmug.com/gallery/23200203_frfPj8#!i=1870107071&k=MNkfMgZ and look at my nicename etc and tell me why the url looks like that and not the way I want it to?? Im totally confused!

    THANK YOU :)
    You used /gallery/ in the link in your nav.
    <li><a href="/gallery/23200203_frfPj8">Seniors</a></li>

    Change the link to this
    <li><a href="/LakelandFL-1/Senior-Portrait-Photographer/Senior-Portraits/23200203_frfPj8">Seniors</a></li>

    /gallery/ is normally used to hide the path for info type unlisted galleries.
    Al - Just a volunteer here having fun
    My Website index | My Blog
  • Options
    mountaindewmountaindew Registered Users Posts: 58 Big grins
    edited July 5, 2013
    Gary Glass wrote: »
    Thanks for the bug check! I took the opportunity to make some more substantive changes to the code. I didn't like what it did on the home page, so I took it out. The home page now gets its default title. Photo pages show the gallery title followed by the photo title. Here's the new version:
    function ContextualizeTitle() {
    	var separator = " : ";
    	var smugmugSuffix = " - powered by smugmug";
    	var insertAt = document.title.indexOf(smugmugSuffix);
    	var newTitle = document.title;
    	var newText = null;
    	if(!IsHomePage()) {
    		// add photo title
    		var photoTitleText = GetPhotoCaption();
    		if(photoTitleText.length > 0) {
    			newText = separator + photoTitleText;
    			newTitle = InsertString(newTitle, newText, insertAt);
    		}
    		// add album title
    		var albumTitle = document.getElementById("albumTitle");
    		if(albumTitle) {
    			var albumTitleText = GetTextContent(albumTitle);
    			if(albumTitleText.length > 0) {
    				newText = separator + albumTitleText;
    				newTitle = InsertString(newTitle, newText, insertAt);
    			}
    		} else {
    			// add gallery title
    			var galleryTitle = document.getElementById("galleryTitle");
    			if(galleryTitle) {
    				var galleryTitleText = GetTextContent(galleryTitle);
    				if(galleryTitleText.length > 0) {
    					var index = galleryTitleText.indexOf(" galleries");
    					if(index > -1) {
    						galleryTitleText = galleryTitleText.substr(0, index);
    					}
    					newText = separator + galleryTitleText;
    					newTitle = InsertString(newTitle, newText, insertAt);
    				}
    			}
    		}
    		document.title = newTitle;
    	}
    }
    
    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 InsertString(text, insertText, index) {
    	var newText = text.substring(0, index) + insertText + text.substring(index);
    	return newText;
    }
    
    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;
    }
    

    Awesome Garry Glass and MikeFriend . This is perfectly working for my website now :-) Thanks !
Sign In or Register to comment.