fix: use heading itself as anchor for better crawling (#5481)

This commit is contained in:
Alexey Pyltsyn 2021-09-03 14:11:06 +03:00 committed by GitHub
parent fd3c0c6619
commit 812327155b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 17 deletions

View file

@ -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"

View file

@ -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;

View file

@ -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 {