Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions sass/_valkey.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2410,6 +2410,60 @@ blockquote {
margin: 1.5rem 0 2.5rem;
}

// Previous and next topic links at the end of a topic (nav_pager in
// templates/macros/nav.html). The links look like the docs menu's. "Next"
// stays on the right when there's no "Previous".
.docs-pager {
display: flex;
justify-content: space-between;
gap: 1rem;
margin-top: 4rem;
padding-top: 1.5rem;
border-top: 1px solid #d5d9ec;

a {
display: flex;
flex-direction: column;
max-width: 50%;
padding: 0.6rem 1rem;
border-radius: 4px;
line-height: 1.35;

&:hover {
background-color: #d1d9ff;
}

&:focus-visible {
outline: 2px solid #2054B2;
outline-offset: 1px;
}
}

.docs-pager-next {
margin-left: auto;
align-items: flex-end;
text-align: right;
}

.docs-pager-label {
font-size: 1.3rem;
color: #444;
}

.docs-pager-title {
font-weight: 600;
}

@media (max-width: 768px) {
flex-direction: column;
gap: 0.5rem;

a {
max-width: none;
}
}
}

// Homepage blog cards: text-only cards stacked vertically, matching the release
// cards in the other column.
.homepage-blog-section {
Expand Down
1 change: 1 addition & 0 deletions templates/docs-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ <h1 class="docs-page-title">{{ frontmatter_title }}</h1>
{% endif %}
{%- set content_with_fixed_links %}{{< fix_links_docs content={page_contents} />}}{% endset -%}
{{ content_with_fixed_links | markdown | safe }}
{{< nav_pager nav={nav_data} slug={page.slug} extra={config.extra} />}}
{% endblock main_content %}

{% block related_content %}
Expand Down
43 changes: 43 additions & 0 deletions templates/macros/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,49 @@
{{ 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]] -%}
{%- endfor -%}
{%- set found = false -%}
{%- set last = "" -%}
{%- set prev = "" -%}
{%- set next = "" -%}
{%- for topic in order -%}
{%- if found and not next -%}{%- set_global next = topic -%}{%- endif -%}
{%- if topic == slug and not found -%}
{%- set_global found = true -%}
{%- set_global prev = last -%}
{%- endif -%}
{%- set_global last = topic -%}
{%- endfor -%}
{%- 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 -%}
Expand Down
Loading