by default geoserver shows layers alphabetically sorted in wms/wfs/wcs capabilities
in wms you can change this behaviour by adding all layers to a (container-tree) layer group and sort the layers as part of the layergroup
however i would also like to introduce this behaviour on the rootlayer/toplayer, so we don't need an additional layergroup-level.
on the mailinglist it was suggested to add a numeric field to each layer configuration that contains a number by which the layer is ordered. In later iterations the UI to fill that number can be optimised to show for example an advanced tree view.
layer configuration gets a field "sorting-index", if empty default value=99999 (sorted last)
in wms/wcs/wfs capabilities sort layers in rootlayer according to sorting-index
layers in layergroup keep the current layergroup-sorting (sorting-index is skipped)
for virtual services (eg /geoserver/workspace/wms) the same sorting-index value is used
the use case for this is for example when a server contains layers forest_2016, forest_2015, forest_2014... etc, in that case they would want forest_2016 on top so it is easy to select when adding that service to a map (in for example qgis)
this issue is an alternative to https://osgeo-org.atlassian.net/browse/GEOS-7971, which was not adviced in the mailinglist