diff options
Diffstat (limited to 'src/layouts/BlogPost.astro')
| -rw-r--r-- | src/layouts/BlogPost.astro | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro index 628215f..70562c6 100644 --- a/src/layouts/BlogPost.astro +++ b/src/layouts/BlogPost.astro @@ -1,6 +1,16 @@ --- import Layout from './Default.astro'; +import BlogComments from '../components/BlogComments.jsx'; +import "../styles/cards.css"; const { title, description, pubDate, tags } = Astro.props; +const { slug } = Astro.params; + +let disableComments; + +const response = await fetch(`${import.meta.env.PUBLIC_API_URL}/comments/${slug}/disabled`); +const data = await response.json(); +disableComments = data.postDisabled; + --- <Layout title=`${title} - Andrew Lee` description={description}> @@ -17,6 +27,12 @@ const { title, description, pubDate, tags } = Astro.props; <main> <slot /> </main> + { + disableComments ? null : + <h1>Comments</h1> + <BlogComments client:visible slug={slug} /> + } + </div> </Layout> |
