index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2021-12-13 10:05:33.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2021-12-13 10:05:33.0 +00:00:00
commit
018b27c2d43ef165e63e9f12e442c1f063ff7158 [patch]
tree
77ef30e9cc8d36652b71a3222e1b81993317d33a
parent
46e636cd348b15f654b253563f1707137baf4f85
download
018b27c2d43ef165e63e9f12e442c1f063ff7158.tar.gz

docs: clarify dir listing sorting [skip ci]



Diff

 docs/content/examples/directory-listing.md | 28 +++++++++++++++++++---------
 docs/docker-compose.yml                    |  2 +-
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/docs/content/examples/directory-listing.md b/docs/content/examples/directory-listing.md
index db4ffef..6524346 100644
--- a/docs/content/examples/directory-listing.md
+++ b/docs/content/examples/directory-listing.md
@@ -17,28 +17,38 @@ And here an example of how the directory listing looks like.

## Sorting

Ascending and descending ordering of files/dirs by their attributes are provided by the numeric `--directory-listing-order` option or the equivalent [SERVER_DIRECTORY_LISTING_ORDER]./../configuration/environment-variables.md#server_directory_listing_order env.
Sorting by `Name`, `Last modified` and `Size` is enabled as clickable columns when directory listing is activated via the `--directory-listing=true` option.

The possible number code values are grouped by attribute as follows:
You can also use the `sort` query parameter to sort manually by certain attribute from URI. E.g `https://localhost/?sort=5`.

## Sorting by default

Some times one wants to sort by certain attribute but by **default**. In that case default ascending or descending ordering of files/dirs by their attributes is provided by the numeric `--directory-listing-order` option or the equivalent [SERVER_DIRECTORY_LISTING_ORDER]./../configuration/environment-variables.md#server_directory_listing_order env.

To do so you have to pass a [code sorting number]#code-numbers-for-sorting. E.g `--directory-listing-order=2`.

## Code numbers for sorting

Below the possible number code values for sorting/ordering which are grouped by attribute.

### Name

- 0: Ascending
- 1: Descending
- `0`: Ascending
- `1`: Descending

### Last modified

- 2: Ascending
- 3: Descending
- `2`: Ascending
- `3`: Descending

### Size

- 4: Ascending
- 5: Descending
- `4`: Ascending
- `5`: Descending

### Default

- 6: Unordered
- `6`: Unordered

!!! info "Tips"
    - The `--directory-listing-order` option depends on `--directory-listing` to be enabled.
diff --git a/docs/docker-compose.yml b/docs/docker-compose.yml
index 7229b8f..021484e 100644
--- a/docs/docker-compose.yml
+++ b/docs/docker-compose.yml
@@ -5,6 +5,6 @@ services:
      context: .
      dockerfile: Dockerfile
    ports:
      - 8088:8000
      - 8000:8000
    volumes:
      - ./:/docs