<title> and <meta> tags - again

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

<title> and <meta> tags - again

Post by draneb » Wed Nov 26, 2008 11:06 am

Hello,

Since this is a serious issue for me and it went unanswered last time I would like to ask again.

I, with the help of Judy, worked very hard to get my AC 5.5 ranked very, very well for all of my search terms in Google and Yahoo. If there was a product I carried and I typed some of those words into Google I was always on the first page, most of the time 1, 2 or 3.

When I switched to AC 7 my listings completely disappeared. Judy incorporated the same title and meta information (using custom programming) that was used on my 5.5 site. Google and Yahoo are living on my AC 7 site, daily, but the only listings I can find are ones that are from the 5.5 pages that haven't been re-indexed.

Anyways, for whatever reason I dropped, I still need to find a way to list the <title> and <meta> tags in their traditional way. Look at these tags from the AC 7 demo site, this is just sloppy.

<link href="App_Themes/Glass_SilverAge/ComponentArt.css" type="text/css" rel="stylesheet" /><link href="App_Themes/Glass_SilverAge/print.css" type="text/css" rel="stylesheet" /><link href="App_Themes/Glass_SilverAge/style.css" type="text/css" rel="stylesheet" /><link href="App_Themes/Glass_SilverAge/webparts.css" type="text/css" rel="stylesheet" /><title>
Home Page
</title><style type="text/css">

Everything just runs together. There are no line breaks between tags and why does the title tag display with the title on a separate line with tab spacing in front of it?

I knew I should have waited to after Christmas to go live with the new site. This isn't going to be good.
Can this be fixed? Is it buried in compiled code somewhere?
AC 7.0.3 build 13937

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: <title> and <meta> tags - again

Post by sohaib » Wed Nov 26, 2008 12:49 pm

Anyways, for whatever reason I dropped, I still need to find a way to list the <title> and <meta> tags in their traditional way. Look at these tags from the AC 7 demo site, this is just sloppy.

<link href="App_Themes/Glass_SilverAge/ComponentArt.css" type="text/css" rel="stylesheet" /><link href="App_Themes/Glass_SilverAge/print.css" type="text/css" rel="stylesheet" /><link href="App_Themes/Glass_SilverAge/style.css" type="text/css" rel="stylesheet" /><link href="App_Themes/Glass_SilverAge/webparts.css" type="text/css" rel="stylesheet" /><title>
Home Page
</title><style type="text/css">

Everything just runs together. There are no line breaks between tags and why does the title tag display with the title on a separate line with tab spacing in front of it?
I am not expert on search engine optimization but I see no reason why the tags being output like the above should make any difference to a search engine bot which is a program. Search engine bots are parsing the tags not the lines and in HTML white space (including new line) has no significance.

There are hundreds of factors affecting search engine ranking. I am sure there are other factors on your new AC7 store affecting your ranking. I am unable to convince myself that absence of line breaks or other 'formatting' could be the reason.... but who knows.

Google's ranking formula is certainly complicated. It might be taking into account your old pages and new pages at the same time ... resulting in a lower score.

User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: <title> and <meta> tags - again

Post by draneb » Wed Nov 26, 2008 1:49 pm

Yes, I know. I have operated a website for over 10 years and trying to figure them out is almost impossible but I did have a good system going.

You are correct. Having duplicate pages from 5.5 to 7.0 most likely got me flushed down the toilet. I have product pages ending in PxxxCxxx.aspx and now the same pages ending only in Pxxx.aspx.

Can't you program something in to make those pages with the Cxxx on the end show up as 404 errors? I was able to get 404 errors just by changing the C to a lowercase c. Then maybe Google can index the site correctly. That is another serious issue (customers who used previous versions of AC)

I wasn't blaming my drop on the meta tags and title layout, but "why not?" have them shown that way? It must be something too difficult because it otherwise just doesn't make any sense. It definitely wouldn't hurt...

Thank you.
Last edited by draneb on Thu Nov 27, 2008 5:33 am, edited 2 times in total.
AC 7.0.3 build 13937

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: <title> and <meta> tags - again

Post by sohaib » Thu Nov 27, 2008 2:04 am

I wasn't blaming my drop on the meta tags and title layout, but "why not?" have them shown that way? It must be something too difficult because it otherwise just doesn't make any sense. It definitely wouldn't hurt...
I agree. Mazhar will have a look at this and provide a workaround if possible.
What happens is the for the purpose of optimizing the page size, quite often, the rendering code strips out empty spaces from HTML. We will check if that is the case...

TTMedia
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 83
Joined: Mon Dec 03, 2007 11:49 am

Re: <title> and <meta> tags - again

Post by TTMedia » Thu Nov 27, 2008 2:34 am

The problem with upgrading your ecom site, especially if your old site is dynamic is that you open up room for duplicate content penalty.

A 404 error will not help you. You need to perform a 301 error, (permanent redirect). Now the problem is that your old site is all dynamic content, and with IIS, you can't do a 301 redirect with no dynamic content.. unless you are using a url re-write program from the get go and can recreate the file/folder structure.

Also, when you update your site so drastically but change the complete code, Google will raise red flags and proceed with caution on your site. It will take a while for everything to get back together.. but it sure is a pain in the a$$

User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: <title> and <meta> tags - again

Post by draneb » Thu Nov 27, 2008 5:33 am

Thanks Sohaib. That would be great.

Thanks TTMedia. You are right, a 301 redirect would have to be the way to go. So search engines won't remove the page if they keep getting a 404 error?

I have a file on the server that sends me an email with any errors. Slurp and Googlebot are just living on the site, daily, so that is good. I just have to try and get rid of the duplicate content to get back on good terms with them. :roll:

Hapy Thanksgiving!
AC 7.0.3 build 13937

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: <title> and <meta> tags - again

Post by jmestep » Thu Nov 27, 2008 8:22 am

I'm checking on this also. I've done some meta stuff on Draneb's site, but since I'm working full time for Web2Market, I haven't had a lot of time to help him. I remember in some places putting a /n in code to generate a new line.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: <title> and <meta> tags - again

Post by mazhar » Thu Nov 27, 2008 9:00 am

Regarding 301 Redirect Pages
The solution for 301 redirect pages has been already discussed in some threads. Have a look at the following threads
viewtopic.php?f=42&t=7707
viewtopic.php?f=42&t=8004

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: <title> and <meta> tags - again

Post by mazhar » Thu Nov 27, 2008 12:47 pm

Here is the code to put proper line breaks in the generated HTML. You need to put this method in each page for which you want to have line breaks in the head.

Code: Select all

protected override void Render(HtmlTextWriter writer)
    {
        string pageHtml = string.Empty;

        using (System.IO.StringWriter sw = new System.IO.StringWriter())
        {
            using (HtmlTextWriter hw = new HtmlTextWriter(sw))
            {
                base.Render(hw);
                pageHtml = sw.ToString();

                int headStartIndex = pageHtml.IndexOf("<head");
                int headEndIndex = pageHtml.IndexOf("</head>");
                string headerPart = pageHtml.Substring(headStartIndex, ((headEndIndex + 7) - headStartIndex));

                StringBuilder sb = new StringBuilder(headerPart);
                sb.Replace("<link", "\r<link");
                sb.Replace("<META", "\r<META");
                sb.Replace("<style", "\r<style");

                int sindex = headerPart.IndexOf("<title>");
                int eindex = headerPart.IndexOf("</title>");
                string titleTag = headerPart.Substring(sindex, (eindex + 8) - sindex);
                string titleText = headerPart.Substring((sindex + 7), (eindex - (sindex + 7)));
                titleText = titleText.Replace("\r", string.Empty);
                titleText = titleText.Replace("\t", string.Empty);
                titleText = titleText.Replace("\n", string.Empty);
                titleText.Trim();
                titleText = String.Format("\r<title>{0}</title>", titleText);
                sb.Replace(titleTag, titleText);
                sb.Replace("</head>", "\r</head>");
                string newHeaderPart = sb.ToString();
                pageHtml = pageHtml.Replace(headerPart, newHeaderPart);
                hw.Close();
            }
            sw.Close();
        }
        writer.Write(pageHtml);                    
    }
OUT PUT
<link href="App_Themes/AbleCommerce/ComponentArt.css" type="text/css" rel="stylesheet" />
<link href="App_Themes/AbleCommerce/Gallery.css" type="text/css" rel="stylesheet" />
<link href="App_Themes/AbleCommerce/print.css" type="text/css" rel="stylesheet" />
<link href="App_Themes/AbleCommerce/style.css" type="text/css" rel="stylesheet" />
<link href="App_Themes/AbleCommerce/webparts.css" type="text/css" rel="stylesheet" />
<title>Home Page</title>
<style type="text/css">
.ctl00_wpm_HomePage_ctl02_CategoryTree_0 { text-decoration:none; }
.ctl00_ContentZone_0 { border-color:Black;border-width:1px;border-style:Solid; }

</style>
</head>

User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: <title> and <meta> tags - again

Post by draneb » Thu Nov 27, 2008 3:15 pm

Thank you Mazhar!
Thank you Sohaib!

You are awesome. It works great.
AC 7.0.3 build 13937

User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: <title> and <meta> tags - again

Post by draneb » Fri Nov 28, 2008 6:45 am

Mazhar, I put the code in my Product.aspx file and the tags were displaying great.

Just testing around, as I quite often do, I found that if I click on my Write a Review link I get redirected to my custom 404 error page. If I take the code out I can click on the Write a Review link and get the form without any problems.

Would you happen to be able to verify this on yours?

Thank you.
AC 7.0.3 build 13937

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: <title> and <meta> tags - again

Post by mazhar » Fri Nov 28, 2008 6:46 am

let me check

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: <title> and <meta> tags - again

Post by mazhar » Fri Nov 28, 2008 7:00 am

I think this problem is due to ajax call. We need to make sure that if the response html contains head tag then we need to adjust it otherwise do nothing. Try the following updated code

Code: Select all

protected override void Render(HtmlTextWriter writer)
    {
        string pageHtml = string.Empty;

        using (System.IO.StringWriter sw = new System.IO.StringWriter())
        {
            using (HtmlTextWriter hw = new HtmlTextWriter(sw))
            {
                base.Render(hw);
                pageHtml = sw.ToString();

                if (pageHtml.Contains("<head") && pageHtml.Contains("</head>"))
                {
                    int headStartIndex = pageHtml.IndexOf("<head");
                    int headEndIndex = pageHtml.IndexOf("</head>");

                    string headerPart = pageHtml.Substring(headStartIndex, ((headEndIndex + 7) - headStartIndex));

                    StringBuilder sb = new StringBuilder(headerPart);
                    sb.Replace("<link", "\r<link");
                    sb.Replace("<META", "\r<META");
                    sb.Replace("<style", "\r<style");

                    int sindex = headerPart.IndexOf("<title>");
                    int eindex = headerPart.IndexOf("</title>");
                    string titleTag = headerPart.Substring(sindex, (eindex + 8) - sindex);
                    string titleText = headerPart.Substring((sindex + 7), (eindex - (sindex + 7)));
                    titleText = titleText.Replace("\r", string.Empty);
                    titleText = titleText.Replace("\t", string.Empty);
                    titleText = titleText.Replace("\n", string.Empty);
                    titleText.Trim();
                    titleText = String.Format("\r<title>{0}</title>", titleText);
                    sb.Replace(titleTag, titleText);
                    sb.Replace("</head>", "\r</head>");
                    string newHeaderPart = sb.ToString();
                    pageHtml = pageHtml.Replace(headerPart, newHeaderPart);
                }
                hw.Close();
            }
            sw.Close();
        }
        writer.Write(pageHtml);
    }

User avatar
draneb
Captain (CAPT)
Captain (CAPT)
Posts: 314
Joined: Sun Jun 12, 2005 4:07 pm
Location: Texas
Contact:

Re: <title> and <meta> tags - again

Post by draneb » Fri Nov 28, 2008 10:27 am

Hi Mazhar,

That code worked. Thank you very much.
AC 7.0.3 build 13937

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: <title> and <meta> tags - again

Post by jmestep » Fri Nov 28, 2008 1:25 pm

One more tweak would be nice:
Render the <title> tags before the other <meta> tags. SEO software complains that it should be first. I've experimented some, but other things in the page code seem to override what line I put the Page.Title on.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: <title> and <meta> tags - again

Post by mazhar » Sat Nov 29, 2008 1:37 am

One more tweak would be nice:
Render the <title> tags before the other <meta> tags. SEO software complains that it should be first. I've experimented some, but other things in the page code seem to override what line I put the Page.Title on.
I think it could be done by interchanging the title tag with first meta tag.

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: <title> and <meta> tags - again

Post by jmestep » Sat Nov 29, 2008 8:33 am

I've tried moving it up above the meta tags in the above code and it didn't change. I'll try again.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: <title> and <meta> tags - again

Post by jmestep » Sat Nov 29, 2008 3:07 pm

Is there a way this could be put into the pagehelper.cs? I tried it and got an error
CS0115: 'PageHelper.Render(System.Web.UI.HtmlTextWriter)': no suitable method found to override
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: <title> and <meta> tags - again

Post by mazhar » Mon Dec 01, 2008 6:09 am

I've tried moving it up above the meta tags in the above code and it didn't change. I'll try again.
From interchange i mean that we need to interchange the meta tags and tittle tag information in available page HTML string not by interchanging code statements. I have tried to put this functionality as well, the newly added code contains the comments to describe the purpose of statements. Please try the code

Code: Select all

protected override void Render(HtmlTextWriter writer)
    {
        string pageHtml = string.Empty;

        using (System.IO.StringWriter sw = new System.IO.StringWriter())
        {
            using (HtmlTextWriter hw = new HtmlTextWriter(sw))
            {
                base.Render(hw);
                pageHtml = sw.ToString();

                if (pageHtml.Contains("<head") && pageHtml.Contains("</head>"))
                {
                    int headStartIndex = pageHtml.IndexOf("<head");
                    int headEndIndex = pageHtml.IndexOf("</head>");

                    string headerPart = pageHtml.Substring(headStartIndex, ((headEndIndex + 7) - headStartIndex));

                    StringBuilder sb = new StringBuilder(headerPart);
                    sb.Replace("<link", "\r<link");
                    sb.Replace("<META", "\r<META");
                    sb.Replace("<style", "\r<style");

                    int sindex = headerPart.IndexOf("<title>");
                    int eindex = headerPart.IndexOf("</title>");
                    string titleTag = headerPart.Substring(sindex, (eindex + 8) - sindex);
                    string titleText = headerPart.Substring((sindex + 7), (eindex - (sindex + 7)));
                    titleText = titleText.Replace("\r", string.Empty);
                    titleText = titleText.Replace("\t", string.Empty);
                    titleText = titleText.Replace("\n", string.Empty);
                    titleText.Trim();
                    titleText = String.Format("\r<title>{0}</title>", titleText);
                    sb.Replace(titleTag, titleText);
                    sb.Replace("</head>", "\r</head>");
                    string newHeaderPart = sb.ToString();
                    
                    //find out the index of first meta tag
                    int metaIndex = newHeaderPart.IndexOf("<META", StringComparison.CurrentCultureIgnoreCase);
                    
                    //meta tag found
                    if (metaIndex >= 0)
                    {
                        //remove the current title information
                        newHeaderPart.Replace(titleText, string.Empty);
                        
                        //inject the title information at first meta tag index
                        newHeaderPart = newHeaderPart.Insert(metaIndex, titleText);
                    }
                    pageHtml = pageHtml.Replace(headerPart, newHeaderPart);
                }
                hw.Close();
            }
            sw.Close();
        }
        writer.Write(pageHtml);
    }

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: <title> and <meta> tags - again

Post by mazhar » Mon Dec 01, 2008 6:23 am

Is there a way this could be put into the pagehelper.cs? I tried it and got an error
CS0115: 'PageHelper.Render(System.Web.UI.HtmlTextWriter)': no suitable method found to override
You can not move the complete Render method inside the PageHelper. Its something specific to the ASPX Page. I am overriding the ASPX default rendering by providing an overridden version of Render method in each page. A part of method could be moved inside the PageHelperbut still you will need it in each page.

For example in PageHelper you can create the following function.

Code: Select all

public static void AdjustHTML(ref string pageHtml) 
    {
        if (pageHtml.Contains("<head") && pageHtml.Contains("</head>"))
        {
            int headStartIndex = pageHtml.IndexOf("<head");
            int headEndIndex = pageHtml.IndexOf("</head>");

            string headerPart = pageHtml.Substring(headStartIndex, ((headEndIndex + 7) - headStartIndex));

            StringBuilder sb = new StringBuilder(headerPart);
            sb.Replace("<link", "\r<link");
            sb.Replace("<META", "\r<META");
            sb.Replace("<style", "\r<style");

            int sindex = headerPart.IndexOf("<title>");
            int eindex = headerPart.IndexOf("</title>");
            string titleTag = headerPart.Substring(sindex, (eindex + 8) - sindex);
            string titleText = headerPart.Substring((sindex + 7), (eindex - (sindex + 7)));
            titleText = titleText.Replace("\r", string.Empty);
            titleText = titleText.Replace("\t", string.Empty);
            titleText = titleText.Replace("\n", string.Empty);
            titleText.Trim();
            titleText = String.Format("\r<title>{0}</title>", titleText);
            sb.Replace(titleTag, titleText);
            sb.Replace("</head>", "\r</head>");
            string newHeaderPart = sb.ToString();

            //find out the index of first meta tag
            int metaIndex = newHeaderPart.IndexOf("<META", StringComparison.CurrentCultureIgnoreCase);

            //meta tag found
            if (metaIndex >= 0)
            {
                //remove the current title information
                newHeaderPart.Replace(titleText, string.Empty);

                //inject the title information at first meta tag index
                newHeaderPart = newHeaderPart.Insert(metaIndex, titleText);
            }
            pageHtml = pageHtml.Replace(headerPart, newHeaderPart);
        }
    }

and in pages you can use the following version of the Render method

Code: Select all

protected override void Render(HtmlTextWriter writer)
    {
        string pageHtml = string.Empty;

        using (System.IO.StringWriter sw = new System.IO.StringWriter())
        {
            using (HtmlTextWriter hw = new HtmlTextWriter(sw))
            {
                base.Render(hw);
                pageHtml = sw.ToString();
                PageHelper.AdjustHTML(ref pageHtml);                
                hw.Close();
            }
            sw.Close();
        }
        writer.Write(pageHtml);
    }

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: <title> and <meta> tags - again

Post by jmestep » Mon Dec 01, 2008 7:55 am

Thank you, mazhar. I will work on the title tag. On moving it all to Pagehelper.cs, I was just looking for a way to have the code in only one place, but I understand now why I can't.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

krissato
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 26
Joined: Tue May 13, 2008 7:26 pm

Re: <title> and <meta> tags - again

Post by krissato » Fri Dec 19, 2008 1:46 pm

Thank you for posting this code! I did some fine-tuning - the casing on "META" didn't match what I had, and the <title> in its original position was not getting removed. This is the modified code that works for me:

protected override void Render(HtmlTextWriter writer)
{
string pageHtml = string.Empty;

using (System.IO.StringWriter sw = new System.IO.StringWriter())
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
base.Render(hw);
pageHtml = sw.ToString();

if (pageHtml.Contains("<head") && pageHtml.Contains("</head>"))
{
int headStartIndex = pageHtml.IndexOf("<head");
int headEndIndex = pageHtml.IndexOf("</head>");

string headerPart = pageHtml.Substring(headStartIndex, ((headEndIndex + 7) - headStartIndex));

StringBuilder sb = new StringBuilder(headerPart);
sb.Replace("<link", "\r<link");
sb.Replace("<Meta", "\r<Meta");
sb.Replace("<style", "\r<style");

int sindex = headerPart.IndexOf("<title>");
int eindex = headerPart.IndexOf("</title>");
string titleTag = headerPart.Substring(sindex, (eindex + 8 ) - sindex);
string titleText = headerPart.Substring((sindex + 7), (eindex - (sindex + 7)));
titleText = titleText.Replace("\r", string.Empty);
titleText = titleText.Replace("\t", string.Empty);
titleText = titleText.Replace("\n", string.Empty);
titleText.Trim();
titleText = String.Format("\r<title>{0}</title>", titleText);
sb.Replace(titleTag, titleText);
sb.Replace("</head>", "\r</head>");
string newHeaderPart = sb.ToString();

//find out the index of first meta tag
int metaIndex = newHeaderPart.IndexOf("<Meta", StringComparison.CurrentCultureIgnoreCase);

//meta tag found
if (metaIndex >= 0)
{
//remove the current title information
string updatedHeaderPart = newHeaderPart.Replace(titleText, string.Empty);

//inject the title information at first meta tag index
newHeaderPart = updatedHeaderPart.Insert(metaIndex-1, titleText);
}
pageHtml = pageHtml.Replace(headerPart, newHeaderPart);
}
hw.Close();
}
sw.Close();
}
writer.Write(pageHtml);
}

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: <title> and <meta> tags - again

Post by mazhar » Sat Dec 20, 2008 5:39 am

Thanks for sharing the code krissato :D

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: <title> and <meta> tags - again

Post by Brewhaus » Mon Feb 16, 2009 7:54 pm

Were exactly should this code be placed?
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: <title> and <meta> tags - again

Post by mazhar » Tue Feb 17, 2009 4:36 am

In all root pages of website for example Default.aspx, ContactUs.aspx etc.

Post Reply