Skip to content

Commit

Permalink
feat: add missing tags to og checker
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiiBz committed Jan 2, 2025
1 parent 7bf99b1 commit ab4b4e7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import { useDebouncedCallback } from "use-debounce";
import { usePreviewControls } from "../../../lib/hooks/usePreviewControls";
import { InfoIcon } from "../../icons/InfoIcon";
import { OgImage } from "../../OgImage";
import { META_KEYS, META_TAGS, type MetaTags } from "../../../lib/meta";
import {
META_KEYS,
META_TAGS,
REQUIRED_META_TAGS,
type MetaTags,
} from "../../../lib/meta";

export function OpenGraphImageChecker() {
const [loading, setLoading] = useState(false);
Expand Down Expand Up @@ -98,7 +103,8 @@ export function OpenGraphImageChecker() {
{loading ? (
<Skeleton width="300px" />
) : (
data?.[tag] ?? "⚠️ Missing value"
data?.[tag] ??
`⚠️ Missing value (${REQUIRED_META_TAGS.includes(tag) ? "required" : "optional"})`
)}
</Table.Cell>
</Table.Row>
Expand Down
16 changes: 12 additions & 4 deletions apps/dashboard/src/lib/meta.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
export const META_TAGS = {
"og:title": "The title of your object as it should appear within the graph.",
"og:description": "A one to two sentence description of your object.",
"og:site_name": "The name which should be displayed for the overall site.",
"og:url":
"The canonical URL of your object that will be used as its permanent ID in the graph.",
"og:type": "The type of your object, e.g., 'video.movie'.",
"og:image":
"An image URL which should represent your object within the graph.",
"og:url":
"The canonical URL of your object that will be used as its permanent ID in the graph.",
"og:description": "A one to two sentence description of your object.",
"og:site_name": "The name which should be displayed for the overall site.",
} as const;

export const REQUIRED_META_TAGS: MetaTags[] = [
"og:title",
"og:type",
"og:image",
"og:url",
];

export const META_KEYS = Object.keys(META_TAGS) as MetaTags[];

export type MetaTags = keyof typeof META_TAGS;

0 comments on commit ab4b4e7

Please sign in to comment.