Print Page | Close Window

H1 tag & Meta Title

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Search Engine Optimization
Forum Description: Talk about ways to optimize your ProductCart store for search engines
URL: https://forum.productcart.com/forum_posts.asp?TID=4281
Printed Date: 26-June-2024 at 8:00am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: H1 tag & Meta Title
Posted By: whizzinpc
Subject: H1 tag & Meta Title
Date Posted: 28-January-2011 at 2:32pm
Is there any way to take the Meta Title of a category and have that display in an H1 tag in the body. I've tried to use the variables from the include-metatags file but nothing seems to work.



Replies:
Posted By: Brett
Date Posted: 29-January-2011 at 9:36am
First you need to edit pcBreadCrumbs.asp:

Line 17 add categories.pcCats_MetaTitle like so...

query="SELECT categories.categoryDesc, categories.idCategory, categories.idParentCategory, categories.image, categories.largeimage, categories.SDesc, categories.LDesc, categories.HideDesc, categories.pccats_BreadCrumbs, categories.pcCats_MetaTitle FROM categories WHERE (((categories.idCategory)="&pIdCategory&")" & queryHC & ") ORDER BY categories.priority, categories.categoryDesc;"
Line 38 assign a variable to that query field:

pCategoryMetaTitle=rs("pcCats_MetaTitle")


Then, go to viewcategories.asp and edit line 343 to change categoryname to categorymetatitle:

<h1><%=pCategoryMetaTitle%></h1>


Posted By: whizzinpc
Date Posted: 01-February-2011 at 11:49am
Worked perfectly! Your the man! If its not too much to ask maybe you can help me a tiny bit more. The reason I need this is to put a header tag at the top of the page that reflect the meta tag so we can focus on a long tail keyword and not have to change the category or product name. I figured out how to show the category name if the meta tag doesn't exist. Now I need to do the same for a product. The product meta tag title I cant figure out either.
Here is what I have so far.

<% if not isNull(pCategoryMetaTitle) and pCategoryMetaTitle<>""  then %>
<h1><%=pCategoryMetaTitle%></h1>
<%else%>
<h1><%=pCategoryName%></h1>
<%end if%> 



Posted By: Brett
Date Posted: 01-February-2011 at 8:35pm
Hey, I can probably help. What is a long tail keyword? I guess you want to: Display the Meta Title on the top of the category and product details (and product configuration?) pages inside a <h1> tag. What you've pasted is the code you're now using for the category pages. Is that code sufficient or do you need it to do something else?

Are you now just looking for the same functionality on the product detail pages? Let's take it one step at a time and we can definitely get all of this working.


*edit*

to clarify:

The category pages are fine now and you need the same functionality on the product detail pages?

or...

You need the same functionality on the product detail pages and you need something else done with the category pages?


Posted By: whizzinpc
Date Posted: 02-February-2011 at 11:14am
Basically I want to display the meta title for a category and product.
If you are on a category page then show the category meta title... if you are on a product page then show the product meta title.
If the meta title for a category doesn't exist then show the category name.
If the meta title for a product doesn't exist then show the product name.



Posted By: Brett
Date Posted: 02-February-2011 at 3:12pm
OK cool. And I assume the stuff for the category page is fine, right? You now just need the same functionality for the product page? Gonna start looking at that now.


Posted By: Brett
Date Posted: 02-February-2011 at 3:20pm
viewPrd.asp

Line 296 database query add pcProd_MetaTitle:

'--> gets product details from db
' PRV41 Start
query="SELECT active,iRewardPoints, description, sku, configOnly, serviceSpec, price, btobprice, listprice, listHidden, imageurl, largeImageURL, Arequired, Brequired, stock, weight, emailText, formQuantity, noshipping, custom1, content1, custom2, content2, custom3, content3, xfield1, x1req, xfield2, x2req, xfield3, x3req, noprices, IDBrand, noStock, noshippingtext,pcprod_HideBTOPrice,pcprod_QtyValidate,pcprod_MinimumQty,pcProd_multiQty, pcprod_HideDefConfig, notax, pcProd_BackOrder,pcProd_ShipNDays,pcProd_SkipDetailsPage,pcProd_HideSKU, pcPrd_MojoZoom, details, sDesc, pcProd_AvgRating, pcProd_MetaTitle FROM products WHERE idProduct=" &pidProduct & " AND configOnly=0 AND removed=0 "


Line 362 assign a variable to the database field:

'// Assign variable values
pMetaTitle=rs("pcProd_MetaTitle")


viewPrdCode.asp

Line 464 change pDescription to...

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' START: Show product name
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     
Public Sub pcs_ProductName
%>
<h1><%
if pMetaTitle<>"" then
     response.Write(pMetaTitle)
else
     response.Write(pDescription)
end if
%></h1>
<%
End Sub
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' END: Show product name
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


voila!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net