meta value updates

- prevent posts count from showing in non-series-home pages
- add an "s" only when there are multiple values
This commit is contained in:
Kim, Jimin 2022-01-17 18:04:03 +09:00
parent 79059267bd
commit 6bc48a6905

View file

@ -22,12 +22,14 @@ const Meta = (props: { fetchedPage: PageData }) => {
return (
<StyledMetaContainer>
{/* posts count */}
<FontAwesomeIcon icon={faFile} />
&nbsp;&nbsp;
{props.fetchedPage.length
? props.fetchedPage.length + " posts"
: "no posts"}
&nbsp;&nbsp;&nbsp;&nbsp;
{props.fetchedPage.length > 0 && (
<>
<FontAwesomeIcon icon={faFile} />
&nbsp;&nbsp;
{props.fetchedPage.length} post
{props.fetchedPage.length > 1 && "s"} &nbsp;&nbsp;&nbsp;&nbsp;
</>
)}
{/* date */}
<FontAwesomeIcon icon={faCalendar} />
&nbsp;&nbsp;
@ -44,7 +46,9 @@ const Meta = (props: { fetchedPage: PageData }) => {
<FontAwesomeIcon icon={faBook} />
&nbsp;&nbsp;
{props.fetchedPage.wordCount
? props.fetchedPage.wordCount + " words"
? props.fetchedPage.wordCount +
" word" +
(props.fetchedPage.wordCount > 1 && "s")
: "unknown words"}
</StyledMetaContainer>
)