Add name link
This commit is contained in:
parent
6c6f687925
commit
4a7df99224
3 changed files with 4 additions and 3 deletions
|
|
@ -48,7 +48,7 @@ export function scrollActiveSidebar () {
|
||||||
|
|
||||||
li.classList.add('active')
|
li.classList.add('active')
|
||||||
active = li
|
active = li
|
||||||
!hoveredOverSidebar && !sticky.noSticky && active.scrollIntoView()
|
!hoveredOverSidebar && !sticky.noSticky && active.scrollIntoView(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.removeEventListener('scroll', highlight)
|
window.removeEventListener('scroll', highlight)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ const OPTIONS = merge({
|
||||||
coverpage: '',
|
coverpage: '',
|
||||||
basePath: '',
|
basePath: '',
|
||||||
auto2top: false,
|
auto2top: false,
|
||||||
name: ''
|
name: '',
|
||||||
|
nameLink: location.pathname
|
||||||
}, window.$docsify)
|
}, window.$docsify)
|
||||||
const script = document.currentScript || [].slice.call(document.getElementsByTagName('script')).pop()
|
const script = document.currentScript || [].slice.call(document.getElementsByTagName('script')).pop()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ export function renderSidebar (content) {
|
||||||
html = tpl.tree(genTree(toc, OPTIONS.maxLevel), '<ul>')
|
html = tpl.tree(genTree(toc, OPTIONS.maxLevel), '<ul>')
|
||||||
}
|
}
|
||||||
|
|
||||||
html = (OPTIONS.name ? `<h1><a href="/">${OPTIONS.name}</a></h1>` : '') + html
|
html = (OPTIONS.name ? `<h1><a href="${OPTIONS.nameLink}">${OPTIONS.name}</a></h1>` : '') + html
|
||||||
renderTo('aside.sidebar', html)
|
renderTo('aside.sidebar', html)
|
||||||
const target = event.activeLink('aside.sidebar', true)
|
const target = event.activeLink('aside.sidebar', true)
|
||||||
if (target) renderSubSidebar(target)
|
if (target) renderSubSidebar(target)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue