mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-24 03:58:49 +02:00
fix: use heading itself as anchor for better crawling (#5481)
This commit is contained in:
parent
fd3c0c6619
commit
812327155b
3 changed files with 7 additions and 17 deletions
|
@ -44,16 +44,13 @@ const createAnchorHeading = (
|
|||
}
|
||||
|
||||
return (
|
||||
<Tag {...props}>
|
||||
<a
|
||||
aria-hidden="true"
|
||||
tabIndex={-1}
|
||||
className={clsx('anchor', `anchor__${Tag}`, {
|
||||
[styles.anchorWithHideOnScrollNavbar]: hideOnScroll,
|
||||
[styles.anchorWithStickyNavbar]: !hideOnScroll,
|
||||
})}
|
||||
id={id}
|
||||
/>
|
||||
<Tag
|
||||
{...props}
|
||||
className={clsx('anchor', `anchor__${Tag}`, {
|
||||
[styles.anchorWithHideOnScrollNavbar]: hideOnScroll,
|
||||
[styles.anchorWithStickyNavbar]: !hideOnScroll,
|
||||
})}
|
||||
id={id}>
|
||||
{props.children}
|
||||
<a
|
||||
className="hash-link"
|
||||
|
|
|
@ -5,12 +5,6 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
.anchor {
|
||||
display: block;
|
||||
position: relative;
|
||||
top: -0.5rem;
|
||||
}
|
||||
|
||||
.hash-link {
|
||||
opacity: 0;
|
||||
padding-left: 0.5rem;
|
||||
|
|
|
@ -12,7 +12,6 @@ See https://twitter.com/JoshWComeau/status/1332015868725891076
|
|||
*/
|
||||
.anchorWithStickyNavbar {
|
||||
scroll-margin-top: calc(var(--ifm-navbar-height) + 0.5rem);
|
||||
/* top: calc(var(--ifm-navbar-height) * -1 - 0.5rem); */
|
||||
}
|
||||
|
||||
.anchorWithHideOnScrollNavbar {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue