Update article views in prod only

This commit is contained in:
r-freeman 2023-03-07 20:53:27 +00:00
parent 0c0c4cb758
commit fdda8ad3c3

View File

@ -1,4 +1,5 @@
import React, {ReactNode} from 'react' import React, {ReactNode} from 'react'
import * as process from 'process'
import Head from 'next/head' import Head from 'next/head'
import Link from 'next/link' import Link from 'next/link'
import {Container} from '@/components/Container' import {Container} from '@/components/Container'
@ -17,6 +18,8 @@ type ArticleLayout = {
slug: string slug: string
} }
const isProd = process.env.NODE_ENV === 'production'
export function ArticleLayout({ export function ArticleLayout({
children, children,
isRssFeed = false, isRssFeed = false,
@ -106,7 +109,7 @@ export function ArticleLayout({
<time dateTime={date}> <time dateTime={date}>
<span>{formatDate(date)}</span> <span>{formatDate(date)}</span>
</time> </time>
<Views slug={slug}/> <Views slug={slug} shouldUpdateViews={isProd}/>
</p> </p>
</header> </header>
<Prose className="mt-8">{children}</Prose> <Prose className="mt-8">{children}</Prose>