mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
improve sidebar sorting
Instead of sorting by title then sort_key, sort by sort_key first and then by title within a single sort_key. Also ensure documents without sort_key come after pages with.
This commit is contained in:
parent
44ca35842d
commit
e643c1fc0a
1 changed files with 18 additions and 15 deletions
|
|
@ -6,23 +6,26 @@ layout: default
|
|||
<div class="container" style="padding-top: 24px;">
|
||||
<div class="row">
|
||||
<div class="col-md-3" id="toc" style="padding-top: 16px;">
|
||||
{% for group in toplevels %}
|
||||
{% assign frontdoc=group.docs| where_exp: "doc","doc.path == group.frontpage"|first %}
|
||||
{% for collection in toplevels %}
|
||||
{% assign frontdoc = collection.docs | where_exp: "doc","doc.path == collection.frontpage" | first %}
|
||||
{% unless frontdoc %}
|
||||
{% assign frontdoc=group.docs[0] %}
|
||||
{% assign frontdoc = collection.docs[0] %}
|
||||
{% endunless %}
|
||||
{% capture target %}{% include link.html url=frontdoc.url %}{% endcapture %}
|
||||
<div class="list-group">
|
||||
<a class="list-group-item active" href="{{ target |strip }}">{{ group.caption }}</a>
|
||||
{% if page.collection == group.label %}
|
||||
{% assign subpages = group.docs | sort_natural:"title" | sort:"sort_key" %}
|
||||
{% for doc in subpages %}
|
||||
<a class="list-group-item active" href="{{ target |strip }}">{{ collection.caption }}</a>
|
||||
{% if page.collection == collection.label %}
|
||||
{% assign docs_by_sort_key = collection.docs | group_by:"sort_key" | sort:"name", "last" %}
|
||||
{% for group in docs_by_sort_key %}
|
||||
{% assign docs_sorted = group.items | sort:"title" %}
|
||||
{% for doc in docs_sorted %}
|
||||
{% assign classmodifier="" %}
|
||||
{% if doc.url == page.url %}
|
||||
{% assign classmodifier="disabled" %}
|
||||
{% endif %}
|
||||
{% capture target %}{% include link.html url=doc.url %}{% endcapture %}
|
||||
<a class="list-group-item {{classmodifier}}" href="{{ target |strip }}">{% include title.html doc=doc coll=group %}</a>
|
||||
<a class="list-group-item {{classmodifier}}" href="{{ target |strip }}">{% include title.html doc=doc coll=collection %}</a>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue