2026-03-02 00:39:07 +03:00
|
|
|
---
|
2026-03-02 23:10:31 +03:00
|
|
|
import MainLayout from '@layouts/MainLayout.astro';
|
|
|
|
|
import { getAuthorData, getPostsByCoauthorLogin } from '@lib/api/authors';
|
2026-03-02 00:39:07 +03:00
|
|
|
|
2026-03-02 23:10:31 +03:00
|
|
|
import ContentGrid from '@components/ContentGrid.astro';
|
2026-03-02 00:39:07 +03:00
|
|
|
|
2026-03-02 23:10:31 +03:00
|
|
|
export const prerender = false;
|
2026-03-02 00:39:07 +03:00
|
|
|
const { slug } = Astro.params;
|
|
|
|
|
|
2026-03-02 23:10:31 +03:00
|
|
|
const author = await getAuthorData(slug);
|
|
|
|
|
|
|
|
|
|
const data = await getPostsByCoauthorLogin(slug);
|
|
|
|
|
const posts = data.posts;
|
2026-03-02 00:39:07 +03:00
|
|
|
|
|
|
|
|
// Если автор не найден - 404
|
|
|
|
|
//if (!authorData) {
|
|
|
|
|
// return Astro.redirect('/404');
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-03-02 23:10:31 +03:00
|
|
|
<MainLayout
|
|
|
|
|
title={`Публикации автора: ${slug}`}
|
|
|
|
|
description={`Информационное агентство Деловой журнал Профиль - записи по тегу ${slug}`}
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
{author && (
|
|
|
|
|
<div class="author-card">
|
|
|
|
|
{author.avatar && (
|
|
|
|
|
<img
|
|
|
|
|
src={author.avatar}
|
|
|
|
|
alt={author.name}
|
|
|
|
|
width="192"
|
|
|
|
|
height="192"
|
|
|
|
|
class="avatar"
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<h1>{author.name}</h1>
|
|
|
|
|
|
|
|
|
|
{(author.firstName || author.lastName) && (
|
|
|
|
|
<p class="full-name">
|
|
|
|
|
{author.firstName} {author.lastName}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{author.bio && (
|
|
|
|
|
<div class="bio">{author.bio}</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{author.social && Object.values(author.social).some(Boolean) && (
|
|
|
|
|
<div class="social-links">
|
|
|
|
|
{author.social.twitter && (
|
|
|
|
|
<a href={author.social.twitter}>Twitter</a>
|
|
|
|
|
)}
|
|
|
|
|
{author.social.facebook && (
|
|
|
|
|
<a href={author.social.facebook}>Facebook</a>
|
|
|
|
|
)}
|
|
|
|
|
{author.social.instagram && (
|
|
|
|
|
<a href={author.social.instagram}>Instagram</a>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<ContentGrid
|
|
|
|
|
items={posts}
|
|
|
|
|
pageInfo={data.pageInfo}
|
|
|
|
|
slug={slug}
|
|
|
|
|
showCount={false}
|
|
|
|
|
type='author'
|
|
|
|
|
perLoad={11}
|
|
|
|
|
/>
|
|
|
|
|
</MainLayout>
|
|
|
|
|
|
|
|
|
|
|