Hi, I'm trying to dynamically set meta description, keywords and title for Search.aspx based on the search query. I can get location, and city, but the category shows as just the number. Does anyone know how to convert the Request.QueryString("c") into
the category name? For example, category 388 is Jets. How can I get the word Jets to show up in the metaDescription rather than 388? I'd really appreciate any suggestions. Thanks.
You obviously have the category ID that will be in your code somewhere like this + CategoryId.ToString() +
Your code will be different but you simply need to get the category Name. The code above would be replaced like this + Category.GetById(CategoryId).Name +
Very simple!!!
If it is not in your version perhaps try the version on codeplex! At least there you can get others to help build your site to todays standards.
The project is supported by the community where as the classifieds kit is considered outdated!
I have checked and the correct usage for the project available on codeplex is + Category.GetCategoryById(CategoryId).Name +
Happy Coding [:D]
Classifieds Starter Kit
Trading Center is a Continuation of the Classifieds Starter Kit onCode Plex.
Hi, and thanks for the reply. I did try + Category.GetCategoryById(CategoryId).Name + and got the error message that Category is not declared. I tried declaring Category and got the following error. See below.....I can see that CategoryPath.ascx has
the information I need and that's where crumbs is getting the name for the category. I just can't figure out how to use that info in Search.aspx.vb to set the meta keywords and description.
Compilation Error
Description:
An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'GetCategoryById' is not a member of 'System.Array'.
Source Error:
Line 76: Dim metaTitle As New HtmlMeta()
Line 77: metaTitle.Name = "title"
Line 78: metaTitle.Content = "Airplanes For Sale | " + Category.GetCategoryById(CategoryId).Name +
Compiler Error Message: BC30456: 'GetCategoryById' is not a member of 'System.Array'.
Check your Business Logic! In your version it must be trying to return a DataTable when really you are trying to get just a TableRow
To Sum up your problem is with in the GetCategoryById(int) method. you need to create a wrapper method that Gets The First Row, If you look in Ads/Listings/AdsDB/ClassifiedsDB or what ever it is in your version you will find a method like getAdById that
should use a wrapper GetFirstRow around the DB method.
If your wrapper method allready exist then run with Debug Markers (BreakPoints) and see whats really going on!
Classifieds Starter Kit
Trading Center is a Continuation of the Classifieds Starter Kit onCode Plex.
Hi, I found what looks to be the wrapper method you mentioned in AppCode/Bll/Ads.vb. I'm pretty new to VWD, but I did try setting breakpoints and debugging. Every time I got an error getting files and the program quit working. Is there another way to
see what's going on? Thanks
#Region
"GetAds..."
Public
Shared
Function GetAdById(ByVal adId
As
Integer)
As AdsDataComponent.AdsRowUsing db
As
New AdsDataAdapter()Return GetFirstRow(db.GetAdById(adId))End
Using
Ok, I found a file called AppCode/Web/Outputformatting.vb where the names for adtype and adstatus are described. It looks like I could somehow add category and enumerate the varied categories( ?c=5) with their appropriate names so the words would show
up in the meta Title,Description, and Keywords.
Has anyone done this already, or found a simpler way to set the meta tags for the search page based on the category > subcategory?
Or....can anyone tell me where to find how crumbs is translating the category code#s into words? I've searched and searched, so it's probably right under my nose, but I can't seem to find it. thanks
Dim CategoryText As String
Select Case Request.QueryString("c")
Case 388
CategoryText = "Aircraft For Sale | Aerobatic Aircraft"
Case 391
CategoryText = "Aircraft For Sale | Aerobatic Aircraft | Extra"
Case 373
CategoryText = "Aircraft For Sale | Warbird Aircraft For Sale"
*********** define text for each existing category************
Case Else
CategoryText = ""
End Select
Marked as answer by redwoodbev on Feb 07, 2010 10:37 PM
redwoodbev
Member
29 Points
166 Posts
Setting metaDescription/Keywords, etc for Search.aspx based on search query
Dec 15, 2009 09:25 AM|LINK
Hi, I'm trying to dynamically set meta description, keywords and title for Search.aspx based on the search query. I can get location, and city, but the category shows as just the number. Does anyone know how to convert the Request.QueryString("c") into the category name? For example, category 388 is Jets. How can I get the word Jets to show up in the metaDescription rather than 388? I'd really appreciate any suggestions. Thanks.
robdob
Member
141 Points
87 Posts
Re: Setting metaDescription/Keywords, etc for Search.aspx based on search query
Dec 18, 2009 03:13 PM|LINK
Take a look at where it is being extracted from the bread crumbs or on the other page areas,, worse come to worse write yourself a stored procedure..
Spider Maste...
Participant
1664 Points
483 Posts
Re: Setting metaDescription/Keywords, etc for Search.aspx based on search query
Dec 31, 2009 07:43 PM|LINK
Depending on the version you have,
You obviously have the category ID that will be in your code somewhere like this + CategoryId.ToString() +
Your code will be different but you simply need to get the category Name. The code above would be replaced like this + Category.GetById(CategoryId).Name +
Very simple!!!
If it is not in your version perhaps try the version on codeplex! At least there you can get others to help build your site to todays standards.
The project is supported by the community where as the classifieds kit is considered outdated!
I have checked and the correct usage for the project available on codeplex is + Category.GetCategoryById(CategoryId).Name +
Happy Coding [:D]
Trading Center is a Continuation of the Classifieds Starter Kit onCode Plex.
redwoodbev
Member
29 Points
166 Posts
Re: Setting metaDescription/Keywords, etc for Search.aspx based on search query
Jan 03, 2010 12:03 AM|LINK
Hi, and thanks for the reply. I did try + Category.GetCategoryById(CategoryId).Name + and got the error message that Category is not declared. I tried declaring Category and got the following error. See below.....I can see that CategoryPath.ascx has the information I need and that's where crumbs is getting the name for the category. I just can't figure out how to use that info in Search.aspx.vb to set the meta keywords and description.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'GetCategoryById' is not a member of 'System.Array'.
Source Error:
Source File: d:\hosting\mysite\Search.aspx.vb Line: 78
Spider Maste...
Participant
1664 Points
483 Posts
Re: Setting metaDescription/Keywords, etc for Search.aspx based on search query
Jan 03, 2010 07:53 AM|LINK
Check your Business Logic! In your version it must be trying to return a DataTable when really you are trying to get just a TableRow
To Sum up your problem is with in the GetCategoryById(int) method. you need to create a wrapper method that Gets The First Row, If you look in Ads/Listings/AdsDB/ClassifiedsDB or what ever it is in your version you will find a method like getAdById that should use a wrapper GetFirstRow around the DB method.
If your wrapper method allready exist then run with Debug Markers (BreakPoints) and see whats really going on!
Trading Center is a Continuation of the Classifieds Starter Kit onCode Plex.
redwoodbev
Member
29 Points
166 Posts
Re: Setting metaDescription/Keywords, etc for Search.aspx based on search query
Jan 03, 2010 10:48 PM|LINK
Hi, I found what looks to be the wrapper method you mentioned in AppCode/Bll/Ads.vb. I'm pretty new to VWD, but I did try setting breakpoints and debugging. Every time I got an error getting files and the program quit working. Is there another way to see what's going on? Thanks
#Region
"GetAds..."
Public Shared Function GetAdById(ByVal adId As Integer) As AdsDataComponent.AdsRowUsing db As New AdsDataAdapter()Return GetFirstRow(db.GetAdById(adId))End Using
End Functionredwoodbev
Member
29 Points
166 Posts
Re: Setting metaDescription/Keywords, etc for Search.aspx based on search query
Jan 06, 2010 12:48 AM|LINK
Ok, I found a file called AppCode/Web/Outputformatting.vb where the names for adtype and adstatus are described. It looks like I could somehow add category and enumerate the varied categories( ?c=5) with their appropriate names so the words would show up in the meta Title,Description, and Keywords.
Has anyone done this already, or found a simpler way to set the meta tags for the search page based on the category > subcategory?
Or....can anyone tell me where to find how crumbs is translating the category code#s into words? I've searched and searched, so it's probably right under my nose, but I can't seem to find it. thanks
redwoodbev
Member
29 Points
166 Posts
Re: Setting metaDescription/Keywords, etc for Search.aspx based on search query
Feb 07, 2010 10:37 PM|LINK
I was finally able to do this using
Dim CategoryText As String Select Case Request.QueryString("c") Case 388 CategoryText = "Aircraft For Sale | Aerobatic Aircraft" Case 391 CategoryText = "Aircraft For Sale | Aerobatic Aircraft | Extra" Case 373 CategoryText = "Aircraft For Sale | Warbird Aircraft For Sale"*********** define text for each existing category************ Case Else CategoryText = "" End Select