Include document title in search results

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
zappy0
Propeller Head
Posts: 37
Joined: Fri Mar 25, 2016 2:19 pm

Include document title in search results

Post by zappy0 »

I recently created a consolidated documentation site that allows our users to search across all of the documentation. Each Flare project uses the tri-pane template and the consolidated site also uses the tri-pane template. The output target is HTML5. The consolidated site includes dozens of documents that contain thousands of topics. When a user searches for a term such as "login" the search results include topics for how to login to the application as well as topics dealing with the login method for the API. Each record in the search results has a topic title and an abstract built from the topic content. In some cases, I have manually created a topic's abstract via the Topic Properties. The URL starting with /Subsystems/ is also displayed. Is there a way I can include the document title in the search results? I have a variable docTitle that I use on the master page so than the reader knows what document they are viewing after selecting a record in the search results. However, it would be nice to include the document title in the search result records. The reader can look at the URL starting with /Subsystems/to figure out the document the topic resides within, but that is tedious.
zappy0
Propeller Head
Posts: 37
Joined: Fri Mar 25, 2016 2:19 pm

Re: Include document title in search results

Post by zappy0 »

I'll post my likely solution here in case others come across this post. I have tested this on a few small projects and it appears to work. I already have a variable named docTitle in every Flare project.

I added [%=Primary.docTitle%]: to the Topic Title field on the Topic Properties for every topic. It appears I can use search and replace across all topics: "<title>" becomes "<title>[%=Primary.docTitle%] -- "

I end up with topic titles such as "[%=Primary.docTitle%] -- Overview"

However, in my TOC, I was using [%=System.LinkedTitle%]. Thus all of my TOC entries now had the document title. To fix that, I changed the TOC entries to use [%=System.LinkedHeader%] so that each TOC was displaying the first H1 in the topic.

Now, when I do a search in the consolidated documentation site, or the stand-alone document, the search results have the document title + topic title in the first hyperlinked line. It gets a bit lengthy at times, but at least my reader knows what document the topic resides within. This is especially important in the consolidated documents site.
kmorrison
Sr. Propeller Head
Posts: 104
Joined: Mon Nov 11, 2013 3:04 pm
Location: Ottawa, Canada
Contact:

Re: Include document title in search results

Post by kmorrison »

That is almost identical to the solution I came up with. It's working well for us.
Post Reply