Новы глобальные изменения компонентоы
This commit is contained in:
parent
5d7bb04bf1
commit
a269d3459e
43 changed files with 1667 additions and 517 deletions
|
|
@ -4,7 +4,7 @@ import { SITE_URL } from '@constants';
|
|||
import PostCommentForm from '@components/blog/PostCommentForm.astro';
|
||||
import RelatedPosts from '@components/blog/RelatedPosts.astro';
|
||||
import ArticleTableOfContents from '@components/blog/ArticleTableOfContents.astro';
|
||||
import { getPostBySlug, getPosts, getPostImageUrl } from '@lib/pb';
|
||||
import { getPostBySlug, getPosts, getPostImageUrl, getPostVotesStats } from '@lib/pb';
|
||||
import { marked } from 'marked';
|
||||
|
||||
export const prerender = false;
|
||||
|
|
@ -21,6 +21,8 @@ if (!post) {
|
|||
return Astro.redirect('/blog');
|
||||
}
|
||||
|
||||
const { likes = 0, dislikes = 0 } = await getPostVotesStats(post.id).catch(() => ({ likes: 0, dislikes: 0 }));
|
||||
|
||||
// Конвертируем markdown в HTML
|
||||
const contentHtml = marked(post.content || '');
|
||||
|
||||
|
|
@ -71,8 +73,8 @@ const heroImage = getPostImageUrl(post);
|
|||
readTime={post.readTime}
|
||||
postId={post.id}
|
||||
postUrl={currentUrl}
|
||||
initialLikes={12}
|
||||
initialDislikes={2}
|
||||
initialLikes={likes}
|
||||
initialDislikes={dislikes}
|
||||
>
|
||||
<!-- Содержимое статьи -->
|
||||
<div class="post-content" set:html={contentHtml} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue