Rank: Member
Joined: 2/3/2007(UTC) Posts: 100
|
Here's an example title tag from the live site <title> this is title </title>
I want it to look like <title>this is title</title>
I found a script that would remove the white space after <title> and before </title> Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Dim stringWriter As New System.IO.StringWriter() Dim htmlWriter As New HtmlTextWriter(stringWriter) MyBase.Render(htmlWriter) Dim html As String = stringWriter.ToString() Dim t1 As Integer = html.IndexOf("<title>") Dim t2 As Integer = html.IndexOf("</title>") + 8 Dim newTitleTag As String = html.Substring(t1, t2 - t1) html = html.Replace(newTitleTag, String.Format("<title>{0}</title>", Me.Title))
writer.Write(html)
End Sub
I tested this on the dev server. I added this code to Category.master.vb as it is above. It gives an error referring to the line starting with 'html' ...towards the end: 'me.Title' Title is not a member of --class name-- I tried Page.Title instead of Me.Title .... it didn't work either.
What am I doing wrong?
|
|
|
|
Rank: Member
Joined: 4/10/2009(UTC) Posts: 120 Location: Mechanicsville, VA
Thanks: 3 times Was thanked: 1 time(s) in 1 post(s)
|
There is no difference between these two statements, from an html standpoint. Line breaks like this are ignored by a compiler.
Are you seeing a difference in the Title after a browser interprets the code? |
Tim
|
|
|
|
Rank: Member
Joined: 2/3/2007(UTC) Posts: 100
|
Page does not come up. It just gives an error pointing to the error line.
Don't know asp.net that much. Could not figure it out.
|
|
|
|
Rank: Member
Joined: 4/10/2009(UTC) Posts: 120 Location: Mechanicsville, VA
Thanks: 3 times Was thanked: 1 time(s) in 1 post(s)
|
No sure where the error is, but this seems unnecessary. The <title> tag is being built by .net from the category names, within the category template, not the master file. Don't edit the master page. Do you have extra characters in your category name? |
Tim
|
|
|
|
Rank: Member
Joined: 4/10/2009(UTC) Posts: 120 Location: Mechanicsville, VA
Thanks: 3 times Was thanked: 1 time(s) in 1 post(s)
|
I checked the title of one my pages... it does look like this, physically in the html.
<title> Cat Name </title>
However, the title within the browser displays properly without any extraneous line breaks, like I said before. |
Tim
|
|
|
|
Rank: Member
Joined: 2/3/2007(UTC) Posts: 100
|
What I was trying to do is to remove all unnecessary spaces in the html code to increase the page speed suggested by Google. My tests actually show that after removing all white space in and between tags, the page size is reduced between 20% to 30% depending on the content of course. That's the reason. I guess I can leave 'title' alone and look at how to customize the other parts of the html output :) Thanks for the input Tim.
|
|
|
|
Rank: Member
Joined: 12/23/2003(UTC) Posts: 909
|
Are you "forcing image sizes"? |
|
|
|
|
Rank: Member
Joined: 2/3/2007(UTC) Posts: 100
|
I do it on Cart page and cross selling product images on the product pages. Everything else is original images. I hope I understand your question correctly.
|
|
|
|
Rank: Member
Joined: 12/23/2003(UTC) Posts: 909
|
You've stated that you're working to improve your page speed.
Having all of your thumbnail images the same dimensions and activating "Force Image Sizes" which is located in the "Dashboard > Options > Images", will help with your page speed.
You may notice that on your category pages that your products may "fly in" from the right of the screen. Following what I mentioned above takes the guesswork out of the table equation for the browser and you'll see load time improvements. |
|
|
|
|
Rank: Member
Joined: 2/3/2007(UTC) Posts: 100
|
Thank you Matt.
You have a point about forcing image sizes. While all of my small size images are 140 x 140, not all of the medium sized images are in same size. So I can't force the image sizes because of that. or is there a way to force the image size JUST for the small size and leave the medium size alone?
|
|
|
|
Rank: Member
Joined: 12/23/2003(UTC) Posts: 909
|
I don't think you can isolate the images through the dashboard like you're thinking.
This may help, but not positive. open up your stylesheet and locate your category grid display formatting.
Add this line:
#categorygridtemplate .record .recordimage img {width: 140px !important; height: 140px !important;} |
|
|
|
|
Rank: Member
Joined: 2/3/2007(UTC) Posts: 100
|
I edited the css file. It seems it worked. Thank you very much.
|
|
|
|
Rank: Member
Joined: 12/23/2003(UTC) Posts: 909
|
yeah it did! night and day difference, just clicked the same category I've been viewing on your site. |
|
|
|
|
Rank: Member
Joined: 2/3/2007(UTC) Posts: 100
|
Sometimes small details make a lot of difference. Thanks a lot for that tip. I never noticed until you told me.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.