Implement ProgCode identity and real shared reading UI kit
Build and deploy / deploy (push) Successful in 2m39s
Build and deploy / deploy (push) Successful in 2m39s
This commit is contained in:
1 parent
99c848189e
commit
12562baeb5
2040 files changed
+184656
-181
No files matched your search
@@ -0,0 +1,6 @@
|
||||
import {notFound} from 'next/navigation';
|
||||
import {getArticles,getArticleBySlug} from '../../../fsd/entities/article';
|
||||
import ArticlePage from '../../../fsd/pages/article';
|
||||
export function generateStaticParams(){return getArticles().map(article=>({slug:article.slug}));}
|
||||
export async function generateMetadata({params}){const {slug}=await params;const article=getArticleBySlug(decodeURIComponent(slug));return article?{title:article.title+' — ProgCode',description:article.excerpt,alternates:{canonical:'/articles/'+encodeURIComponent(article.slug)+'/'}}:{title:'Статья не найдена'};}
|
||||
export default async function ArticleRoute({params}){const {slug}=await params;const article=getArticleBySlug(decodeURIComponent(slug));if(!article)notFound();const related=getArticles().filter(item=>item.slug!==article.slug&&item.categories.some(category=>article.categories.includes(category))).slice(0,3);return <ArticlePage article={article} related={related}/>}
|
||||
Reference in new issue
Block a user