Searchable but hidden text in HTML

January 14, 2008

If you have text/content that you want people such as reviewers and developers to find via a search, but you don’t want that text visible to everyone else, then consider setting up a ‘hidden’ paragraph or character style. The content you apply that style to will be invisible to the general reader but those who know about it can search for it and view it.

For example, technical documentation I wrote for a client was very much in the beta stage and the internal staff needed to be able to see which ‘Use Cases’ each topic applied to. However, external clients didn’t need this information—in fact, it was meaningless to them. The internal staff needed the ability to search on a particular use case number in the online help and get those topics listed in the search results.

What I did to meet both needs was:

  1. Create a paragraph style called “Use case” that had white text on a white background in the CSS, and was styled in red for the view that the author sees in Author-it.
  2. Add a new line with “Use Case: #” (where # represents the Use Case number) to the end of each topic related to a particular Use Case.
  3. Apply the “Use case” style to that last line.

In the HTML or CHM output these lines never showed but they were searchable. If a developer wanted to see all user documentation topics related to Use Case 68, they only had to do a search for 68. Or if they dragged their cursor over the last few lines of a topic they’d see the ‘hidden’ text for the Use Case that it related to.

The internal staff were told how to use this, but not the end users. It would only be by chance that an end user would ever come across the Use Case number.

You could do something similar using Author-it’s system variable for the object ID. Add it to the bottom of each topic (perhaps add it to your normal topic template so you don’t have to remember to add it each time), and style it with something that displays as ‘hidden’. Chances are only you and perhaps one or two others will EVER want to know the object ID. It’s still searchable, just not immediately viewable by end users.

One comment

  1. Why didn’t you use visibility: hidden; in the default stylesheet but had an that suggested making the text visible.
    Then the end-users would have no idea about this, but internal staff could switch to the other stylesheet. That way they wouldn’t even have to search for ’68’, but if they wanted to preview it as the end-user would see it — they would simply switch to that stylesheet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: