FAQ: Creating Indexable Hidden Links for Drop Downs, etc.
Often, you have "interactive links" on your homepage, such as a dropdown that redirects
customers to a certain page. A simple example is shown in the following screenshot:
The sourcecode for this dropdown might look like this (dropdown.asp):
<%
strScriptName = Request.ServerVariables("SCRIPT_NAME")
arrValues = Array("1","2","3")
arrOptions = Array("Site License", "Server License","Enterprise License")
%>
<FORM ACTION="<%=strScriptName%>" METHOD="GET">
<SELECT NAME="LicenseType">
<%
For i=0 To UBound(arrValues)
Response.Write "<option value=""" & arrValues(i) & """>"
Response.Write arrOptions(i)
Response.Write "</option>" & vbCrlf
Next
%>
</SELECT>
<input type="submit" value="Show me!">
</form>
If a spider hits this page, none of the child pages is ever being indexed, because no link
exists to follow. However, you can remedy the situation by creating hidden links to the pages
the user can select via the drop-down. All you have to do is insert links that only spiders
will follow.
The following HTML snippet demonstrates what we want to achieve:
<!--
<a href="/samples/PPF/LicenseType/1/dropdown-hiddenpart.asp" />
<a href="/samples/PPF/LicenseType/2/dropdown-hiddenpart.asp" />
<a href="/samples/PPF/LicenseType/3/dropdown-hiddenpart.asp" />
-->
And how is it done? The following code demonstrates it using the very same data as for the
drop-down. Of course, you can achieve the same effect with information retrieved from a
database (dropdown-hiddenpart.asp).
<!--#include file="ppfhelpers.asp"-->
<%
strScriptName = Request.ServerVariables("SCRIPT_NAME")
arrValues = Array("1","2","3")
arrOptions = Array("Site License", "Server License","Enterprise License")
Response.Write "<!--" & vbCrlf
For i = 0 To UBound(arrValues)
Response.Write "<a href="""
Response.Write GenerateURL_OneParam(strScriptName, "LicenseType", arrValues(i))
Response.Write """ />" & vbCrlf
Next
Response.Write "-->" & vbCrlf
%>
Download the code! (2 KB)
|