Hi, On Thu, Mar 01, 2018 at 05:27:49PM +0100, Luciano Mannucci wrote: > On Thu, 1 Mar 2018 12:16:34 +0000 > Miguel C <miguelmcl...@gmail.com> wrote: > > > there's a default sorting option for name/data etc > > https://github.com/aperezdc/ngx-fancyindex#fancyindex-default-sort > > > > I do see a default_sort as a directive but not for "ascending" "descending" > > (doesn't since supper hard to implement in the code though, but I'm not a C > > expert.... > Yes, it sould'nt be that hard... :) > > > Vladimir Homutov just suggested a different approach with the autoindex > > module and xslt that seems to serve you're need, and that way there's no > > need to install a 3rd party moduel :) > I'm not comfortable with XML/XSLT, so I just made a small hack to the > original autoindex that is quite enough for me (=works and made my > users happy :). > > If there is some interest I can post my patch to the apropriate list > (nginx devel, if I recall correctly :).
Just in case you'll get back to XML/XSLT, here's a simple configuration to sort the files: location / { autoindex on; autoindex_format xml; xslt_stylesheet conf/sort.xslt; root html; } sort.xslt: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <table border="1"> <xsl:for-each select="list/*"> <xsl:sort select="text()"/> <tr> <td><xsl:value-of select="text()"/></td> <td><xsl:value-of select="@mtime"/></td> <td><xsl:value-of select="@size"/></td> </tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> -- Roman Arutyunyan _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx