|
1 |
| -{% extends "right-aside.html" %} |
| 1 | +{% extends "left-aside.html" %} |
2 | 2 |
|
3 | 3 | {% import "macros/command.html" as commands %}
|
4 | 4 |
|
|
34 | 34 | {%- endblock -%}
|
35 | 35 |
|
36 | 36 | {% block subhead_content%}
|
37 |
| -{% if command_title%}<h1 class="page-title">{{ command_title }} {% if deprecated %}<small> {{ deprecated }}</small>{% endif %}</h1>{% endif %} |
| 37 | + {% if command_title%} |
| 38 | + <div class="styled-title"> |
| 39 | + <h1 class="page-title">{{ command_title }} {% if deprecated %}<small> {{ deprecated }}</small>{% endif %}</h1> |
| 40 | + </div> |
| 41 | + {% endif %} |
38 | 42 | {% endblock subhead_content%}
|
39 | 43 |
|
| 44 | +{% block breadcrumbs %} |
| 45 | +{# Breadcrumbs section #} |
| 46 | +<nav class="breadcrumbs"> |
| 47 | + <ul class="breadcrumb-list"> |
| 48 | + <li class="breadcrumb-item"> |
| 49 | + <a href="/commands/" class="breadcrumb-link">Commands</a> |
| 50 | + </li> |
| 51 | + <li class="breadcrumb-item breadcrumb-current" aria-current="page"> |
| 52 | + <img src="/img/caret-right.svg" alt="Caret Right Icon" width="8" height="10"/> |
| 53 | + {% if command_title %}{{ command_title }}{% else %}{{ page.slug | upper }}{% endif %} |
| 54 | + </li> |
| 55 | + </ul> |
| 56 | +</nav> |
| 57 | +{% endblock breadcrumbs %} |
| 58 | + |
40 | 59 | {% block main_content %}
|
41 | 60 | {% if command_data_obj %}
|
42 | 61 | <dl>
|
@@ -205,8 +224,80 @@ <h3>History</h3>
|
205 | 224 | {% endblock main_content %}
|
206 | 225 |
|
207 | 226 | {% block related_content %}
|
208 |
| -<div class="edit_box"> |
209 |
| - See an error? |
210 |
| - <a href="https://github.com/valkey-io/valkey-doc/edit/main/commands/{{ page.slug }}.md">Update this Page on GitHub!</a> |
| 227 | +{# Set up variables for sidebar, similar to commands.html #} |
| 228 | +{% set_global group_descriptions = load_data(path= "../_data/groups.json", required= false) %} |
| 229 | +{% set commands_entries = [] %} |
| 230 | +{% set commands_section = get_section(path="commands/_index.md") %} |
| 231 | +{% for page in commands_section.pages %} |
| 232 | + {% for json_path in [ |
| 233 | + commands::command_json_path(slug=page.slug), |
| 234 | + commands::command_bloom_json_path(slug=page.slug), |
| 235 | + commands::command_json_json_path(slug=page.slug), |
| 236 | + commands::command_search_json_path(slug=page.slug) |
| 237 | + ] %} |
| 238 | + {% set command_data = load_data(path= json_path, required= false) %} |
| 239 | + {% if command_data %} |
| 240 | + {% set command_obj_name = commands::command_obj_name(command_data= command_data) %} |
| 241 | + {% set command_data_obj = command_data[command_obj_name] %} |
| 242 | + {% set command_display = command_obj_name %} |
| 243 | + {% if command_data_obj.container %} |
| 244 | + {% set command_display = command_data_obj.container ~ " " ~ command_display %} |
| 245 | + {% endif %} |
| 246 | + {% set command_entry = [ |
| 247 | + command_display, |
| 248 | + page.permalink | safe, |
| 249 | + command_data_obj.summary, |
| 250 | + command_data_obj.group |
| 251 | + ] %} |
| 252 | + {% set_global commands_entries = commands_entries | concat(with= [ command_entry ]) %} |
| 253 | + {% endif %} |
| 254 | + {% endfor %} |
| 255 | +{% endfor %} |
| 256 | +{% set_global grouped = commands_entries | sort(attribute="3") | group_by(attribute="3") %} |
| 257 | + |
| 258 | +<div class="sb-search-container"> |
| 259 | + <input type="text" id="sidebar-search-box" placeholder="Search within documents" onkeyup="searchSidebarCommands()" /> |
211 | 260 | </div>
|
| 261 | + |
| 262 | +<!-- No results message for sidebar search --> |
| 263 | +<div id="sidebar-no-results-message" class="no-results-message" style="display: none;"> |
| 264 | + <span></></span> |
| 265 | + <h4>No commands found</h4> |
| 266 | + <p>Check your spelling or try different keywords</p> |
| 267 | +</div> |
| 268 | + |
| 269 | +<h2 id="command-list-title">Alphabetical Command List</h2> |
| 270 | +<ul id="command-list"> |
| 271 | +{% set alpha_entries = commands_entries | sort(attribute="0") %} |
| 272 | +{% for entry in alpha_entries %} |
| 273 | + <li class="command-list-item"><code><a href="{{ entry[1] }}">{{ entry[0] }}</a></code></li> |
| 274 | +{% endfor %} |
| 275 | +</ul> |
| 276 | + |
| 277 | +<script> |
| 278 | +function searchSidebarCommands() { |
| 279 | + var input = document.getElementById("sidebar-search-box").value.toLowerCase(); |
| 280 | + var commandList = document.getElementById("command-list"); |
| 281 | + var commandListTitle = document.getElementById("command-list-title"); |
| 282 | + var items = commandList.querySelectorAll(".command-list-item"); |
| 283 | + var noResultsMessage = document.getElementById("sidebar-no-results-message"); |
| 284 | + var totalVisible = 0; |
| 285 | + |
| 286 | + items.forEach(function (item) { |
| 287 | + var text = item.querySelector("a").innerText.toLowerCase(); |
| 288 | + if (text.includes(input)) { |
| 289 | + item.style.display = ""; |
| 290 | + totalVisible++; |
| 291 | + } else { |
| 292 | + item.style.display = "none"; |
| 293 | + } |
| 294 | + }); |
| 295 | + |
| 296 | + // Show/hide no results message and title based on search results |
| 297 | + var hasResults = totalVisible > 0; |
| 298 | + noResultsMessage.style.display = hasResults ? "none" : "block"; |
| 299 | + commandListTitle.style.display = hasResults ? "" : "none"; |
| 300 | + commandList.style.display = hasResults ? "" : "none"; |
| 301 | +} |
| 302 | +</script> |
212 | 303 | {% endblock related_content %}
|
0 commit comments