diff --git a/components/Tags.js b/components/Tags.js
index 0a0cf0ef6..8db5f66d0 100644
--- a/components/Tags.js
+++ b/components/Tags.js
@@ -1,9 +1,4 @@
-import { useState } from 'react'
-
const Tags = ({ tags, handleTagClick, selectedTag }) => {
- // const colorPalette = ['yellow-400', 'blue-400', 'purple-400', 'pink s-400']
- // const color = colorPalette[Math.floor(Math.random() * colorPalette.length)]
- // const ClassToReturn = `border-${color} text-${color} bg-${color}`
if (!tags) return null
return (
@@ -13,7 +8,9 @@ const Tags = ({ tags, handleTagClick, selectedTag }) => {
key={key}
onClick={() => handleTagClick(key)}
className={`mr-3 py-2 font-medium cursor-pointer border px-4 whitespace-nowrap bg-gray-100 border-gray-100 text-gray-400 dark:bg-night dark:border-gray-800 dark:text-gray-300 ${
- key === selectedTag ? 'text-white bg-black border-black dark:bg-gray-600 dark:border-gray-600 dark:text-gray-300' : ''
+ key === selectedTag
+ ? 'text-white bg-black border-black dark:bg-gray-600 dark:border-gray-600 dark:text-gray-300'
+ : ''
}`}
>
{`${key} (${tags[key]})`}
diff --git a/layouts/default.js b/layouts/default.js
index f5f5431f9..99e5995cf 100644
--- a/layouts/default.js
+++ b/layouts/default.js
@@ -1,12 +1,7 @@
import Image from 'next/image'
import Container from '@/components/Container'
import { useRouter } from 'next/router'
-import {
- NotionRenderer,
- Equation,
- Code,
- CollectionRow
-} from 'react-notion-x'
+import { NotionRenderer, Equation, Code, CollectionRow } from 'react-notion-x'
import BLOG from '@/blog.config'
import formatDate from '@/lib/formatDate'
import dynamic from 'next/dynamic'
diff --git a/layouts/fullwidth.js b/layouts/fullwidth.js
index 0028ce41a..1288670cd 100644
--- a/layouts/fullwidth.js
+++ b/layouts/fullwidth.js
@@ -1,12 +1,7 @@
import Image from 'next/image'
import Container from '@/components/Container'
import { useRouter } from 'next/router'
-import {
- NotionRenderer,
- Equation,
- Code,
- CollectionRow
-} from 'react-notion-x'
+import { NotionRenderer, Equation, Code, CollectionRow } from 'react-notion-x'
import BLOG from '@/blog.config'
import formatDate from '@/lib/formatDate'
import dynamic from 'next/dynamic'
diff --git a/lib/gtag.js b/lib/gtag.js
index 918d5f561..a526fb7d4 100644
--- a/lib/gtag.js
+++ b/lib/gtag.js
@@ -2,7 +2,7 @@ import BLOG from '@/blog.config'
export const GA_TRACKING_ID = BLOG.analytics.gaConfig.measurementId
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages
-export const pageview = (url) => {
+export const pageview = url => {
window.gtag('config', GA_TRACKING_ID, {
page_path: url
})
diff --git a/lib/notion.js b/lib/notion.js
index 3740b2683..db8ee0ed3 100644
--- a/lib/notion.js
+++ b/lib/notion.js
@@ -3,7 +3,6 @@ const { NotionAPI } = require('notion-client')
const api = new NotionAPI()
export async function getAllPosts () {
- // const response = await fetch(`/api/notion/collection?id=${BLOG.notionPageId}`)
const page = await api.getPage(BLOG.notionPageId)
const collectionId = Object.keys(page.collection)[0]
const collectionViewId = Object.keys(page.collection_view)[0]
diff --git a/lib/rss.js b/lib/rss.js
index 88ad86bbe..0f6035666 100644
--- a/lib/rss.js
+++ b/lib/rss.js
@@ -9,7 +9,6 @@ export function generateRss (posts) {
id: `${BLOG.link}/${BLOG.path}`,
link: `${BLOG.link}/${BLOG.path}`,
language: BLOG.lang,
- // image: `${BLOG.link}/image.png`,
favicon: `${BLOG.link}/favicon.png`,
copyright: `All rights reserved ${year}, ${BLOG.author}`,
author: {
diff --git a/pages/[slug].js b/pages/[slug].js
index 7b2758735..662253b35 100644
--- a/pages/[slug].js
+++ b/pages/[slug].js
@@ -17,7 +17,6 @@ const BlogPost = ({ post, blockMap }) => {
export async function getStaticPaths () {
let posts = await getAllPosts()
posts = posts.filter(
- // post => post.status === 'Published' && post.type === 'Post'
post => post.status === 'Published'
)
return {
@@ -29,7 +28,6 @@ export async function getStaticPaths () {
export async function getStaticProps ({ params: { slug } }) {
let posts = await getAllPosts()
posts = posts.filter(
- // post => post.status === 'Published' && post.type === 'Post'
post => post.status === 'Published'
)
const post = posts.find(t => t.slug === slug)
diff --git a/pages/_app.js b/pages/_app.js
index 4b5f49040..161e73a00 100644
--- a/pages/_app.js
+++ b/pages/_app.js
@@ -1,10 +1,6 @@
-// core styles shared by all of react-notion-x (required)
import 'react-notion-x/src/styles.css'
-// used for code syntax highlighting (optional)
import 'prismjs/themes/prism.css'
-// used for collection views (optional)
import 'rc-dropdown/assets/index.css'
-// used for rendering equations (optional)
import 'katex/dist/katex.min.css'
import '@/styles/globals.css'
import BLOG from '@/blog.config'
@@ -16,7 +12,7 @@ const Gtag = dynamic(() => import('@/components/Gtag'), { ssr: false })
function MyApp ({ Component, pageProps }) {
return (
-
+
<>
{BLOG.analytics && BLOG.analytics === 'ackee' && (
}
>
-
+
)
}
diff --git a/pages/index.js b/pages/index.js
index 5407d63c2..13e433e52 100644
--- a/pages/index.js
+++ b/pages/index.js
@@ -6,10 +6,11 @@ import BLOG from '@/blog.config'
export async function getStaticProps () {
let posts = await getAllPosts()
- posts = posts.filter(post => post.status === 'Published' && post.type === 'Post')
+ posts = posts.filter(
+ post => post.status === 'Published' && post.type === 'Post'
+ )
const postsToShow = posts.slice(0, BLOG.postsPerPage)
const totalPosts = posts.length
- // const totalPages = Math.ceil(totalPosts / BLOG.postsPerPage)
const showNext = totalPosts > BLOG.postsPerPage
return {
props: {
@@ -27,7 +28,7 @@ const blog = ({ postsToShow, page, showNext }) => {
{postsToShow.map(post => (
))}
- {showNext &&
}
+ {showNext && }
)
}
diff --git a/pages/page/[page].js b/pages/page/[page].js
index 52d58c6b3..17e162fcc 100644
--- a/pages/page/[page].js
+++ b/pages/page/[page].js
@@ -4,25 +4,28 @@ import Pagination from '@/components/Pagination'
import { getAllPosts } from '@/lib/notion'
import BLOG from '@/blog.config'
-const Page = ({ postsToShow, page, totalPages, showNext }) => {
+const Page = ({ postsToShow, page, showNext }) => {
return (
{postsToShow &&
postsToShow.map(post => )}
-
+
)
}
export async function getStaticProps (context) {
const { page } = context.params // Get Current Page No.
- // fetch page data
let posts = await getAllPosts()
- posts = posts.filter(post => post.status === 'Published' && post.type === 'Post')
- const postsToShow = posts.slice(BLOG.postsPerPage * (page - 1), BLOG.postsPerPage * page)
+ posts = posts.filter(
+ post => post.status === 'Published' && post.type === 'Post'
+ )
+ const postsToShow = posts.slice(
+ BLOG.postsPerPage * (page - 1),
+ BLOG.postsPerPage * page
+ )
const totalPosts = posts.length
- const totalPages = Math.ceil(totalPosts / BLOG.postsPerPage)
- const showNext = (page * BLOG.postsPerPage) < totalPosts
+ const showNext = page * BLOG.postsPerPage < totalPosts
return {
props: {
page, // Current Page
diff --git a/pages/search.js b/pages/search.js
index 785b0492a..c5794adcf 100644
--- a/pages/search.js
+++ b/pages/search.js
@@ -6,8 +6,9 @@ export default function search ({ tags, posts }) {
}
export async function getStaticProps () {
let posts = await getAllPosts()
- posts = posts
- .filter(post => post.status === 'Published' && post.type === 'Post')
+ posts = posts.filter(
+ post => post.status === 'Published' && post.type === 'Post'
+ )
const tags = await getAllTags()
return {
props: {