I am trying to adjust NameWidth while using HTMLTable but without success.
Consider these settings (# = comment):
<IfModule mod_autoindex.c>
IndexOptions FancyIndexing
IndexOptions HTMLTable
IndexOptions IconsAreLinks
IndexOptions SuppressDescription
IndexOptions SuppressLastModified
IndexOptions SuppressColumnSorting
#IndexOptions IconWidth=20
#IndexOptions IconHeight=20
IndexOptions NameWidth=*
IndexOrderDefault Descending Name
HeaderName header.html
ReadmeName footer.html
</ifModule>
With the above settings, an in-browser directory listing reveals that the WIDTH of the Name column is hardly wider than the width of the longest filename. Filenames are not truncated, but the right edge of the longest filename is only 1 character away from the next column. I wish to make the Name column wider than the longest filename, so there is more whitespace separating the right side of the filenames with the next column to the right. I can accomplish that (add extra whitespace horizontally) by deleting or commenting-out "IndexOptions HTMLTable". But disabling "HTMLTable" causes the icons to no longer be vertically centered with their associated filenames. And yes, I wish to retain the icons. Changing IconWidth & IconHeight does not fix vertical centering issues. I used header.html and footer.html to add a page title and a return link, but those files don't affect the directory listing content.
How do I resolve this?
Thank you.
This can actually be done using only Apache directives. I'm very late answering this question, but I'm leaving this for future reference. This works for Apache v2.2+.
You can use CSS to style individual columns/elements using the
IndexStyleSheet
directive:Add an
IndexStyleSheet
directive just before yourHeaderName
line e.g.IndexStyleSheet /url/to/css/index_body.css
In
index_body.css
, set your preferred column padding withpadding-left
andpadding-right
properties and includealign
properties to replace the default HTMLalign
tags that will be automatically removed.th
classes refer to the column header labels;td
classes refer to the column contents; CSS class names are in the formatindexcol<column name>
:IndexOptions SuppressHTMLPreamble
directive, the resulting Index page HTML will not automatically include a link to yourIndexStyleSheet
URL. You can manually add a link to yourHeaderName
file (header.html
, for this question):Some additional resources:
Official Apache documentation for IndexStyleSheet
A GitHub project that allows you to theme your index listings