Compact the main nav a little more effectively
This commit is contained in:
parent
70e0790fe9
commit
0b9c0f28bd
|
@ -85,11 +85,7 @@
|
||||||
,(bootstrap-project-name))))
|
,(bootstrap-project-name))))
|
||||||
(div ((id "navbar") (class "collapse navbar-collapse"))
|
(div ((id "navbar") (class "collapse navbar-collapse"))
|
||||||
(ul ((class "nav navbar-nav"))
|
(ul ((class "nav navbar-nav"))
|
||||||
,@(for/list ((n (bootstrap-navigation)))
|
,@(render-nav-items (bootstrap-navigation)))
|
||||||
(match-define (list text url) n)
|
|
||||||
`(li ,@(maybe-splice (equal? text (bootstrap-active-navigation))
|
|
||||||
`((class "active")))
|
|
||||||
(a ((href ,url)) ,text))))
|
|
||||||
,@(bootstrap-navbar-extension)
|
,@(bootstrap-navbar-extension)
|
||||||
)))
|
)))
|
||||||
(div ((class "container"))
|
(div ((class "container"))
|
||||||
|
@ -105,6 +101,28 @@
|
||||||
,@(for/list ((script (bootstrap-page-scripts)))
|
,@(for/list ((script (bootstrap-page-scripts)))
|
||||||
`(script ((type "text/javascript") (src ,script))))))))
|
`(script ((type "text/javascript") (src ,script))))))))
|
||||||
|
|
||||||
|
(define (render-nav-items items)
|
||||||
|
(for/list ((n items))
|
||||||
|
(match n
|
||||||
|
[(list text (? string? url))
|
||||||
|
`(li ,@(maybe-splice (equal? text (bootstrap-active-navigation))
|
||||||
|
`((class "active")))
|
||||||
|
(a ((href ,url)) ,text))]
|
||||||
|
['separator
|
||||||
|
`(li ((role "separator") (class "divider")))]
|
||||||
|
[(list text (? list? subitems))
|
||||||
|
`(li ((class "dropdown"))
|
||||||
|
(a ((href "#")
|
||||||
|
(class "dropdown-toggle")
|
||||||
|
(data-toggle "dropdown")
|
||||||
|
(role "button")
|
||||||
|
(aria-haspopup "true")
|
||||||
|
(aria-expanded "false"))
|
||||||
|
,text
|
||||||
|
(span ((class "caret"))))
|
||||||
|
(ul ((class "dropdown-menu"))
|
||||||
|
,@(render-nav-items subitems)))])))
|
||||||
|
|
||||||
;; String [#:permanent? Boolean] [#:headers (Listof Header)] -> Response
|
;; String [#:permanent? Boolean] [#:headers (Listof Header)] -> Response
|
||||||
(define (bootstrap-redirect url
|
(define (bootstrap-redirect url
|
||||||
#:permanent? [permanent? #f]
|
#:permanent? [permanent? #f]
|
||||||
|
|
20
src/site.rkt
20
src/site.rkt
|
@ -126,14 +126,18 @@
|
||||||
|
|
||||||
(define-syntax-rule (with-site-config body ...)
|
(define-syntax-rule (with-site-config body ...)
|
||||||
(parameterize ((bootstrap-navbar-header (navbar-header))
|
(parameterize ((bootstrap-navbar-header (navbar-header))
|
||||||
(bootstrap-navigation `((,nav-index ,(main-page-url))
|
(bootstrap-navigation
|
||||||
(,nav-search ,(named-url search-page))
|
`((,nav-index ,(main-page-url))
|
||||||
("About Package Builds" "https://pkg-build.racket-lang.org/about.html")
|
("Documentation" "https://docs.racket-lang.org/")
|
||||||
("Documentation" "https://docs.racket-lang.org/")
|
(,nav-search ,(named-url search-page))
|
||||||
((div ,(glyphicon 'download-alt)
|
("About"
|
||||||
" Download Racket")
|
(("The Racket Package System"
|
||||||
"http://download.racket-lang.org/")
|
"http://docs.racket-lang.org/pkg/getting-started.html")
|
||||||
))
|
("Package Builds" "https://pkg-build.racket-lang.org/about.html")))
|
||||||
|
((div ,(glyphicon 'download-alt)
|
||||||
|
" Download Racket")
|
||||||
|
"http://download.racket-lang.org/")
|
||||||
|
))
|
||||||
(bootstrap-static-urlprefix
|
(bootstrap-static-urlprefix
|
||||||
(if (rendering-static-page?)
|
(if (rendering-static-page?)
|
||||||
static-urlprefix
|
static-urlprefix
|
||||||
|
|
Loading…
Reference in New Issue
Block a user