From c97f6ba26f8d091a3f6075e40464e4e3aca67fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?lollipopkit=F0=9F=8F=B3=EF=B8=8F=E2=80=8D=E2=9A=A7?= =?UTF-8?q?=EF=B8=8F?= <10864310+lollipopkit@users.noreply.github.com> Date: Mon, 22 Jul 2024 20:18:22 +0800 Subject: [PATCH] new: `file_server.sort` --- src/docs/markdown/caddyfile/directives/file_server.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/docs/markdown/caddyfile/directives/file_server.md b/src/docs/markdown/caddyfile/directives/file_server.md index 6434e3e..bcd9d8d 100644 --- a/src/docs/markdown/caddyfile/directives/file_server.md +++ b/src/docs/markdown/caddyfile/directives/file_server.md @@ -40,6 +40,7 @@ file_server [] [browse] { status disable_canonical_uris pass_thru + sort } ``` @@ -69,6 +70,12 @@ file_server [] [browse] { - **pass_thru** enables pass-thru mode, which continues to the next HTTP handler in the route if the requested file is not found, instead of triggering a `404` error (invoking [`handle_errors`](handle_errors) routes). Practically, this is only useful inside of a [`route`](route) block with other handler directives following `file_server`, because this directive is effectively [ordered last](/docs/caddyfile/directives#directive-order). +- **sort** specifies how to sort directory listings. The `options` can be `sortBy` and `order` separated by spaces. + + - **sortBy** can be one of `name`, `size`, `time`. Default: `name` + + - **order** can be one of `asc` or `desc`. Default: `asc` + ## Examples A static file server out of the current directory: