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
|
## ToDo
|
||||||
- [ ] Dockerfile
|
- [ ] Dockerfile
|
||||||
- [ ] Добавить ссылку на общий репозиторий
|
- [ ] Добавить ссылку на общий репозиторий
|
||||||
- [ ] Теги жанров для сущностей
|
- [x] Теги жанров для сущностей
|
||||||
- [ ] Поиск
|
- [ ] Поиск
|
||||||
- [ ] Динамические метаданные к страницам [section]/*
|
- [x] Динамические метаданные к страницам [section]/*
|
||||||
- [ ] Страница "О проекте"
|
- [ ] Страница "О проекте"
|
||||||
@@ -4,6 +4,23 @@ import { ItemCard } from "@/widgets/itemCard";
|
|||||||
import { ItemInfo } from "@/widgets/itemInfo";
|
import { ItemInfo } from "@/widgets/itemInfo";
|
||||||
import { Section } from "@/widgets/section";
|
import { Section } from "@/widgets/section";
|
||||||
import { redirect } from "next/navigation";
|
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({
|
export default async function Item({
|
||||||
params: { section, item_id },
|
params: { section, item_id },
|
||||||
|
|||||||
@@ -11,10 +11,7 @@ export async function generateMetadata({
|
|||||||
}: {
|
}: {
|
||||||
params: { section: string };
|
params: { section: string };
|
||||||
}): Promise<Metadata> {
|
}): Promise<Metadata> {
|
||||||
if (!SectionService.isSection(section)) {
|
if (!SectionService.isSection(section)) redirect("/");
|
||||||
redirect("/");
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
title: `.Torrent: ${SectionService.sectionsConfiguration[section].addItemText}`,
|
title: `.Torrent: ${SectionService.sectionsConfiguration[section].addItemText}`,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ export async function generateMetadata({
|
|||||||
}): Promise<Metadata> {
|
}): Promise<Metadata> {
|
||||||
if (!SectionService.isSection(section)) {
|
if (!SectionService.isSection(section)) {
|
||||||
redirect("/");
|
redirect("/");
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
title: `.Torrent: ${SectionService.sectionsConfiguration[section].sectionName}`,
|
title: `.Torrent: ${SectionService.sectionsConfiguration[section].sectionName}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user