From 0d43d77e55b95cb89f3393fc852a9f5ba2f24967 Mon Sep 17 00:00:00 2001 From: mrwiredancer Date: Wed, 1 Jan 2020 14:56:21 +0800 Subject: [PATCH] fix issue #11 1. added `gatsby-remark-autolink-headers`, which correctly sets `id` attributes of headers 2. changed `rightSidebar.js` to use `url` instead of `title` for anchors --- gatsby-config.js | 3 ++- package.json | 1 + src/components/rightSidebar.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gatsby-config.js b/gatsby-config.js index c7b84869..0db1a760 100755 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -39,7 +39,8 @@ module.exports = { }, { resolve: "gatsby-remark-copy-linked-files" - } + }, + "gatsby-remark-autolink-headers" ], extensions: [".mdx", ".md"] } diff --git a/package.json b/package.json index 53c67407..fe1192d8 100755 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "gatsby-plugin-react-helmet": "3.0.12", "gatsby-plugin-sharp": "^2.2.10", "gatsby-plugin-sitemap": "^2.0.12", + "gatsby-remark-autolink-headers": "^2.1.21", "gatsby-remark-copy-linked-files": "^2.0.11", "gatsby-remark-images": "3.0.10", "gatsby-source-filesystem": "^2.0.29", diff --git a/src/components/rightSidebar.js b/src/components/rightSidebar.js index 20e65980..60dd41c2 100644 --- a/src/components/rightSidebar.js +++ b/src/components/rightSidebar.js @@ -97,7 +97,7 @@ const SidebarLayout = ({ location }) => ( return ( {innerItem.title}