-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new: file_server.sort
#407
base: master
Are you sure you want to change the base?
Conversation
I'm sorry for opening this PR before the related PR is accepted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the docs! Just a few changes needed I think.
@@ -40,6 +40,7 @@ file_server [<matcher>] [browse] { | |||
status <status> | |||
disable_canonical_uris | |||
pass_thru | |||
sort <options...> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort <options...> | |
sort <sort_field> [<direction>] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to be moved to within the browse
subdirective block above
@@ -69,6 +70,9 @@ file_server [<matcher>] [browse] { | |||
|
|||
- **pass_thru** <span id="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** <span id="sort"/> specifies how to sort directory listings. The options are sortBy (`name`, `namedirfirst`, `size`, `time`) and order (`asc` or `desc`) separated by spaces. The first option must be `sortBy`, and the second option must be `order` (if exists). For example, `sort name desc` will sort by name in descending order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- **sort** <span id="sort"/> specifies how to sort directory listings. The options are sortBy (`name`, `namedirfirst`, `size`, `time`) and order (`asc` or `desc`) separated by spaces. The first option must be `sortBy`, and the second option must be `order` (if exists). For example, `sort name desc` will sort by name in descending order. | |
- **sort** <span id="sort"/> changes the default sort for directory listings. The first parameter is the field/column to sort by: `name`, `namedirfirst`, `size`, or `time`. The second argument is an optional direction: `asc` or `desc`. For example, `sort name desc` will sort by name in descending order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to be moved up into the sub-list of browse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to browse
, but the location of sort
config...
It seems I need to change the caddy code again.
file_server browse {
sort size desc
}
file_server {
browse {
sort size desc
}
}
Change 1 to 2? or make both valid, but 2 has higher priority? or just keep current?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question; I think the first one is not really a thing; i.e. it's just a shorthand for the default browse (no block).
So aim for the second one. Just put it inside the existing browse block. 👍
No description provided.