Skip to content

feat(insights): add opengraph images & improve metadata #2397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added apps/insights/src/app/opengraph-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 25 additions & 2 deletions apps/insights/src/app/price-feeds/[slug]/layout.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
import type { Metadata } from "next";
import { notFound } from "next/navigation";

import { Cluster, getFeeds } from "../../../services/pyth";

export { PriceFeedLayout as default } from "../../../components/PriceFeed/layout";

export const metadata: Metadata = {
title: "Price Feeds",
type Props = {
params: Promise<{
slug: string;
}>;
};

export const generateMetadata = async ({
params,
}: Props): Promise<Metadata> => {
const [{ slug }, feeds] = await Promise.all([
params,
getFeeds(Cluster.Pythnet),
]);
const symbol = decodeURIComponent(slug);
const feed = feeds.find((item) => item.symbol === symbol);

return feed
? {
title: feed.product.display_symbol,
description: `See live market quotes for ${feed.product.description}.`,
}
: notFound();
};

export const dynamic = "error";
Expand Down
10 changes: 10 additions & 0 deletions apps/insights/src/app/price-feeds/layout.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
import type { Metadata } from "next";

export { ZoomLayoutTransition as default } from "../../components/ZoomLayoutTransition";

export const metadata: Metadata = {
title: {
default: "Price Feeds",
template: "%s | Price Feeds | Pyth Network Insights",
},
description: "Explore market data on the Pyth network.",
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions apps/insights/src/app/price-feeds/page.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import type { Metadata } from "next";

export { PriceFeeds as default } from "../../components/PriceFeeds";

export const metadata: Metadata = {
title: "Price Feeds",
};

export const dynamic = "error";
export const revalidate = 3600;
20 changes: 18 additions & 2 deletions apps/insights/src/app/publishers/[cluster]/[key]/layout.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
import { lookup } from "@pythnetwork/known-publishers";
import type { Metadata } from "next";

export { PublishersLayout as default } from "../../../../components/Publisher/layout";

export const metadata: Metadata = {
title: "Publishers",
type Props = {
params: Promise<{
key: string;
}>;
};

export const generateMetadata = async ({
params,
}: Props): Promise<Metadata> => {
const { key } = await params;
const knownPublisher = lookup(key);
const publisher = knownPublisher?.name ?? key;

return {
title: publisher,
description: `Evaluate performance for data published by ${publisher}.`,
};
};

export const dynamic = "error";
Expand Down
10 changes: 10 additions & 0 deletions apps/insights/src/app/publishers/layout.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
import type { Metadata } from "next";

export { ZoomLayoutTransition as default } from "../../components/ZoomLayoutTransition";

export const metadata: Metadata = {
title: {
default: "Publishers",
template: "%s | Publishers | Pyth Network Insights",
},
description: "Explore publishers who contribute to the Pyth network.",
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions apps/insights/src/app/publishers/page.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import type { Metadata } from "next";

export { Publishers as default } from "../../components/Publishers";

export const metadata: Metadata = {
title: "Publishers",
};

export const dynamic = "error";
export const revalidate = 3600;
Loading