mirror of
https://gitdab.com/cadence/breezewiki.git
synced 2026-03-05 13:40:27 -05:00
add rudimentary up navigation
This commit is contained in:
@@ -32,4 +32,7 @@
|
|||||||
(uri-decode (regexp-replace* #rx"#" str "/")))
|
(uri-decode (regexp-replace* #rx"#" str "/")))
|
||||||
|
|
||||||
(define (url-segments->guess-title segments)
|
(define (url-segments->guess-title segments)
|
||||||
(regexp-replace* #rx"_" (cadr segments) " "))
|
(string-join
|
||||||
|
(for/list ([s (in-list (cdr segments))])
|
||||||
|
(regexp-replace* #rx"_" s " "))
|
||||||
|
"/"))
|
||||||
|
|||||||
@@ -235,7 +235,18 @@
|
|||||||
(main (@ (class "page__main"))
|
(main (@ (class "page__main"))
|
||||||
,(extwiki-notice wikiname title req user-cookies)
|
,(extwiki-notice wikiname title req user-cookies)
|
||||||
(div (@ (class "custom-top"))
|
(div (@ (class "custom-top"))
|
||||||
(h1 (@ (class "page-title")) ,title)
|
(h1 (@ (class "page-title"))
|
||||||
|
;; adds rudimentary "up" navigation, e.g. /minecraft/wiki/Bastion_Remnant/Structure/Blueprints/Bastion_treasure_corners_edge_middle_blueprint
|
||||||
|
,@(let ([segments (string-split title "/")])
|
||||||
|
(add-between
|
||||||
|
(for/list ([segment (in-list segments)]
|
||||||
|
[depth (in-naturals 1)])
|
||||||
|
(define anti-depth (- (length segments) depth))
|
||||||
|
(define up-href (string-join (make-list anti-depth "..") "/"))
|
||||||
|
(if (non-empty-string? up-href)
|
||||||
|
`(a (@ (href ,(format "~a/~a" up-href segment))) ,segment)
|
||||||
|
segment))
|
||||||
|
"/")))
|
||||||
(nav (@ (class "sitesearch"))
|
(nav (@ (class "sitesearch"))
|
||||||
(form (@ (action ,(format "/~a/search" wikiname))
|
(form (@ (action ,(format "/~a/search" wikiname))
|
||||||
(class "bw-search-form")
|
(class "bw-search-form")
|
||||||
|
|||||||
Reference in New Issue
Block a user