Skip to content

Commit fc901e0

Browse files
authored
feat: add topics sidebar and breadcrumbs navigation (#340)
feat: add topics sidebar and breadcrumbs navigation - Add topics list page and sidebar navigation - Implement search functionality for topics in sidebar - Add breadcrumbs navigation <img width="1728" height="1041" alt="Screenshot 2025-08-24 at 5 40 39 PM" src="https://github.com/user-attachments/assets/beac9792-c59f-41fd-a3f7-e7f3268313e3" /> --------- Signed-off-by: Daniel Phillips <[email protected]>
1 parent 2005395 commit fc901e0

File tree

6 files changed

+79
-4
lines changed

6 files changed

+79
-4
lines changed

content/topics-list/_index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
+++
2+
title = "Topics List"
3+
template = "topics-list.html"
4+
+++

sass/_valkey.scss

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ p {
619619
overflow-x: auto;
620620
background-size: cover;
621621
background-position: center bottom;
622-
position: stiky;
622+
position: sticky;
623623
top: 0px;
624624

625625
@media (max-width: 1100px) {
@@ -2030,13 +2030,16 @@ blockquote {
20302030
.breadcrumb-item {
20312031
align-items: center;
20322032
display: flex;
2033-
2033+
font-size: 14px;
2034+
20342035
img {
20352036
margin-right: 5px;
20362037
}
20372038

20382039
.breadcrumb-link {
20392040
color: #2054B2;
2041+
text-decoration: underline;
2042+
font-weight: 600;
20402043
}
20412044
}
20422045
}

static/img/caret-right.svg

Lines changed: 3 additions & 0 deletions
Loading

templates/docs-page.html

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "right-aside.html" %}
1+
{% extends "left-aside.html" %}
22

33
{% import "macros/docs.html" as docs %}
44

@@ -21,10 +21,26 @@
2121

2222
{% block subhead_content %}
2323
{% if has_frontmatter and frontmatter_title %}
24-
<h1 class="page-title">Documentation: {{ frontmatter_title }}</h1>
24+
<div class="styled-title">
25+
<h1 class="page-title">Documentation: {{ frontmatter_title }}</h1>
26+
</div>
2527
{% endif %}
2628
{% endblock subhead_content %}
2729

30+
{% block breadcrumbs %}
31+
{# Breadcrumbs section #}
32+
<nav class="breadcrumbs">
33+
<ul class="breadcrumb-list">
34+
<li class="breadcrumb-item">
35+
<a href="/topics/" class="breadcrumb-link">Topics</a>
36+
</li>
37+
<li class="breadcrumb-item breadcrumb-current" aria-current="page">
38+
<img src="/img/caret-right.svg" alt="Caret Right Icon" width="8" height="10"/>
39+
{% if frontmatter_title %}{{ frontmatter_title }}{% else %}{{ page.slug | upper }}{% endif %}
40+
</li>
41+
</ul>
42+
</nav>
43+
{% endblock breadcrumbs %}
2844

2945
{% block main_content %}
3046
{% if config.extra.review_list is containing(page.path) %}
@@ -41,6 +57,20 @@ <h1 class="page-title">Documentation: {{ frontmatter_title }}</h1>
4157
{% endblock main_content %}
4258

4359
{% block related_content %}
60+
<h2 id="topic-list-title">Alphabetical Index</h2>
61+
<ul id="topic-list"></ul>
62+
63+
<script>
64+
document.addEventListener("DOMContentLoaded", function() {
65+
var
66+
topicListEl = document.getElementById('topic-list'),
67+
f = fetch("/topics-list/");
68+
69+
f.then((r) => r.text()).then((v) => { topicListEl.innerHTML = v; })
70+
f.catch((error) => { topicListEl.innerHTML = "Could not load topic list."; });
71+
});
72+
</script>
73+
4474
<div class="edit_box">
4575
See an error?
4676
<a href="https://github.com/valkey-io/valkey-doc/edit/main/topics/{{ page.slug }}.md">Update this Page on GitHub!</a>

templates/left-aside.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<div class="left-aside-bg">
66
<div class="left-aside">
77
<main>
8+
{% block breadcrumbs %}{% endblock breadcrumbs %}
89
<div class="main-inner">
910
{% block main_content %}{% endblock main_content %}
1011
</div>

templates/topics-list.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{% import "macros/docs.html" as docs %}
2+
3+
{% set topics_entries = [] %}
4+
{% set topics_section = get_section(path="topics/_index.md") %}
5+
6+
{% for topic_page in topics_section.pages %}
7+
{% set docs_file_contents = docs::load(slug= topic_page.slug) %}
8+
{% set frontmatter = docs::extract_frontmatter(content= docs_file_contents) %}
9+
{% set frontmatter_length = frontmatter | length() %}
10+
11+
{% if frontmatter_length > 0 %}
12+
{% set frontmatter_data = load_data(literal= frontmatter, format="yaml") %}
13+
{% if frontmatter_data.title %}
14+
{% set topic_entry = [
15+
frontmatter_data.title,
16+
topic_page.permalink | safe,
17+
frontmatter_data.description | default(value="")
18+
] %}
19+
{% set_global topics_entries = topics_entries | concat(with= [ topic_entry ]) %}
20+
{% endif %}
21+
{% endif %}
22+
{% endfor %}
23+
24+
{% set alpha_entries = topics_entries | sort(attribute="0") %}
25+
{% for entry in alpha_entries %}
26+
<li class="topic-list-item">
27+
<a href="{{ entry[1] }}">
28+
{{ entry[0] }}
29+
{% if entry[2] %}
30+
<span class="topic-description">{{ entry[2] | safe }}</span>
31+
{% endif %}
32+
</a>
33+
</li>
34+
{% endfor %}

0 commit comments

Comments
 (0)