go-ethereum/_layouts/sidebar.html
edualb 43605ac8b2
docs: tutorial for bash autocomplete (#24398)
* including tutorial for bash autocomplete

- included the Bash Autocomplete in sidebar.yml
- created a new file called Bash-Autocomplete.md with a tutorial to include a bash autocomplete.
This tutorial was based on:
	- https://github.com/urfave/cli/blob/master/docs/v1/manual.md#enabling
	- https://github.com/urfave/cli/blob/master/docs/v2/manual.md#powershell-support

* Update docs/_interface/Bash-Autocomplete.md

- From "Creates" to "Create" in Windows tutorial

Co-authored-by: ligi <ligi@ligi.de>

* Update docs/_interface/Bash-Autocomplete.md

- From "Creates" to "Create" in Linux/MacOS tutorial

Co-authored-by: ligi <ligi@ligi.de>

* (_layouts): redirect to first element in documentation

- Problem: The sidebar was redirecting to the wrong element
in the list when we click on that. It was occuring because the logic inside of sidebar.html
to build the list-group-item was carry about the frontdoc.url instead of the first element by itself.

- Solution: We are sorting the collection.docs and then build the
list-group-item with the right element in the list.

Co-authored-by: ligi <ligi@ligi.de>
2022-10-11 16:20:38 +02:00

40 lines
1.7 KiB
HTML

---
layout: default
---
{% assign toplevels = site.collections | where_exp: "item", "item.sidebar_index" | sort:"sidebar_index" %}
<div class="container" style="padding-top: 24px;">
<div class="row">
<div class="col-md-3" id="toc" style="padding-top: 16px;">
{% for collection in toplevels %}
{% assign frontdoc = collection.docs | where_exp: "doc","doc.path == collection.frontpage" | first %}
{% unless frontdoc %}
{% assign frontdoc = collection.docs[0] %}
{% endunless %}
{% assign docs_by_sort_key = collection.docs | group_by:"sort_key" | sort:"name", "last" %}
<div class="list-group">
<a class="list-group-item active" href="{{ docs_by_sort_key[0].items[0].url }}">{{ collection.caption }}</a>
{% if page.collection == collection.label %}
{% 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=collection %}</a>
{% endfor %}
{% endfor %}
{% endif %}
</div>
{% endfor %}
</div>
<div class="col-md-9" id="content">
{% if page.title %}
<h1 class="featurette-heading">{% include title.html doc=page coll=page.collection %}</h1>
{% endif %}
{{ content }}
</div>
</div>
</div>