Re: [htdig] Want BOTH meta description and context excerpt

Subject: Re: [htdig] Want BOTH meta description and context excerpt
From: Gilles Detillieux (
Date: Fri Oct 13 2000 - 13:34:44 PDT

According to
> Is there a way to provide both the meta description and the context excerpt
> in the search results? I can't figure out yet if both get stored or if the
> decision on which to store is made at indexing time.
> My dream is:
> Result Title (star)(star)
> <b>Description:</b>
> The meta description here
> <b>Context excerpt</b>
> ..some misc text from the page which happens to contain the search term ...
> Is this possible?

Hey, anything is possible with open source, if you work at it enough.
In this case, it should only require a simple change to the source.
htdig does store both the meta description and the excerpt in separate
database fields, so the change would be localized to htsearch. Have a
look at htsearch/, around where the Display::displayMatch()
method sets the "EXCERPT" template variable. I think if you add this
line at that point, you'll get a template variable that you can use as
$&(METADESCRIPTION) in your results template (see template_map attribute):

    vars.Add("METADESCRIPTION", new String(ref->DocMetaDsc()));

Of course, you'll want to keep use_meta_description set to false, so you
don't set the EXCERPT variable to the meta description too. You won't
get any highlighting of search words in the description this way either.
If you want that, you'd need to take a look at what Display::excerpt()
does, and do likewise for the meta description.

Gilles R. Detillieux              E-mail: <>
Spinal Cord Research Centre       WWW:
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------ To unsubscribe from the htdig mailing list, send a message to You will receive a message to confirm this. List archives: <> FAQ: <>

This archive was generated by hypermail 2b28 : Fri Oct 13 2000 - 13:39:25 PDT