fancyindex_default_sort

The `fancyindex_default_sort` directive sets the default sorting order for file listings generated by the NGINX Fancy Index module.

Syntaxfancyindex_default_sort name | time | size;
Defaultname
Contexthttp, server, location
Arguments1

Description

The fancyindex_default_sort directive allows users to specify how file listings should be sorted by default when using the Fancy Index module. This directive accepts one argument that defines the sorting criteria, which can be either by name, modification time, or file size. When users access a directory, if no specific sorting parameter is provided in the request URL, NGINX will apply the sorting method defined by this directive as the default behavior.

The accepted arguments for fancyindex_default_sort include name, time, and size, with the naming providing a clear indication of its functionality. For instance, using name will sort the files alphabetically, time will arrange them based on the last modification date, and size will order them according to their size. Moreover, users can choose to apply ascending or descending order by providing an additional argument (e.g., name descending). This flexibility is crucial for providing an optimized user experience when browsing directory listings on a web server.

It is essential to understand the context in which this directive can be utilized; it can be defined within http, server, or location blocks, allowing for granular control depending on the specific requirements of different directories or server setups. By leveraging this directive, administrators can enhance the accessibility and organization of file listings for end-users.

Config Example

location /files {
    fancyindex on;
    fancyindex_default_sort time;
}

Ensure that the Fancy Index module is properly installed and configured before using this directive.

The sorting only applies if no other sorting parameter is specified in the URL request; explicit parameters will override this setting.

← Back to all directives