几个月前使用 nextjs-notion-starter-kit 搭建了博客,使用确实很方便,但是当时
fork
时原项目中并没有添加有关于 Google Analytics
的部分;以及对于 inline code
的代码样式也是有问题的,被默认的 code 样式给覆盖了,这里记录一下对这部分的修改添加 Google Analytics
可以在
components / PageHead.tsx
文件中添加如下代码<script async src={`https://www.googletagmanager.com/gtag/js?id=UA-Code`} /> <script dangerouslySetInnerHTML={{ __html: ` window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-CODE', { page_path: window.location.pathname, }); `, }} />
只需将
UA-Code
部分换成个人的即可修改 inline code 代码的样式
在 styles / notion.css 中 添加样式
.notion-inline-code { color: #eb5757 !important; }