Новые изменения в коде проекта
This commit is contained in:
parent
0777fc201f
commit
aef12e853d
12 changed files with 159 additions and 15 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 } from '@lib/pb';
|
||||
import { getPostBySlug, getPosts, getPostImageUrl } from '@lib/pb';
|
||||
import { marked } from 'marked';
|
||||
|
||||
export const prerender = false;
|
||||
|
|
@ -50,6 +50,7 @@ const { posts: relatedPosts } = await getPosts({ perPage: 4, category: post.cate
|
|||
const filteredRelated = relatedPosts.filter(p => p.slug !== slug).slice(0, 3);
|
||||
|
||||
const currentUrl = `${SITE_URL}/blog/${slug}`;
|
||||
const heroImage = getPostImageUrl(post);
|
||||
---
|
||||
|
||||
<ArticleLayout
|
||||
|
|
@ -61,7 +62,7 @@ const currentUrl = `${SITE_URL}/blog/${slug}`;
|
|||
{ label: 'Блог', href: '/blog' },
|
||||
{ label: post.title }
|
||||
]}
|
||||
heroImage={post.imageUrl}
|
||||
heroImage={heroImage}
|
||||
heroAlt={post.title}
|
||||
category={post.category}
|
||||
postTitle={post.title}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import BlogCard from '@components/blog/BlogCard.astro';
|
|||
import Pagination from '@components/base/Pagination.astro';
|
||||
import CTA from '@components/base/CTA.astro';
|
||||
import SearchModal from '@components/base/SearchModal.astro';
|
||||
import { getPosts, getAllCategories } from '@lib/pb';
|
||||
import { getPosts, getAllCategories, getPostImageUrl } from '@lib/pb';
|
||||
|
||||
const POSTS_PER_PAGE = 6;
|
||||
const currentPage = 1;
|
||||
|
|
@ -64,7 +64,7 @@ const formatDate = (date: string) => {
|
|||
categoryColor={post.categoryColor}
|
||||
date={formatDate(post.date)}
|
||||
readTime={post.readTime}
|
||||
imageUrl={post.imageUrl}
|
||||
image={getPostImageUrl(post)}
|
||||
slug={`/blog/${post.slug}`}
|
||||
/>
|
||||
</article>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import BlogCard from '@components/blog/BlogCard.astro';
|
|||
import Pagination from '@components/base/Pagination.astro';
|
||||
import CTA from '@components/base/CTA.astro';
|
||||
import SearchModal from '@components/base/SearchModal.astro';
|
||||
import { getPosts, getAllCategories } from '@lib/pb';
|
||||
import { getPosts, getAllCategories, getPostImageUrl } from '@lib/pb';
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ const formatDate = (date: string) => {
|
|||
categoryColor={post.categoryColor}
|
||||
date={formatDate(post.date)}
|
||||
readTime={post.readTime}
|
||||
imageUrl={post.imageUrl}
|
||||
image={getPostImageUrl(post)}
|
||||
slug={`/blog/${post.slug}`}
|
||||
/>
|
||||
</article>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import Layout from '@layouts/Layout.astro';
|
|||
import { SITE_URL } from '@constants';
|
||||
import BlogCard from '@components/blog/BlogCard.astro';
|
||||
import SearchModal from '@components/base/SearchModal.astro';
|
||||
import { getPosts } from '@lib/pb';
|
||||
import { getPosts, getPostImageUrl } from '@lib/pb';
|
||||
|
||||
const url = new URL(Astro.request.url);
|
||||
const searchQuery = url.searchParams.get('q') || '';
|
||||
|
|
@ -78,7 +78,7 @@ const formatDate = (date: string) => {
|
|||
categoryColor={post.categoryColor}
|
||||
date={formatDate(post.date)}
|
||||
readTime={post.readTime}
|
||||
imageUrl={post.imageUrl}
|
||||
image={getPostImageUrl(post)}
|
||||
slug={`/blog/${post.slug}`}
|
||||
/>
|
||||
))}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue