From 8a703cb39ff23ff3639b0da33f0d72f92f1cc55b Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Thu, 16 Dec 2021 23:20:58 +0100
Subject: chore: create thematic page view

For now I have to repeat some markup/styles, I cannot reuse PostsList
component. WP GraphQL does not offer edges for ACF Post2Post or filters
to get thematic posts with another way.
I should create custom fields in backend to improve the posts fetching.
---
 src/components/PostPreview/PostPreview.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/components/PostPreview/PostPreview.tsx')

diff --git a/src/components/PostPreview/PostPreview.tsx b/src/components/PostPreview/PostPreview.tsx
index 3dfef73..95aca97 100644
--- a/src/components/PostPreview/PostPreview.tsx
+++ b/src/components/PostPreview/PostPreview.tsx
@@ -19,7 +19,7 @@ const PostPreview = ({
 
   return (
     <article className={styles.wrapper}>
-      {post.featuredImage && (
+      {post.featuredImage && Object.keys(post.featuredImage).length > 0 && (
         <div className={styles.cover}>
           <Image
             src={post.featuredImage.sourceUrl}
@@ -41,7 +41,7 @@ const PostPreview = ({
         dangerouslySetInnerHTML={{ __html: post.content }}
       ></div>
       <footer className={styles.footer}>
-        <Link href={post.slug}>
+        <Link href={`/article/${post.slug}`}>
           <a className={styles['read-more']}>
             {t`Read more`}
             <span className="screen-reader-text">
-- 
cgit v1.2.3

