From a3372a644370fd01479c71df0da597d89e9ec575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Weng?= Date: Fri, 31 Jul 2020 23:32:29 +0200 Subject: [PATCH] Reach 100 in lighthouse score --- src/blog/BlogGallery.tsx | 4 +++- src/layout/Meta.tsx | 6 +----- src/pages/_document.tsx | 21 +++++++++++++++++++++ src/pages/posts/[slug].tsx | 2 +- 4 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 src/pages/_document.tsx diff --git a/src/blog/BlogGallery.tsx b/src/blog/BlogGallery.tsx index 6ceb0a7..4e5d200 100644 --- a/src/blog/BlogGallery.tsx +++ b/src/blog/BlogGallery.tsx @@ -17,7 +17,9 @@ const BlogGallery = (props: IBlogGalleryProps) => ( {props.posts.map((elt) => (
  • - {elt.title} + +

    {elt.title}

    +
    {format(new Date(elt.date), 'LLL d, yyyy')}
    diff --git a/src/layout/Meta.tsx b/src/layout/Meta.tsx index 98d5f0e..1d419b5 100644 --- a/src/layout/Meta.tsx +++ b/src/layout/Meta.tsx @@ -23,11 +23,7 @@ const Meta = (props: IMetaProps) => { <> - + diff --git a/src/pages/_document.tsx b/src/pages/_document.tsx new file mode 100644 index 0000000..6e19069 --- /dev/null +++ b/src/pages/_document.tsx @@ -0,0 +1,21 @@ +import React from 'react'; + +import Document, { + Html, Head, Main, NextScript, +} from 'next/document'; + +class MyDocument extends Document { + render() { + return ( + + + +
    + + + + ); + } +} + +export default MyDocument; diff --git a/src/pages/posts/[slug].tsx b/src/pages/posts/[slug].tsx index 2b31408..b7a3741 100644 --- a/src/pages/posts/[slug].tsx +++ b/src/pages/posts/[slug].tsx @@ -35,7 +35,7 @@ const DisplayPost = (props: IPostProps) => ( /> )} > -
    {props.title}
    +

    {props.title}

    {format(new Date(props.date), 'LLLL d, yyyy')}