Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin committed Jan 6, 2024
1 parent aa6fb36 commit 4733ebc
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/app/articles/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@ import { Renderer } from './renderer';
import { runOrHandleErrorIf, throwIfError } from "../../handler";
import { defaultRobotsMeta } from '../../../../config';

export async function generateMetadata({ params }): Promise<Metadata> {
//const robotsAttributes = content.robotsAttributes === undefined ? defaultRobotsMeta : content.robotsAttributes;
const robotsAttributes = 'noarchive'
// TODO: use cache
// https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#opting-out-of-data-caching
export async function generateMetadata({ params: { slug }}: { params: { slug: Array<string> }}): Promise<Metadata> {
const response: Response = await findByPath("/articles/" + slug.join("/"));
const content = await response.json() as ContentResponse;

const robotsAttributes = content.robotsAttributes === undefined ? defaultRobotsMeta : content.robotsAttributes;
return {
/*
title: content.title,
authors: [{ name: content.authorName }],
description: content.description,
*/
robots: {
noarchive: robotsAttributes.includes('noarchive'),
follow: !robotsAttributes.includes('nofollow'),
Expand All @@ -41,10 +43,6 @@ export default async function Page(req: any) {
async function run(req: any): Promise<any> {
const { props } = await get(req);
const c = props.content
await generateMetadata(
// sluggize(req.params.slug, 'articles'),
{ c }
)
return <Renderer {...props} />;
}

Expand Down

0 comments on commit 4733ebc

Please sign in to comment.