breadcrumbs & author link
This commit is contained in:
parent
28f5babf22
commit
cda91b9ea9
|
@ -5,9 +5,11 @@ import { notFound } from 'next/navigation';
|
||||||
import {fetchBlogPost, fetchBlogPosts, Widget} from "../../../../lib/contentful/blogPosts";
|
import {fetchBlogPost, fetchBlogPosts, Widget} from "../../../../lib/contentful/blogPosts";
|
||||||
import Util from "node:util";
|
import Util from "node:util";
|
||||||
import RichText from "../../../../lib/contentful/RichText";
|
import RichText from "../../../../lib/contentful/RichText";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
interface BlogPostPageParams {
|
interface BlogPostPageParams {
|
||||||
slug: string
|
slug: string
|
||||||
|
locale: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BlogPostPageProps {
|
interface BlogPostPageProps {
|
||||||
|
@ -61,23 +63,25 @@ export default async function BlogItem({params}: { params: BlogPostPageParams })
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="b-news-page__image">
|
<div className="b-news-page__image">
|
||||||
<img className="" src="/images/news1.png" alt="" />
|
<img className="" src="/images/news1.png" alt=""/>
|
||||||
</div>
|
</div>
|
||||||
<div className="news-item__info">
|
<div className="news-item__info">
|
||||||
<div className="news-item__info__author">
|
<div className="news-item__info__author">
|
||||||
<img className="" src={item.author.avatar.src} alt="" />
|
<Link href={`/${params.locale}/experts/${item.author?.expertId}`} className="news-item">
|
||||||
<div className="news-item__info__author__inner">
|
<img className="" src={item.author.avatar.src} alt=""/>
|
||||||
<div className="news-item__info__name">{item.author?.name}</div>
|
<div className="news-item__info__author__inner">
|
||||||
<div className="news-item__info__date">{item.createdAt}</div>
|
<div className="news-item__info__name">{item.author?.name}</div>
|
||||||
</div>
|
<div className="news-item__info__date">{item.createdAt}</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div className="news-item__info__counter">
|
<div className="news-item__info__counter">
|
||||||
<div className="news-item__info__like">
|
<div className="news-item__info__like">
|
||||||
<img className="" src="/images/heart-outline.svg" alt="" />
|
<img className="" src="/images/heart-outline.svg" alt=""/>
|
||||||
165
|
165
|
||||||
</div>
|
</div>
|
||||||
<div className="news-item__info__share">
|
<div className="news-item__info__share">
|
||||||
<img className="" src="/images/share-social.svg" alt="" />
|
<img className="" src="/images/share-social.svg" alt=""/>
|
||||||
Share
|
Share
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -86,6 +90,23 @@ export default async function BlogItem({params}: { params: BlogPostPageParams })
|
||||||
{item.body.map(renderWidget)}
|
{item.body.map(renderWidget)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="b-inner" style={ {marginTop: '40px'}}>
|
||||||
|
<nav className="min-h-6 pb-6">
|
||||||
|
<Link href='/'>
|
||||||
|
Home
|
||||||
|
</Link>
|
||||||
|
>
|
||||||
|
<Link href={`/${params.locale}/blog/category/${item.categorySlug}`}>
|
||||||
|
{item.category}
|
||||||
|
</Link>
|
||||||
|
>
|
||||||
|
<span>
|
||||||
|
{item.title}
|
||||||
|
</span>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -44,6 +44,7 @@ export const BlogPostsList = ({ basePath = '/', locale, pageSize = DEFAULT_PAGE
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="news-item__info">
|
<div className="news-item__info">
|
||||||
|
<Link href={`/${locale}/experts/${item.author?.expertId}`} className="news-item">
|
||||||
<div className="news-item__info__author">
|
<div className="news-item__info__author">
|
||||||
<img className="" src={item.author.avatar.src} alt=""/>
|
<img className="" src={item.author.avatar.src} alt=""/>
|
||||||
<div className="news-item__info__author__inner">
|
<div className="news-item__info__author__inner">
|
||||||
|
@ -51,6 +52,7 @@ export const BlogPostsList = ({ basePath = '/', locale, pageSize = DEFAULT_PAGE
|
||||||
<div className="news-item__info__date">{item.createdAt}</div>
|
<div className="news-item__info__date">{item.createdAt}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</Link>
|
||||||
<div className="news-item__info__counter">
|
<div className="news-item__info__counter">
|
||||||
<div className="news-item__info__like">
|
<div className="news-item__info__like">
|
||||||
<img className="" src="/images/heart-outline.svg" alt=""/>
|
<img className="" src="/images/heart-outline.svg" alt=""/>
|
||||||
|
|
|
@ -11,6 +11,7 @@ export function parseContentfulAuthor(authorEntry?: AuthorEntry<any, any>): Auth
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: authorEntry.fields.name || '',
|
name: authorEntry.fields.name || '',
|
||||||
|
expertId: authorEntry.fields.expertId || '',
|
||||||
avatar: parseContentfulContentImage(authorEntry.fields.avatar),
|
avatar: parseContentfulContentImage(authorEntry.fields.avatar),
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -59,6 +59,7 @@ export function parseContentfulBlogPost(entry?: PostEntry): BlogPost | null {
|
||||||
author: parseContentfulAuthor(entry.fields.author),
|
author: parseContentfulAuthor(entry.fields.author),
|
||||||
createdAt: dayjs(entry.sys.createdAt).format('MMM DD, YYYY'),
|
createdAt: dayjs(entry.sys.createdAt).format('MMM DD, YYYY'),
|
||||||
category: entry.fields.category.fields.title,
|
category: entry.fields.category.fields.title,
|
||||||
|
categorySlug: entry.fields.category.fields.slug,
|
||||||
body: parseWidgets(entry.fields.body) || []
|
body: parseWidgets(entry.fields.body) || []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,12 @@ import {ContentImage} from "../lib/contentful/contentImage";
|
||||||
export interface AuthorFields {
|
export interface AuthorFields {
|
||||||
name: EntryFieldTypes.Symbol
|
name: EntryFieldTypes.Symbol
|
||||||
avatar: EntryFieldTypes.AssetLink
|
avatar: EntryFieldTypes.AssetLink
|
||||||
|
expertId: EntryFieldTypes.AssetLink
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Author {
|
export interface Author {
|
||||||
name: string
|
name: string
|
||||||
|
expertId: string
|
||||||
avatar: ContentImage | null
|
avatar: ContentImage | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ export interface BlogPost {
|
||||||
listImage: ContentImage | null
|
listImage: ContentImage | null
|
||||||
author: Author | null
|
author: Author | null
|
||||||
category: string
|
category: string
|
||||||
|
categorySlug: string
|
||||||
createdAt: string
|
createdAt: string
|
||||||
metaDescription: string
|
metaDescription: string
|
||||||
body: Array<WidgetMedia | WidgetParagraph>
|
body: Array<WidgetMedia | WidgetParagraph>
|
||||||
|
|
Loading…
Reference in New Issue