From 6bc48a690543b3749267f0f132aab15859db15a7 Mon Sep 17 00:00:00 2001 From: developomp Date: Mon, 17 Jan 2022 18:04:03 +0900 Subject: [PATCH] meta value updates - prevent posts count from showing in non-series-home pages - add an "s" only when there are multiple values --- source/src/pages/Page/Meta.tsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/source/src/pages/Page/Meta.tsx b/source/src/pages/Page/Meta.tsx index 7a48858..3a34642 100644 --- a/source/src/pages/Page/Meta.tsx +++ b/source/src/pages/Page/Meta.tsx @@ -22,12 +22,14 @@ const Meta = (props: { fetchedPage: PageData }) => { return ( {/* posts count */} - -    - {props.fetchedPage.length - ? props.fetchedPage.length + " posts" - : "no posts"} -      + {props.fetchedPage.length > 0 && ( + <> + +    + {props.fetchedPage.length} post + {props.fetchedPage.length > 1 && "s"}      + + )} {/* date */}    @@ -44,7 +46,9 @@ const Meta = (props: { fetchedPage: PageData }) => {    {props.fetchedPage.wordCount - ? props.fetchedPage.wordCount + " words" + ? props.fetchedPage.wordCount + + " word" + + (props.fetchedPage.wordCount > 1 && "s") : "unknown words"} )