Repository navigation
Put the docs menu above the content on phones and add previous/next topic links #773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,13 +166,14 @@ <h1 class="docs-page-title">{{ command_title }} {% if deprecated %}<small> {{ de | |
|
|
||
| {% if command_description %} | ||
| {%- set command_description_with_fixed_links %}{{< fix_links_command content={command_description} />}}{% endset -%} | ||
| {%- set command_description_html %}{{ command_description_with_fixed_links | markdown | safe }}{% endset -%} | ||
|
|
||
| {{ command_description_with_fixed_links | markdown | safe }} | ||
| {{< heading_links content={command_description_html} />}} | ||
| {% else %} | ||
| <code>ERROR. Command description not loaded</code><br /> | ||
| {% endif %} | ||
| {% if command_data_obj.replaced_by %} | ||
| <h3 id="deprecation-advice">Deprecation advice</h3> | ||
| {{< heading_links content='<h3 id="deprecation-advice">Deprecation advice</h3>' />}} | ||
| Instead of using <code>{{ command_title }}</code> use <div class="replaced-by">{{ command_data_obj.replaced_by | markdown | safe }}</div> | ||
|
|
||
| {% endif %} | ||
|
|
@@ -205,7 +206,7 @@ <h3>RESP3 Reply</h3> | |
| {% endif -%} | ||
|
|
||
| {% if command_data_obj and command_data_obj.history %} | ||
| <h3>History</h3> | ||
| {{< heading_links content='<h3 id="history">History</h3>' />}} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be a h2 instead, but changing it in this PR might be scope creep. |
||
| <table> | ||
| <thead> | ||
| <tr> | ||
|
|
@@ -225,6 +226,11 @@ <h3>History</h3> | |
| </table> | ||
| {% endif %} | ||
|
|
||
| {# Every command page, module commands included, is built from a description in valkey-doc (see build/init-commands.sh). #} | ||
| <div class="edit_box"> | ||
| See an error? | ||
| <a href="https://github.com/valkey-io/valkey-doc/edit/main/commands/{{ page.slug }}.md">Update this Page on GitHub!</a> | ||
| </div> | ||
| {% endblock main_content %} | ||
|
|
||
| {% block related_content %} | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -227,6 +227,41 @@ | |||||||||||||
| {{ found | json_encode | safe }} | ||||||||||||||
| {% endcomponent nav_topic_location %} | ||||||||||||||
|
|
||||||||||||||
| {#- | ||||||||||||||
| Links to the previous and next topic in menu order: each section's landing | ||||||||||||||
| page, then its topics, crossing into the next section at the end of one. | ||||||||||||||
| The command reference isn't a topic, so it's skipped. A topic that isn't in | ||||||||||||||
| the menu gets no links. Titles are the topics' own, not the shorter menu | ||||||||||||||
| titles, which only make sense under their section. | ||||||||||||||
| -#} | ||||||||||||||
| {% component nav_pager(nav, slug, extra) %} | ||||||||||||||
| {%- set order = [] -%} | ||||||||||||||
| {%- for section in nav -%} | ||||||||||||||
| {%- if section.landing -%}{%- set_global order = [...order, section.landing] -%}{%- endif -%} | ||||||||||||||
| {%- set_global order = [...order, ...[t.topic for t in section.topics]] -%} | ||||||||||||||
|
Comment on lines
+240
to
+241
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Skip the command reference when building the pager order.
Suggested fix
Committable suggestion
|
||||||||||||||
| {%- endfor -%} | ||||||||||||||
| {%- set at = [i for i in range(end=order | length) if order[i] == slug] -%} | ||||||||||||||
| {%- set i = at | first if at else -1 -%} | ||||||||||||||
| {%- set prev = order[i - 1] if i > 0 else "" -%} | ||||||||||||||
| {%- set next = order[i + 1] if i >= 0 and i + 1 < order | length else "" -%} | ||||||||||||||
| {%- if prev or next %} | ||||||||||||||
| <nav class="docs-pager" aria-label="Previous and next topics"> | ||||||||||||||
| {%- if prev %} | ||||||||||||||
| <a class="docs-pager-prev" href="/topics/{{ prev }}/" rel="prev"> | ||||||||||||||
| <span class="docs-pager-label">Previous</span> | ||||||||||||||
| <span class="docs-pager-title">{{< nav_topic_title slug={prev} extra={extra} />}}</span> | ||||||||||||||
| </a> | ||||||||||||||
| {%- endif %} | ||||||||||||||
| {%- if next %} | ||||||||||||||
| <a class="docs-pager-next" href="/topics/{{ next }}/" rel="next"> | ||||||||||||||
| <span class="docs-pager-label">Next</span> | ||||||||||||||
| <span class="docs-pager-title">{{< nav_topic_title slug={next} extra={extra} />}}</span> | ||||||||||||||
| </a> | ||||||||||||||
| {%- endif %} | ||||||||||||||
| </nav> | ||||||||||||||
| {%- endif %} | ||||||||||||||
| {% endcomponent nav_pager %} | ||||||||||||||
|
|
||||||||||||||
| {#- A topic's title: `title` if set, otherwise the title in the topic's front matter. -#} | ||||||||||||||
| {% component nav_topic_title(slug, extra, title="") %} | ||||||||||||||
| {%- if title -%}{{ title }}{%- else -%} | ||||||||||||||
|
|
||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the menu before the content in DOM order.
Below 1024px,
order: -1places the menu above the content visually. However,mainstill precedesasidein the template. Keyboard users must traverse the content links before they reach “Documentation menu.” CSSorderdoes not change sequential keyboard navigation. (w3.org)Move the aside before main in
templates/left-aside.html. Adjust the desktop flex direction to keep the aside on the left. This preserves the desktop layout and makes narrow-screen keyboard order match visual order.