Skip to content

Commit 2950514

Browse files
committed
Fix docs search links under base path
1 parent 5723be2 commit 2950514

4 files changed

Lines changed: 9 additions & 47 deletions

File tree

docs/app/mounts/search/modules.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _render_results(self, items, tokens):
6767
li = doc.createElement("li")
6868
li.className = "search-result"
6969
a = doc.createElement("a")
70-
a.href = item["url"]
70+
a.href = self._with_base(item["url"])
7171
a.className = "search-result-link"
7272
section = doc.createElement("div")
7373
section.className = "search-result-section"
@@ -195,6 +195,12 @@ def _prepare(self, docs):
195195
})
196196
return prepared
197197

198+
def _with_base(self, url):
199+
base = browser.__SPRAG_BASE__ or ""
200+
if base and url and url.slice(0, 1) == "/":
201+
return base + url
202+
return url
203+
198204
def _read_query_param(self):
199205
raw = browser.location.search
200206
if not raw or len(raw) < 3:

docs/app/shell.css

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,47 +1433,6 @@ details[open] > .sidebar-section-header::after {
14331433
}
14341434
}
14351435

1436-
/* ─────────────────────────────────────
1437-
Header search
1438-
───────────────────────────────────── */
1439-
1440-
.header-search {
1441-
display: flex;
1442-
align-items: center;
1443-
margin-left: auto;
1444-
margin-right: 0.5rem;
1445-
}
1446-
1447-
.header-search input {
1448-
width: 200px;
1449-
height: 32px;
1450-
padding: 0 0.6rem;
1451-
font-size: 0.85rem;
1452-
border: 1px solid var(--line);
1453-
border-radius: 6px;
1454-
background: var(--bg-subtle);
1455-
color: var(--ink);
1456-
font-family: inherit;
1457-
transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
1458-
}
1459-
1460-
.header-search input::placeholder {
1461-
color: var(--ink-muted);
1462-
}
1463-
1464-
.header-search input:focus {
1465-
outline: none;
1466-
border-color: var(--accent);
1467-
background: var(--bg);
1468-
box-shadow: 0 0 0 3px var(--accent-glow);
1469-
}
1470-
1471-
@media (max-width: 720px) {
1472-
.header-search {
1473-
display: none;
1474-
}
1475-
}
1476-
14771436
/* ─────────────────────────────────────
14781437
Search page
14791438
───────────────────────────────────── */
@@ -1575,4 +1534,4 @@ details[open] > .sidebar-section-header::after {
15751534
padding: 0 2px;
15761535
border-radius: 3px;
15771536
font-weight: 600;
1578-
}
1537+
}

docs/app/shell.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
1111
</svg>
1212
</button>
13-
<form class="header-search" action="/search/" method="get" role="search">
14-
<input type="search" name="q" placeholder="Search docs…" aria-label="Search docs" autocomplete="off">
15-
</form>
1613
<nav class="nav">
1714
<a href="/docs">Docs</a>
1815
<a href="/blog">Blog</a>

sprag/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Public SPRAG framework surface."""
22

3-
__version__ = "0.1.11"
3+
__version__ = "0.1.12"
44

55
from .runtime import dom
66
from .runtime.app import App

0 commit comments

Comments
 (0)