Create Index from Directory Structure
New in v1.0.0
If you want to build an index note on the fly, where it just shows the directory structure of the html output, then you can enable this feature.
By default this feature is turned on, but it will only create a new page at location /obs.html/dir_index.html, which is accessible via the dirtree icon in the top right of the page.
Note: As opposed to Create index from tags, this is not a note selection feature. This is an HTML-only addon that creates a new html page to the HTML output folder, like the Tags Page feature. Overwriting the homepage is optional, and not the default setting.
Example
You can view an index that is created in this way under /obs.html/dir_index.html. This is the default location.
Disable the feature
This feature can take some time to process, especially on older machines. To disable it, simply add this to your config:
toggles:
features:
create_index_from_dir_structure:
enabled: False
Disable the icon
If you like having the dirtree index, but you don't like the icon, then you can disable it by adding this to your config:
toggles:
features:
create_index_from_dir_structure:
styling:
show_icon: False
Exclude folders/files
There is a good chance that you will want to exclude folders and/or files from being shown on the dirtree index page. This is our configuration, for reference:
toggles:
features:
create_index_from_dir_structure:
enabled: True
rel_output_path: 'obs.html/dir_index.html'
styling:
show_icon: True
exclude_subfolders:
- ".git"
- "__src"
- "md"
- "obs.html"
- "Resources"
exclude_files:
- "favicon.ico"
- "not_created.html"
The defaults for these settings can be found via Configuration Options. At the time of writing these are:
toggles:
features:
create_index_from_dir_structure:
enabled: True
verbose: False
rel_output_path: 'obs.html/dir_index.html'
styling:
show_icon: True
exclude_subfolders:
- ".git"
- "md"
- "obs.html"
exclude_files:
- "favicon.ico"
- "not_created.html"
Glob patterns
Added in v3.3.0. Note this only applies to this feature, not the general exclude_folders setting!
Starting with v3.3.0 you can now use glob pattern in the exclude_subfolders
and exclude_files
settings.
For example, to exclude all folders called Assets
, use:
toggles:
features:
create_index_from_dir_structure:
enabled: True
exclude_subfolders:
- ".git"
- "md"
- "obs.html"
- "**/Assets"
Note that you need to list the default values too, because we are overwriting the default settings by providing a value.
To troubleshoot your glob pattern, you can Verbose
Overwrite the homepage
If you want to use the index generated by this feature as your homepage, then a configuration like this might work for you:
toggles:
features:
create_index_from_dir_structure:
enabled: True
rel_output_path: 'index.html'
styling:
show_icon: False
exclude_subfolders:
- ".git"
- "__src"
- "md"
- "obs.html"
exclude_files:
- "favicon.ico"
- "not_created.html"
- "index.html"
Note the rel_output_path
setting. This can also be set to any subpath of the html_output_folder that you wish. The parent folders are automatically created when necessary.
Verbose
There is a global verbosity setting that will make this feature print out extra information. This will print out a lot of info though, so you can also just enable verbosity on just this feature by setting:
toggles:
features:
create_index_from_dir_structure:
verbose: True