Новые изменения в компоненты
This commit is contained in:
parent
faf02848ed
commit
735289481c
7 changed files with 151 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ import { SITE_URL } from '@constants';
|
|||
import Comments from '@components/blog/comments/Comments.tsx';
|
||||
import RelatedPosts from '@components/blog/RelatedPosts.astro';
|
||||
import ArticleTableOfContents from '@components/blog/ArticleTableOfContents.astro';
|
||||
import { getPostBySlug, getPosts, getPostImageUrl, getPostVotesStats } from '@lib/pb';
|
||||
import { getPostBySlug, getPosts, getPostImageUrl, getPostVotesStats, getPostViews } from '@lib/pb';
|
||||
import { marked } from 'marked';
|
||||
|
||||
export const prerender = false;
|
||||
|
|
@ -22,6 +22,7 @@ if (!post) {
|
|||
}
|
||||
|
||||
const { likes = 0, dislikes = 0 } = await getPostVotesStats(post.id).catch(() => ({ likes: 0, dislikes: 0 }));
|
||||
const views = await getPostViews(post.id).catch(() => 0);
|
||||
|
||||
// Конвертируем markdown в HTML
|
||||
const contentHtml = marked(post.content || '');
|
||||
|
|
@ -74,6 +75,7 @@ const heroImage = getPostImageUrl(post);
|
|||
postUrl={currentUrl}
|
||||
initialLikes={likes}
|
||||
initialDislikes={dislikes}
|
||||
initialViews={views}
|
||||
>
|
||||
<!-- Содержимое статьи в article -->
|
||||
<article class="article-content-wrapper" id="post-content">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue