mirror of
https://github.com/StepanovPlaton/torrent_frontend.git
synced 2026-04-03 12:20:48 +04:00
Update readme. Add dynamic metatada
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
## ToDo
|
||||
- [ ] Dockerfile
|
||||
- [ ] Добавить ссылку на общий репозиторий
|
||||
- [ ] Теги жанров для сущностей
|
||||
- [x] Теги жанров для сущностей
|
||||
- [ ] Поиск
|
||||
- [ ] Динамические метаданные к страницам [section]/*
|
||||
- [x] Динамические метаданные к страницам [section]/*
|
||||
- [ ] Страница "О проекте"
|
||||
@@ -4,6 +4,23 @@ import { ItemCard } from "@/widgets/itemCard";
|
||||
import { ItemInfo } from "@/widgets/itemInfo";
|
||||
import { Section } from "@/widgets/section";
|
||||
import { redirect } from "next/navigation";
|
||||
import { Metadata } from "next";
|
||||
|
||||
export async function generateMetadata({
|
||||
params: { section, item_id },
|
||||
}: {
|
||||
params: { section: string; item_id: number };
|
||||
}): Promise<Metadata> {
|
||||
if (!SectionService.isSection(section)) redirect("/");
|
||||
const game = await ItemService.itemsConfiguration[
|
||||
SectionService.sectionsConfiguration[section].itemType
|
||||
].service.Get(item_id);
|
||||
if (!game) redirect("/");
|
||||
return {
|
||||
title: `.Torrent: ${SectionService.sectionsConfiguration[section].sectionName} - ${game.title}`,
|
||||
description: `.Torrent: ${SectionService.sectionsConfiguration[section].sectionName} - ${game.description}`,
|
||||
};
|
||||
}
|
||||
|
||||
export default async function Item({
|
||||
params: { section, item_id },
|
||||
|
||||
@@ -11,10 +11,7 @@ export async function generateMetadata({
|
||||
}: {
|
||||
params: { section: string };
|
||||
}): Promise<Metadata> {
|
||||
if (!SectionService.isSection(section)) {
|
||||
redirect("/");
|
||||
return {};
|
||||
}
|
||||
if (!SectionService.isSection(section)) redirect("/");
|
||||
return {
|
||||
title: `.Torrent: ${SectionService.sectionsConfiguration[section].addItemText}`,
|
||||
};
|
||||
|
||||
@@ -12,7 +12,6 @@ export async function generateMetadata({
|
||||
}): Promise<Metadata> {
|
||||
if (!SectionService.isSection(section)) {
|
||||
redirect("/");
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
title: `.Torrent: ${SectionService.sectionsConfiguration[section].sectionName}`,
|
||||
|
||||
Reference in New Issue
Block a user