File tree Expand file tree Collapse file tree 4 files changed +17
-15
lines changed Expand file tree Collapse file tree 4 files changed +17
-15
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 15
15
} )
16
16
}
17
17
18
- // Open first nav collapse if none are open.
19
- // Useful for pages with no nav links i.e. landing pages.
20
18
const sideNav = document . querySelector ( '#side-nav' )
21
19
if ( sideNav ) {
20
+ // Open first nav collapse if none are open.
21
+ // Useful for pages with no nav links i.e. landing pages.
22
22
const activeCollapses = sideNav . querySelectorAll ( '.collapse > .collapse-content.active' )
23
23
if ( ! activeCollapses . length ) {
24
24
const firstCollapse = sideNav . querySelector ( '.collapse > .collapse-content' )
25
25
if ( firstCollapse ) {
26
26
firstCollapse . classList . add ( 'active' )
27
27
}
28
28
}
29
+ // Auto scroll the side nav to the current page's side nav link
30
+ const currentPageLink = sideNav . querySelector ( '.nav-link.current-page' )
31
+ if ( currentPageLink ) {
32
+ currentPageLink . scrollIntoView ( { block : 'center' } )
33
+ }
29
34
}
30
35
31
36
// Top Global Nav horizontal scrolling
Original file line number Diff line number Diff line change 4
4
<ul class =" flex flex-wrap !list-none !m-0 !p-0" >
5
5
{{ #with page.componentVersion }}
6
6
{{ #if (and ./title (ne ./title @root.page.breadcrumbs.0.content ))}}
7
- <li class =" text-link !m-0 !p-0 after:content-['/'] last-of-type:after:content-none after:text-tertiary after:px-2" ><a href =" {{{ relativize ./url }}} " >{{{ ./title }}} </a ></li >
7
+ <li class =" text-link !m-0 !p-0 after:content-['/'] last-of-type:after:content-none after:text-tertiary after:px-2" >
8
+ <a href =" {{{ relativize ./url }}} " >{{{ ./title }}} </a >
9
+ </li >
8
10
{{ /if }}
9
11
{{ /with }}
10
12
{{ #each page.breadcrumbs }}
11
- {{ #if (and ./url (eq ./urlType ' internal' ))}}
12
- {{ #if (is-last this ../page.breadcrumbs )}}
13
- <li class =" text-tertiary !m-0 !p-0" >{{{ ./content }}} </li >
14
- {{ else }}
13
+ {{ #if ./content }}
14
+ {{ #if (not (eq ./url @root.page.url ))}}
15
+ {{ #if (eq ./urlType ' internal' )}}
15
16
<li class =" text-link !m-0 !p-0 after:content-['/'] last-of-type:after:content-none after:text-tertiary after:px-2" >
16
17
<a href =" {{{ relativize ./url }}} " >{{{ ./content }}} </a >
17
18
</li >
19
+ {{ else }}
20
+ <li class =" text-tertiary !m-0 !p-0 after:content-['/'] last-of-type:after:content-none after:text-tertiary after:px-2" >{{{ ./content }}} </li >
21
+ {{ /if }}
18
22
{{ /if }}
19
23
{{ /if }}
20
24
{{ /each }}
Original file line number Diff line number Diff line change 5
5
<li class =" nav-item{{ #if ./items.length }} collapse{{ /if }} " data-depth =" {{ or ../level 0 }} " >
6
6
{{ #if (and ./url (not ./items.length ))}}
7
7
<a
8
- class =" nav-link !no-underline"
8
+ class =" nav-link !no-underline{{ #if ( eq ./url @ root.page.url ) }} current-page {{ /if }} "
9
9
href =" {{ ~#if (eq ./urlType ' internal' )}} {{{ relativize ./url }}} {{ ~else }} {{{ ./url }}} {{ ~/if }} "
10
10
{{ #if (eq ./url @root.page.url )}} aria-current =" page" {{ /if }}
11
11
{{ #if (eq ./urlType ' external' )}} target =" _blank" {{ /if }} >
You can’t perform that action at this time.
0 commit comments