Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Search results google type

Quote Reply
Search results google type
I know how to make truncated search results, but it only pulls up the first 100 characters or # of words you imput into the global. Is there any way for the results to appear like google does. If the keyword is down lower on the page, for example at the end of the page, you can have that portion say the 10 words before the keyword and ten words after the keyword, regardless where the keyword if found on the page... if multiple times, it will list multiple iterations of the keyword.

The following does the truncated description:

sub {
my $tags = shift;
my $desc = $tags->{Description} or return "No description on this template";
length $desc < 200 and return $desc;
my $short = substr ($desc, 0, 200);
$short =~ s/\s\S+?$//;
$short .= " ...";
return $short;

Looking for something like <%if query%><%keyword_description%><%else%><%Description%><%endif%>

</not a clue>