1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-16 05:18:19 +00:00
node-feature-discovery/docs/_includes/class/addons-wrap.liquid
Markus Lehtonen c05c6f2e5b docs: make the list of available versions dynamic
Make the list of available versions dynamic. The items displayed is now
generated with javascript. The parent directory of the site is supposed
to contain versions.js providing getVersionListItems() that returns the
available versions.

The update-gh-pages.sh script is modified to update/create versions.js
on every invocation. It simply lists all directories in the root
directory and adds them to the version list.
2020-10-22 21:44:49 +03:00

51 lines
2.1 KiB
Text

<div class="addons-wrap d-flex flex-column overflow-y-auto">
<div class="branch">
<dl>
{% if site.display_version_list %}
<dt id="versions">Versions:</dt>
{% comment %}
Drop the last component from site.baseurl which is supposed to
be pointing to a subdirectory of the true site baseurl.
{% endcomment %}
{% assign spliturl = site.baseurl | split: "/" %}
{% assign last = spliturl.size | minus: 1 %}
{% assign baseurl = spliturl | slice: 0, last | join: "/" %}
<script src="{{ baseurl }}/versions.js"></script>
<script>
var dt = document.getElementById('versions');
var items = getVersionListItems();
for (var i=0; i < items.length; i++) {
var dd = document.createElement('dd');
var a = dd.appendChild(document.createElement('a'));
a.appendChild(document.createTextNode(items[i].name));
a.href = items[i].url;
dt.appendChild(dd);
}
</script>
{% endif %}
</dl>
</div>
<div class="status d-flex flex-justify-between p-2">
<div class="title p-1">
<i class="fa fa-book"></i> {{ site.title }}
</div>
<div class="branch p-1">
<i class="fa fa-caret-down"></i>
</div>
</div>
<div class="addons d-flex flex-column height-full p-2 d-none">
{%- assign items = "github" | split: ", " -%}
{% for item in items -%}
{% include addons/{{ item }}.liquid %}
{% endfor -%}
<hr>
<div class="generator f6 pb-2">
Built with
<a href="https://github.com/rundocs/jekyll-rtd-theme" target="_blank" title="{% if site.remote_theme %}remote{% endif %} theme v{{ version }}">jekyll-rtd-theme</a>
provided by
<a href="https://rundocs.io" target="_blank">RunDocs</a>
</div>
</div>
</div>