This project has moved and is read-only. For the latest updates, please go here.

Hide added folders

Oct 21, 2009 at 5:52 PM

I have folders that need to be added but hidden from the contents list in the chm and from the left frame in the html (the namespace/contents tree).

I'm generating the documentation for a library. This documentation includes examples for the different classes. The folders containing the example html and associated images are added to the project so that the example links in the api documentation will display the example html. This appears to work by adding the folders to the project but has the undesirable side effect of showing the example directory structure in the Contents area of the chm file.

Ex. CHM Contents Tab (html is the folder containing the resources that I want hidden):


Is there a way to hide such resources from the contents list?


Oct 21, 2009 at 8:17 PM

There's an ExcludeFromToc option on the project items which is supposed to exclude them from the TOC but it is currently ignored.  I've fixed it for the next release.  As a work around, edit your HTML files and include the following comment somewhere in the content:

<!-- @TOCExclude -->

This will cause it to exclude the topic using the older style exclusion method.



Oct 21, 2009 at 11:05 PM
Edited Oct 21, 2009 at 11:05 PM

Thank you for the quick response!

I looked at the ApiFilter project property and this seems to be the place where I would exclude API. Is there a similar graphical interface for setting the ExcludeFromToc option for html files or is this something that must be added to the project file by hand?


Oct 22, 2009 at 3:33 AM

The ExcludeFromToc option is a property on each project item so it has to be set on each project item in the project explorer.  It's only applicable to items that can appear in the TOC (*.htm, *.html).  The workaround, adding the comment, has to be done by editing each file.  Come to think of it, you could add a sitemap file to the project.  It takes precedence in defining the layout of the content items in the TOC.



Oct 22, 2009 at 6:06 PM

Thank you Eric.

I now see the project item property. I hope I'm not being presumptuous but it would be nice to apply a rule for this property by folder. This could be done with a menu item in the right mouse button drop down menu when clicking in the Project Explorer or allowing this option in the folder properties window. This would be an extreme convenience for users with thousands of non TOC html files.

Thanks again this tool has saved me a significant amount of work!


Oct 27, 2009 at 8:06 PM
Edited Oct 27, 2009 at 8:07 PM

I have not been able to get the html files out of the index by editing the html files. The files and the folder hierarchy still appear in the chm and the html index. Please let me know the placement of "<!-- @TOCExclude -->" looks correct.

<html><head><title>Area Chart</title>

<!-- TOCExclude -->

<h3 class='pdf'>Example: Area Chart</h3>
An area chart is constructed in this example. Three data sets are used and a legend is added to the chart.
using System;
using System.Windows.Forms;


Oct 27, 2009 at 8:50 PM

You're missing the "@" in front of TOCExclude: <!-- @TOCExclude -->.  Placement doesn't matter, it can appear anywhere.



Oct 27, 2009 at 9:59 PM

Thanks, I noticed my error right after posting. I have now updated the html files with the "@" symbol and this seems to exclude the html files but the folder hierarchy is still there. Is there a way to exclude these empty items in the chm index?

I've even tried removing them from the "Folder" ItemGroup but each occasion I try to open this project in SHFB, these lines reappear.


Oct 28, 2009 at 3:54 AM

In each top-level folder that you don't want to appear, create a file that has the same name as the folder with a .htm or .html extention containing nothing but the @TOCExclude tag.  That should get rid of the folder and everything under it.



Oct 28, 2009 at 5:46 PM

I've probably missed something again but this does not appear to be working. Could you indicate where my error is?



I tried one file at the top of the hierarchy:


A file at each directory:


Also multiple contents for each file to be sure I covered any obvious meaning intended:



<!-- @TOCExclude -->

    <!-- @TOCExclude -->

        <!-- @TOCExclude -->

Oct 28, 2009 at 8:59 PM

I was mistaken.  It won't exclude the folder, it just excludes the topic for the folder item.  The intent was to be able to rename the folder in the TOC using a title tag but exclude the topic from being associated with it.  The tags and ExcludeFromTOC property are legacy stuff which isn't used much anymore.  You should create a site map file and use it to define the layout of the HTML files.  It will only include the stuff that you want to have appear.  The other files will still get copied but the site map takes precedence and it's content will determine the structure of the items in the TOC.  If it's empty, you won't see any extra topics at all.  Note that when you add the site map file to the project, it will create a default structure based on the current content items in the project.  You will need to delete the items that you don't want to appear.