Add public market brief content assets

This commit is contained in:
2569718930@qq.com
2026-06-24 16:41:13 +08:00
parent 004439b736
commit 0a46933f6a
12 changed files with 1496 additions and 3 deletions
+129
View File
@@ -0,0 +1,129 @@
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { BriefDetailPageView } from "@/components/public-content/PublicContentPages";
import {
PUBLIC_BRIEFS,
absolutePublicUrl,
briefPath,
getBrief,
} from "@/content/public-content";
type BriefPageParams = {
city: string;
date: string;
};
export function generateStaticParams() {
return PUBLIC_BRIEFS.map((brief) => ({
city: brief.city,
date: brief.date,
}));
}
export async function generateMetadata({
params,
}: {
params: Promise<BriefPageParams>;
}): Promise<Metadata> {
const { city, date } = await params;
const brief = getBrief(city, date);
if (!brief) {
return {
title: "Brief not found",
};
}
const pathname = briefPath(brief);
return {
title: brief.title,
description: brief.description,
alternates: {
canonical: pathname,
},
openGraph: {
type: "article",
title: brief.title,
description: brief.description,
url: pathname,
publishedTime: brief.publishedAt,
modifiedTime: brief.updatedAt,
},
twitter: {
card: "summary",
title: brief.title,
description: brief.description,
},
};
}
export default async function BriefDetailPage({
params,
}: {
params: Promise<BriefPageParams>;
}) {
const { city, date } = await params;
const brief = getBrief(city, date);
if (!brief) {
notFound();
}
const pathname = briefPath(brief);
const jsonLd = [
{
"@context": "https://schema.org",
"@type": "Article",
headline: brief.title,
description: brief.description,
datePublished: brief.publishedAt,
dateModified: brief.updatedAt,
mainEntityOfPage: absolutePublicUrl(pathname),
author: {
"@type": "Organization",
name: "PolyWeather",
url: "https://polyweather.top",
},
publisher: {
"@type": "Organization",
name: "PolyWeather",
url: "https://polyweather.top",
},
about: [
brief.cityName,
brief.market,
brief.settlementSource,
"DEB forecast methodology",
],
},
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
itemListElement: [
{
"@type": "ListItem",
position: 1,
name: "Briefs",
item: absolutePublicUrl("/briefs"),
},
{
"@type": "ListItem",
position: 2,
name: brief.cityName,
item: absolutePublicUrl(pathname),
},
],
},
];
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>
<BriefDetailPageView brief={brief} />
</>
);
}
+21
View File
@@ -0,0 +1,21 @@
import type { Metadata } from "next";
import { BriefsIndexPageView } from "@/components/public-content/PublicContentPages";
export const metadata: Metadata = {
title: "Weather Market Brief",
description:
"Public PolyWeather market briefs for temperature judgment, settlement-source checks, DEB context, and source freshness notes.",
alternates: {
canonical: "/briefs",
},
openGraph: {
title: "Weather Market Brief | PolyWeather",
description:
"Public market briefs for temperature judgment, settlement-source checks, DEB context, and source freshness notes.",
url: "/briefs",
},
};
export default function BriefsPage() {
return <BriefsIndexPageView />;
}
+85
View File
@@ -0,0 +1,85 @@
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { MethodologyDetailPageView } from "@/components/public-content/PublicContentPages";
import {
METHODOLOGY_PAGES,
absolutePublicUrl,
getMethodologyPage,
methodologyPath,
} from "@/content/public-content";
type MethodologyPageParams = {
slug: string;
};
export function generateStaticParams() {
return METHODOLOGY_PAGES.map((page) => ({ slug: page.slug }));
}
export async function generateMetadata({
params,
}: {
params: Promise<MethodologyPageParams>;
}): Promise<Metadata> {
const { slug } = await params;
const page = getMethodologyPage(slug);
if (!page) {
return {
title: "Methodology not found",
};
}
return {
title: page.title,
description: page.description,
alternates: {
canonical: methodologyPath(page),
},
openGraph: {
type: "article",
title: page.title,
description: page.description,
url: methodologyPath(page),
modifiedTime: page.updatedAt,
},
};
}
export default async function MethodologyDetailPage({
params,
}: {
params: Promise<MethodologyPageParams>;
}) {
const { slug } = await params;
const page = getMethodologyPage(slug);
if (!page) {
notFound();
}
const pathname = methodologyPath(page);
const jsonLd = {
"@context": "https://schema.org",
"@type": "TechArticle",
headline: page.title,
description: page.description,
dateModified: page.updatedAt,
mainEntityOfPage: absolutePublicUrl(pathname),
author: {
"@type": "Organization",
name: "PolyWeather",
url: "https://polyweather.top",
},
};
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>
<MethodologyDetailPageView page={page} />
</>
);
}
+21
View File
@@ -0,0 +1,21 @@
import type { Metadata } from "next";
import { MethodologyIndexPageView } from "@/components/public-content/PublicContentPages";
export const metadata: Metadata = {
title: "Methodology",
description:
"PolyWeather public methodology for DEB forecast blending, settlement-source priority, freshness, and market weather analysis.",
alternates: {
canonical: "/methodology",
},
openGraph: {
title: "Methodology | PolyWeather",
description:
"Public methodology for DEB forecast blending, settlement-source priority, freshness, and market weather analysis.",
url: "/methodology",
},
};
export default function MethodologyPage() {
return <MethodologyIndexPageView />;
}
+44 -2
View File
@@ -1,20 +1,62 @@
import type { MetadataRoute } from "next";
import {
METHODOLOGY_PAGES,
PUBLIC_BRIEFS,
SOURCE_PAGES,
} from "@/content/public-content";
export default function sitemap(): MetadataRoute.Sitemap {
const baseUrl = "https://polyweather.top";
const now = new Date();
return [
{
url: baseUrl,
lastModified: new Date(),
lastModified: now,
changeFrequency: "weekly",
priority: 1.0,
},
{
url: `${baseUrl}/auth/login`,
lastModified: new Date(),
lastModified: now,
changeFrequency: "monthly",
priority: 0.6,
},
{
url: `${baseUrl}/briefs`,
lastModified: now,
changeFrequency: "weekly",
priority: 0.9,
},
{
url: `${baseUrl}/methodology`,
lastModified: now,
changeFrequency: "monthly",
priority: 0.8,
},
{
url: `${baseUrl}/sources`,
lastModified: now,
changeFrequency: "monthly",
priority: 0.8,
},
...PUBLIC_BRIEFS.map((brief) => ({
url: `${baseUrl}/briefs/${brief.city}/${brief.date}`,
lastModified: new Date(brief.updatedAt),
changeFrequency: "daily" as const,
priority: 0.85,
})),
...METHODOLOGY_PAGES.map((page) => ({
url: `${baseUrl}/methodology/${page.slug}`,
lastModified: new Date(page.updatedAt),
changeFrequency: "monthly" as const,
priority: 0.75,
})),
...SOURCE_PAGES.map((source) => ({
url: `${baseUrl}/sources/${source.slug}`,
lastModified: new Date(source.updatedAt),
changeFrequency: "monthly" as const,
priority: 0.7,
})),
];
}
+89
View File
@@ -0,0 +1,89 @@
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { SourceDetailPageView } from "@/components/public-content/PublicContentPages";
import {
SOURCE_PAGES,
absolutePublicUrl,
getSourcePage,
sourcePath,
} from "@/content/public-content";
type SourcePageParams = {
slug: string;
};
export function generateStaticParams() {
return SOURCE_PAGES.map((source) => ({ slug: source.slug }));
}
export async function generateMetadata({
params,
}: {
params: Promise<SourcePageParams>;
}): Promise<Metadata> {
const { slug } = await params;
const source = getSourcePage(slug);
if (!source) {
return {
title: "Source not found",
};
}
return {
title: source.title,
description: source.description,
alternates: {
canonical: sourcePath(source),
},
openGraph: {
type: "article",
title: source.title,
description: source.description,
url: sourcePath(source),
modifiedTime: source.updatedAt,
},
};
}
export default async function SourceDetailPage({
params,
}: {
params: Promise<SourcePageParams>;
}) {
const { slug } = await params;
const source = getSourcePage(slug);
if (!source) {
notFound();
}
const pathname = sourcePath(source);
const jsonLd = {
"@context": "https://schema.org",
"@type": "Dataset",
name: source.title,
description: source.description,
url: absolutePublicUrl(pathname),
dateModified: source.updatedAt,
creator: {
"@type": "Organization",
name: source.operator,
},
includedInDataCatalog: {
"@type": "DataCatalog",
name: "PolyWeather source notes",
url: absolutePublicUrl("/sources"),
},
};
return (
<>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>
<SourceDetailPageView source={source} />
</>
);
}
+21
View File
@@ -0,0 +1,21 @@
import type { Metadata } from "next";
import { SourcesIndexPageView } from "@/components/public-content/PublicContentPages";
export const metadata: Metadata = {
title: "Weather Sources",
description:
"PolyWeather public source notes for MGM, METAR, HKO, NOAA, ECMWF, and settlement-source weather analysis.",
alternates: {
canonical: "/sources",
},
openGraph: {
title: "Weather Sources | PolyWeather",
description:
"Public source notes for MGM, METAR, HKO, NOAA, ECMWF, and settlement-source weather analysis.",
url: "/sources",
},
};
export default function SourcesPage() {
return <SourcesIndexPageView />;
}