+ # URLs in `base`, `displayurl`, `cururl` are normalized to remove trailing slashes. This is to be able to distinguish the root of a folder from its children by the number of slashes in the URL.
+ # We need this to treat the root of a folder as a direct child of the parent folder, whereas pages within a subfolder are of course grandchildren.
result = Array.new
for page in pages
result = Array.new
for page in pages
- cururl = page['url'].sub('/index.html', '')
+ cururl = page['url'].chomp('/')
+ # Test if this page is a non-hidden *direct* child of `base`
if cururl.start_with?(base) and cururl.count('/') == base.count('/') and (not page['hide'])
# figure out CSS class
if cururl == displayurl
if cururl.start_with?(base) and cururl.count('/') == base.count('/') and (not page['hide'])