Forum OpenACS Q&A: More Google Optimization thoughts for an OpenACS app

I specialize in google optimization and adwords. To that end, I really want to make a change to the openacs photo-album application and I'm looking for thoughts on how to approach it. Basically, I'm making these assumptions, which are fairly well established in the SEO communities:

1. Title tags of an HTML page are extremely important in how google determines relevance, that is, a site will generally only ever be returned extremely high in the search engine result pages (SERPS) for key words and phrases that are in the title tag.

2. Users click on pages in the serps if they see the keywords first (and not later) in the title tag. For instance, if someone types "new york hotel" into google, they're more likely to click on the link in the SERP that says "new york hotel blah blah blah" rather then clicking on a link that says "blah blah hotel brand new york blah" or some other variation where the keyphrase isn't first.

So basically, I'm interested in automating how the photo-album application displays the titles, so that it displays them in a way that is more optimal for search engines like google and for the users of the search engine. (For various reasons, I don't just want it to be another field that the openacs users to add.)

Currently the application simply titles a photo's page with the photo's title. So, for instance, if the picture is a red Accord, which lives in the Honda folder, which lives in the car folder, which is on transportation.com, the page is currently titled, simply, "red accord"

A long time ago, I found it helpful to title my pages similar to the cookie crumb navigation, ie:

domain > category > sub-category > title

The example would be:

transportation.com > cars > honda > red accord

That is good but not optimal. Now I realize that users generally want the detail first and the categories second and the domain/brand last in the title tag.

So ideally, the page would be titled in a reverse cookie crumb, ie:

red accord > honda > cars > transportation.com

I've never written a proc for an openacs application, but I would love to have one for photo-album that would return the cookie crumb navigation data, in reverse order and in text (ie, without the HTML A tags)

Is that even possible? Is that how you'd do it, with a proc or would you just write it into the .tcl file of the photo-view page or something?

Well, of course it's possible, Eric...

If you already have the cookie crumb navigation in a Tcl list or the like, then reversing its order is trivial.

I'm not at all familiar with the photo-album package, but presumably you want to extend the saved caption with the additonal reversed cookie crumb info on the fly, not embed it into the saved caption in the database itself. So, you probably just need to append the cookie crumb stuff to the "caption" Tcl variable after the "get_photo"_info query in "photo-album/www/base-photo.tcl"; perhaps some similar places as well.

Eric,

It's possible yes, and perhaps commonplace to put data through filters to optimize search engine indexing for db backed websites, though I'm not aware of any specific code in the OpenACS api. The following should get you most of the way to having it work for all pages in a standard OpenACS installation.

1. Consider placing it at the end of service0/www/site-master.tcl which has access to context_bar:

proc xyz_remove_html {description} {
# remvoves html from a string
    # reomve tags
    regsub -all -- "<\[^\>\]*>" $description " " description

    # convert fancy delimiter to one that complies with meta tag values
    regsub -all -- "&\#187;" $description ":" description

    # convert bracketed items as separate (delimited) items
    regsub -all -- {\]} $description "" description
    regsub -all -- {\[} $description ":" description

    # convert any dangling lt/gt signs to delimiters
    regsub -all -- ">" $description ":" description
    regsub -all -- "<" $description ":" description

    # remove characters that
    # can munge some meta tag values or how they are interpreted
    regsub -all -nocase -- {\'} $description {} description
    regsub -all -nocase -- {\"} $description {} description

    # remove html entities, such as &trade; &copy; etc.
    regsub -all -nocase -- {&[a-z]+;} $description {} description

    # filter extra spaces
    regsub -all -- {\s+} $description { } description
    set description "[string trim $description]"

return $description }

if {[info exists context_bar} { set context_text [xyz_remove_html $context_bar] set keywords_list [split $context_text :] set len_keywords [llength $keywords_list] set max_keywords $len_keywords set reverse_context_bar [lindex $keywords_list $len_keywords] incr len_keywords -1 for {set i $len_keywords} {$i >= 0 } {incr i -1} { append reverse_context_bar ", [lindex $keywords_list $i]" } # remove a leading blank, if it exists if {[string range $reverse_context_bar 0 1] == ", "} { set reverse_context_bar "[string range $reverse_context_bar 2 end]" } } # reverse_context_bar contains ad_context_bar items in reverse order

2. Then add the following into the service0/www/site-master.adp to push $reverse_context_bar into the blank-master file, where the head section with meta tags are defined:

&lt;if @reverse_context_bar@ not nil&gt;
    &lt;property name="reverse_context_bar"&gt;@reverse_context_bar;noquote@&lt;/property&gt;
  &lt;/if&gt;

3. Add the html head meta tags in service0/www/blank-master.adp

The above code is from some batch scripts. I have added comments to help identify what it does. You may want to add filters to handle different kinds of data. For example if some of the context bar items use abbreviations, you can create other regsub's to expand them.

cheers,