Hi, I want to change the title of a website http://checkcost.co.uk/ dynamically. It's an ecommerce website. Suppose we have a product " Sony Vaio laptop" , I want when some one browse the landing page of sony vaio laptop, the title of the page should show sony vaio laptop. please give me solution as details as possible with reference script & links. Thanks!
The only way I can see that you can do it is to grab the urlreferrer and parse the query string...if you find certain keywords you could change the title Request.UrlReferrer
page.title sets the page title so just grab the words to include from the url/ querystrings/ database and either set the page title or if using master files to set the base just have page.title &= to append the extra to the end of the title. Meta is slightly more difficult but not much
as said earlier luk of out for referring page query string ... For Google THE referring url will be : google.co.in/search?q=sony+vaio&sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL_enIN176IN231 So just extract the value of "q" ...thats it Althought i haven't tried.. but it shud work .. All the best and do post the result
Try to pass what ever keyword u want to url query string , then in the title tag simply embed the querystring value with asp tags like <title><%=Request.Querystring("key")%> -- Your Site Name </title> Code (markup): this will put your sony vio lap tops before your site name
Easy! You already know what the title is going to be because you have the product in your inventory. So set Page.Title = MyProductTitle just like AstarothSolutions suggested.
Would have thought the user had worked this out a few months ago. Really shouldnt use <%=Request.Querystring("key")%> as this just leaves your site open to abuse unless you want to have people create a link like http://www.YourSite.com/default.asp?key=Hard+Core+Porn and google then indexes the page with the title of Hard Core Porn. Any user input should be cleansed/ validated first before displaying
here is the code i use to create dynamic titles (C#.Net in Visual Studio 2005) HtmlTitle ht = new HtmlTitle(); HtmlHead head = (HtmlHead)Page.Header; ht.Text = "My Title Goes Here, so put the title dynamically"; head.Controls.Add(ht); Code (markup): make sure you dont have a <title> </title> tag in the header section <head runat="server"> </head> Code (markup):
this is what i use in .net Page.Title = "Title of Page"; for Dynamic meta tags/ keywords i use coolcode007`s option, something like this public static void SEO(Page thisPage ,string title, string keywords, string discription) { HtmlHead header = (HtmlHead)thisPage.Header; HtmlMeta Dmeta = new HtmlMeta(); Dmeta.Name = "Description"; Dmeta.Content = discription; header.Controls.Add(Dmeta); HtmlMeta Kmeta = new HtmlMeta(); Kmeta.Name = "Keywords"; Kmeta.Content = keywords; header.Controls.Add(Kmeta); HtmlMeta Tmeta = new HtmlMeta(); Tmeta.Name = "Title"; Tmeta.Content = title; header.Controls.Add(Tmeta); } Code (markup):