Dynamic Page content (Full Version)

All Forums >> [Web Development] >> Search Engine Optimization and Web Business



Message


Athema -> Dynamic Page content (2/24/2009 14:02:09)

Hi ya

I have a few sites that have dynamic page results so the pages change quite often, so I was wondering if anyone here has some code that will generate meta keywords and page description and Title based on the page contents being displayed?

I would consider paying someone to write it for me if anyone is interenested.

Please get in touch if there is someone out there that can help.




Tailslide -> RE: Dynamic Page content (2/25/2009 2:28:10)

If the information is being pulled from a database then you could always add another column or two in the table and add in appropriate information then just pull those from the db at the same time that the rest of the content is being pulled.




TexasWebDevelopers -> RE: Dynamic Page content (2/25/2009 9:10:17)

I am assuming that you want the keywords and title, etc. to change automatically without input just based on the text that is on the page. This isn't possible to do using straight server-side code. If you have the ability to install a .dll on the server that will convert the html to a text string then there are some examples floating around that might be of help. I was playing with the FSO and was able to give a path to an html page and then grab and write out several existing tags -- but that doesn't get you all the way to where you want to go.

<%
'On Error Resume Next
Dim geturl, title, description, keywords, strURL, con, results
Dim fso, file, path

'path = "\inetpub\wwwroot\websitename\default.asp"

' FileSystemObject
Set fso = CreateObject("Scripting.FileSystemObject")

' File Object
Set file = fso.OpenTextFile(path, 1, False)

' Reading the contents of the File into strFileContents
strFileContents = file.ReadAll

' Keywords
key1 = InStr(1, strFileContents, "<meta name=""keywords"" content=""", 1)
key1 = key1 + Len("<meta name=""keywords"" content=""")
key2 = InStr(key1, strFileContents, """>", 1)

keywords = "," & Trim(Mid(strFileContents, key1, (key2 - key1))) & ","
keywords = Replace (keywords, "'", " ")

' Description
desc1 = InStr(1, strFileContents, "<meta name=""description"" content=""", 1)
desc1 = desc1 + Len("<meta name=""description"" content=""")
desc2 = InStr(desc1, strFileContents, """>", 1)

description = Trim(Mid(strFileContents, desc1, (desc2 - desc1)))
description = Replace (description, "'", " ")

' Title
tit1 = InStr(1, lcase(strFileContents), "<title>", 1)
tit1 = tit1 + Len("<title>")
tit2 = InStr(tit1, strFileContents, "</title>", 1)

title = Trim(Mid(strFileContents, tit1, (tit2 - tit1)))
title = Replace (title, "'", " ")

response.write("title: " & title & "<br>")
response.write("description: " & description & "<br>")
response.write("keywords: " & keywords & "<br>")
response.write("url: " & url & "<br>")
response.write("mydate: " & mydate & "<br>")
%>




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125