12 Replies Latest reply on Feb 15, 2008 11:58 AM by Chet Zeshonski

    Hiding some topics from Search mechanism


      I have some html pages, which i have used as popup in some topics. But i want to hide these html pages from the Search mechanism.

      I tried changing the html ext to xhtml and importing it as baggage file (i came across this sometime back when i was generating HTML Help). But this will restrict the html page from appearing as popup.

      Is there any solution?

      Pls suggest...
        • 1. Re: Hiding some topics from Search mechanism
          RoboWizard Level 4
          Hi ezee beee

          The method of renaming and importing as baggage should in no way restrict your using the topic as a popup. You simply provide the correct path and file name and things should still work as expected.

          Cheers... Rick
          • 2. Re: Hiding some topics from Search mechanism
            Level 1
            There's another way. I'll give the steps first, then explain what it does:

            1. Create an "ExcludeFromSearch" conditional build tag.
            2. Attach the tag to each popup topic.
            3. Define the build expression for your project so that it excludes the "ExcludeFromSearch" tag.
            4. Publish the WebHelp system to the server.
            5. Go to the WebHelp output directory.
            6. Open the whdata folder.
            7. Copy the whftdata0.htm and whfwdata0.htm files to another location.
            8. Go back to the WebHelp output directory, and then open the whxdata folder.
            9. Copy the whftdata0.xml and whfwdata0.xml files to another location.
            10. Edit the build expression so that it includes all topics (i.e.., remove the "ExcludeFromSearch" tag from the expression).
            11. Publish the project again.
            12. Copy the files you saved in steps 7 and 9 to the correct folders in the WebHelp directory on your server.
            13. Run the WebHelp system. Only the unmarked topics will be included in the Search function.

            What It Does: The HTM and XML files contain the information that relates to the Search function. Essentially, copying the first-project files over the second-project files tricks the project into thinking that the tagged topics aren't in the project. So they're available for viewing, but not searching.

            P.S. Steps for a WebHelp Pro project are different. The steps given here work for normal WebHelp output only.
            • 3. Re: Hiding some topics from Search mechanism
              Roger N Level 2
              Here's yet another way, using JavaScript. I'm just cutting and pasting this from another post long ago, and far away....

              You'll be altering a script found in a .js file that displays the topics in the Search pane.

              Basically, you're telling the displayTopics() function to skip files with your special 6-character prefix. You don't need to alter the way you call your popups, just change the filenames of the files to hide, and add the bit-o-script to the .js file at the Webhelp root.

              1) add the text 'popup_' to the front of the filename of each file you wish to hide. Or, use your own term to denote hidden files.

              2) In the generated WebHelp folder, open whfhost.js; edit the function displayTopics(); by replacing the part of that function found in whfhost.js that looks like the first snip, and replacing it with the second, prettier script.

              ====== note: ===========
              there are two almost identical lines, one version for testing on your workstation, the second to actually use when posting on the server. Move the comment slashes from the second to the first version before you post it online.

              var Search_xstart = Search_URL.lastIndexOf("\\") + 1 // TEST LOCALLY - start of filename -
              // var Search_xstart = Search_URL.lastIndexOf("/") + 1 // USE WHEN ONLINE - start of filename -

              • 4. Re: Hiding some topics from Search mechanism
                HKabaker Level 2

                When I need to generate a nearly identical version of WebHelp, I duplicate the layout , edit the second one and give it a new name. This helps me remember what I generated.

                A variation on Chet's method:

                Generate and publish WebHelp, filtering out the "ExcludeFromSearch" items (Steps 1 through 4).

                Generate WebHelp with the layout that doesn't exclude those items.

                Publish with "Prompt before overwriting files" selected and approve them one at a time (not many will change), but do not approve overwriting any of the files in whdata, wgdata and wxdata.

                This should add the excluded files to the published WebHelp but leaving the filtered search database.

                There's another method, not for the fainthearted, because it requires breaking a basic RH rule:
                With the project closed (not active in RH) go into the project directory in Windows and move the files you want excluded from the search database. Put them in a safe place outside the project folder.

                Launch the project, generate as usual (you don't have to use an "exclude" tag), and publish the project. RH will build the search databases from the files it can see, and will omit links to the missing files.

                The missing files will appear in the RH project directory with a red X.
                Import the missing files. Generate again with "Prompt before overwriting files" selected (this time RH will include links) and approve changes one by one, but do not approve overwriting any of the files in whdata, wgdata and wxdata.

                The tradeoffs:

                Revising file names and Inserting code suggested by Roger,
                Applying the exclude tag and saving the filtered search databases,
                Applying the exclude tag and not allow overwriting of the filtered search databases,
                Moving and re-importing excluded files and publishing changes one by one.

                If you have a lot of files to exclude, the last method may save some time.
                Otherwise, it looks like a wash.

                • 5. Re: Hiding some topics from Search mechanism
                  ezee_beee Level 1
                  Hi Guys,

                  First of all i apologise for replying so late. Thanks for your replies. Will soon try your suggestions.
                  • 6. Re: Hiding some topics from Search mechanism
                    ezee_beee Level 1
                    If the topic i want to hide from the Search mechanism is a target of a hyperlink from another topic, will this hyperlink work if i use any of your suggestion.

                    Pls suggest...
                    • 7. Re: Hiding some topics from Search mechanism
                      Level 1
                      In the solution I posted, all the topics in your project are available, and all the links should work fine. Certain topics are simply omitted from the search results. I suggest that you create a new blank project, create some test topics, pick a method, and try it out. You'll soon discover which method works best for you.
                      • 8. Re: Hiding some topics from Search mechanism
                        Roger N Level 2
                        yes - they should all work... Wouldn't be much good, otherwise, eh?
                        • 9. Re: Hiding some topics from Search mechanism
                          HKabaker Level 2
                          ezee bee ,

                          I can understand why you asked the question.

                          If you use the last method :
                          1. moving files to be excluded out of the project folder,
                          2. generating to compile the search,
                          3. publishing,
                          4. reimporting the files,
                          5. generating again
                          6. publishing again, but suppressing the search output

                          After step 3, links to the excluded files are omitted in the output, but they remain in your project source files as missing links. As you import the excluded files back into your project (4), the missing links are repaired. The next time you generate (5) and publish (6), the formerly excluded files are published, as well as any revised files with links to them.

                          (I'm assuming the no-search files are not in the TOC.)


                          • 10. Re: Hiding some topics from Search mechanism
                            ezee_beee Level 1

                            I think the suggestion by Chet is not complete in the context of my project where i want to hide multiple files. The step 7 and 9 asks to copy only four files, which i did but it did not hid all the html files.

                            There is similar procedure on Rick's Skinny on Skins WebHelp file, which asks to copy whftdataN.htm, whfwdataN.htm, and whfts.htm.

                            (N represents a number. It begins at 0 and increments until an unspecified number exists. The actual ending number will vary, depending on the complexity of the WebHelp system being generated.)

                            This method works...

                            Thanks to all your suggestions...
                            • 11. Re: Hiding some topics from Search mechanism

                              Hi Chet,

                              I followed steps 1-9 with no problem, but when I got to step 10 I got lost. Waht file am I editing? All of the files I copied to other directories?

                              Judy H.
                              • 12. Re: Hiding some topics from Search mechanism
                                Level 1

                                Step 10 is performed in RoboHelp itself. For step 10, go back into RH, generate your output a second time, but include all topics in your build expression.

                                So, basically, the process goes like this:

                                1. Create an "exclude" tag.
                                2. Apply the tag to the topics you want to exclude from the search.
                                3. In RH, generate your output, defining your build expression as "NOT exclude."
                                4. Go to the output directory and copy the four files in the whdata folder to another location.
                                5. In RH, generate your output a second time to the same directory, but don't exclude the tagged topics. (This is step 10 in my previous list.)
                                6. Go to the output directory and overwrite the four new files in the whdata folder with the files you copied in step 4.

                                When you are finished, your pop-ups and such should work fine, but the topics you tagged as 'exclude' will not appear in the search results. Remember that this is the WebHelp approach. If you're publishing a WebHelp Pro project, the instructions are slightly different. (In a nutshell, you publish the whole thing first and the "exclude" subset second.)