diff --git a/components/fuzzy-bar.tsx b/components/fuzzy-bar.tsx index c1e6d7c..3ca219c 100644 --- a/components/fuzzy-bar.tsx +++ b/components/fuzzy-bar.tsx @@ -17,7 +17,9 @@ function FuzzyBar(): JSX.Element { let entries = [...pages]; for (const [k,v] of posts.entries()) { - entries.push({title: v.title, link: `posts/${v.slug}`}); + const item = v as any; + if (item.title && item.slug) + entries.push({title: item.title, link: `posts/${item.slug}`}); } try { diff --git a/next.config.js b/next.config.js index ca95034..df2edb3 100755 --- a/next.config.js +++ b/next.config.js @@ -11,7 +11,7 @@ module.exports = { config.plugins.push( { apply: (compiler) => { - compiler.hooks.initialize.tap('cachePostLinkDataInit', _ => { + compiler.hooks.beforeCompile.tap('cachePostLinkDataInit', _ => { cachePostLinkData(); }); } diff --git a/pages/posts/index.tsx b/pages/posts/index.tsx index d6fe8b2..3471f60 100644 --- a/pages/posts/index.tsx +++ b/pages/posts/index.tsx @@ -5,7 +5,7 @@ import Posts from '../../public/posts.json'; import prettyDatePrint from '../../util/pretty-date'; function HomePage({posts}: any) { - Posts.sort((x, y) => { return x.title.localeCompare(y.title) }); + Posts.sort((x, y) => { return (x as any).title.localeCompare((x as any).title) }); // todo: create a table-like interface return (