joetuesday
Advanced Member
183 Posts Pre-sales questions only (More Details...)
|
Posted - 07/03/2024 : 19:52:46
Hi - I'm posting this in case it might help someone or in case someone has improvements. My use case is that I have some static category pages. I want to call title and meta description from database given the admin fields in category creation. FYI - I only know enough to know that i don't know enough. Here is how the top of my static category file looks:
<!DOCTYPE html> <% explicitid=3 catid=3 %> <!--#include file="vsadmin/db_conn_open.asp"--> <!--#include file="vsadmin/inc/metainfo.asp"--> <html lang="en"> <!-- #BeginTemplate "Templates/main.dwt" --> <head> <meta charset="utf-8"> <!-- #BeginEditable "doctitle" --> <title><%= pagetitle%> | Yourcompanyname</title> <meta name="Description" content="<%=Replace(sectiondescription,"""",""")%>"> <% ' Only set canonicalURL if it hasn't been set already If IsEmpty(canonicalURL) Then canonicalURL = "https://www.website.com" & Request.ServerVariables("SCRIPT_NAME") End If %> <link rel="canonical" href="<%= canonicalURL %>" /> <!-- Debug: canonicalURL = <%= Server.HTMLEncode(canonicalURL) %> -->
<!-- #EndEditable -->
Joe
|
joetuesday
Advanced Member
183 Posts Pre-sales questions only (More Details...)
|
Posted - 07/04/2024 : 09:23:55
I modified this a bit to fall back to the section name if pagetitle was empty in the DB and then to fall back further should that be absent as well: There is another variable in metainfo that I would like to understand better which is "canonicalnopage" - Does anyone know the use case for this? I looks like its for calling the base url canonical if there is pagination.
<!DOCTYPE html> <% explicitid=51 catid=51 %> <!--#include file="vsadmin/db_conn_open.asp"--> <!--#include file="vsadmin/inc/metainfo.asp"--> <html lang="en"> <!-- #BeginTemplate "Templates/main.dwt" --> <head> <meta charset="utf-8"> <!-- #BeginEditable "doctitle" --> <title> <% If Trim(pagetitle) <> "" Then Response.Write(pagetitle) ElseIf Trim(sectionname) <> "" Then Response.Write(sectionname) Else Response.Write("Your Store name") End If %> | Achieve Display </title> <meta name="Description" content="<%=Replace(sectiondescription,"""",""")%>"> <% ' Only set canonicalURL if it hasn't been set already If IsEmpty(canonicalURL) Then canonicalURL = "https://www.website.com" & Request.ServerVariables("SCRIPT_NAME") End If %> <link rel="canonical" href="<%= canonicalURL %>" /> <!-- Debug: canonicalURL = <%= Server.HTMLEncode(canonicalURL) %> -->
<!-- #EndEditable -->
Joe
![Go to Top of Page](images/icon_go_up.svg)
|
Dermontti
Advanced Member
USA
160 Posts |
Posted - 07/26/2024 : 07:59:51
Hello,
I have never heard of that attribute and it returns no results in search engines.
We have a very large ecom site so I had to create many customizations to meet current SEO and indexing needs for Google Search Console etc.
I have a complex meta init section with many virtuals and I have shared the canonical one below. It handles the 3 dynamic endpoints on this platform to help reduce the number of redundant pages. This platform creates many confusing patterns for crawlers and we have over 15k pages Google found that are duplicates. I also showed the noindex/nofollow example from our products endpoint to allow indexing of dynamic categories, but nothing else so it ignores perpage and pagination. I also have complex custom JS to add SEO H1 titles based on dynamic categories and block Google/Bing from all dynamic categories that match current static ones. I have since seen a large drop in number of found pages and indexed pages.
This in robots.txt helps a lot since one product in multiple categories causes SEO cannibalization. You can also put random cat=999 and it throws no error so this also blocks Google from crawling pages that don't exist. You can see below I block the indexing, but allow follow so they can at least see products etc. #query strings Disallow: /*?prod=*&cat=*
Hope this helps. Let me know if you have any technical SEO issues.
<% Dim canonicalBaseUrl, canonicalURL
' Determine the base URL canonicalBaseUrl = Request.ServerVariables("URL")
' Set the canonical URL based on the base URL Select Case canonicalBaseUrl Case "/proddetail.asp" If productId <> "" Then ' Convert productId to lowercase Dim canonicalProductId canonicalProductId = LCase(productId) canonicalURL = "website/proddetail.asp?prod=" & canonicalProductId ' If there's a "?prod=" in the query string, append it to the canonical URL If InStr(Request.QueryString, "?prod=") > 0 Then canonicalURL = canonicalURL & Mid(Request.QueryString, InStr(Request.QueryString, "?prod=")) End If End If
Case "/products.asp" Dim productCanonicalID productCanonicalID = Request.QueryString("cat") If productCanonicalID <> "" Then canonicalURL = "website/products.asp?cat=" & productCanonicalID Else canonicalURL = "website/products.asp" End If
Case "/categories.asp" Dim categoryCanonicalID categoryCanonicalID = Request.QueryString("cat") If categoryCanonicalID <> "" Then canonicalURL = "website/categories.asp?cat=" & categoryCanonicalID Else canonicalURL = "website/categories.asp" End If
Case "/about-us.asp" canonicalURL = "website/about-us.asp" End Select %>
<link rel="canonical" href="<%=canonicalURL%>" />
PRODUCTS ENDPOINT <% ' below blocks crawlers from indexing anything but the home filtered content, but allows follows (experimental (drop if google dupe/dillution issue)) for the links if they want since they are not duplicates. second one blocks indexing on filters on explicit categories to prevent dupe dynamic categories If InStr(Request.QueryString, "perpage=") > 0 Or InStr(Request.QueryString, "pg=") > 0 Then Response.Write "<meta name='robots' content='noindex'>" End If If InStr(Request.QueryString, "cat=") > 0 And InStr(Request.QueryString, "scri=") > 0 Then Response.Write "<meta name='robots' content='noindex'>" End If %>
![Go to Top of Page](images/icon_go_up.svg)
|
Dermontti
Advanced Member
USA
160 Posts |
Posted - 07/26/2024 : 08:21:17
Another note about canonicals...
If you do not have static URLs for all pages with the SEO redirects or custom IIS 301 rules setup, ALL pages will be reachable in Aa-Zz so you can have multiple versions of the page. I added the toLowercase() for the products to help with this.
The best way is to have entire site as static URLs, but then pages not handled in the rule would still have multiple crawlable/indexable versions:
/faq.asp = /FAQ.asp = /faq.asp = /Faq.asp
etc. etc.
The best thing you can do (to my knowledge) for static pages that have static URLs without creating lots of 301 rules is to cover the cases you know someway in the canonical virtual:
Case "/faq.asp" canonicalURL = "https://www.com/faq.asp" Case "/FAQ.asp" canonicalURL = "https://www.com/faq.asp" Case "/Faq.asp" canonicalURL = "https://www.com/faq.asp"
and also make sure all links point ONLY to the same url (case sensitive) as the canonical. Make sure all URLs are fully lowercase too. You can't control backlinks though...
Please let me know if you have a better way of handling case sensitivities in the URL.
Edited by - Dermontti on 07/29/2024 04:32:02
|
joetuesday
Advanced Member
183 Posts Pre-sales questions only (More Details...)
|
Posted - 07/26/2024 : 14:04:29
I ran into exact same issue with the multi-case urls. The issue I had was that the urls had been that way for so long that when I changed them (on accident really after applying these rules), and set the URL as caonical, that GSC notified me that they had chosen a different canonical page... the old url... So I removed the lowercase enforcement but going forward am only creating pages with lowercases. if I could have my way I'd have an url that didn't pass parameters and / or without .asp as a suffix but that probably would have required better planning on my part - now am kind of stuck in the middle but you live and learn. I don't know of a way to serve some pages as website.com/proddetail.asp?=123-Widget-Red and others as website.com/wall-mounted-toys/blue-widget
Joe
|
Dermontti
Advanced Member
USA
160 Posts |
Posted - 07/29/2024 : 04:50:11
You can do this with the static urls,
You can set the static to /proddetail.asp?=product manually for each legacy product
and /wall-mounted-toys/product for new ones.
However, SEOs warn against empty categories that do no exist like : /wall-mounted-toys/ The default for ECT is /product.
You can see in this post how I edited the handling to get /product/product in this post:
https://www.ecommercetemplates.com/support/topic.asp?TOPIC_ID=115933
I am still debating how to handle the product endpoint without having a global rewrite rule that can potentially affect all pages since /product/product is redundant.
It should be /products/product with categories possibly in between.
Edited by - Dermontti on 07/29/2024 04:53:38
|
joetuesday
Advanced Member
183 Posts Pre-sales questions only (More Details...)
|
Posted - 07/29/2024 : 16:27:33
Dermontti, I read your other post and the rewrite is interesting - still trying to wrap my head around it.
"I am still debating how to handle the product endpoint without having a global rewrite rule that can potentially affect all pages since /product/product is redundant.
It should be /products/product with categories possibly in between."
Why does it have to be "/product/product"?
Joe
|
Dermontti
Advanced Member
USA
160 Posts |
Posted - 07/30/2024 : 05:28:07
Hello Joe,
It doesn't need to be "/product/product" , but this is an easy way to distinguish from the others.
I may see if I can just grab the proddetail.asp and do /product.
I still need to research what is going to be best for SEO.
If you find a good hierarchy online that would work for this platform, please let me know.
|
joetuesday
Advanced Member
183 Posts Pre-sales questions only (More Details...)
|
Posted - 07/30/2024 : 16:44:26
Hi - I apologize again but I still am not quite tracking what you are doing - I think you are using web.config to write the product name and then the on page code to get /products/? COuld you perhaps variablize /products/ to be the first category name that the product is assigned to?
Joe
|
Dermontti
Advanced Member
USA
160 Posts |
Posted - 07/31/2024 : 04:58:15
I have tried that, but the incfuntions, incproducts and inccategories page logic would probably all need to be adjusted.
I found this vid from 8 years ago that still rings true today: https://www.youtube.com/watch?v=hk1P7YfxFbc
I will probably just sticks with /product. I have code in web.config to handle it without affecting other subfolder pages, but still have to carefully comb website to find all file extensions in links etc.:
<!-- Adjusted Product Detail Page Rule --> <rule name="Product Detail Page Match" stopProcessing="true"> <match url="^([^/]+)/?$" /> <conditions logicalGrouping="MatchAll"> <add input="{URL}" pattern="\.asp|\.htm|\.html|\.js|\.php|\.css|\.gif|\.ico|\.jpg|\.png|\.svg|\.webm|\.webp|\.xml|robots\.txt" negate="true" /> <add input="{REQUEST_URI}" pattern="^/(blog|category|products)/" negate="true" /> </conditions> <action type="Rewrite" url="proddetail.asp?prod={UrlEncode:{R:1}}" /> </rule>
|
|
|