[dyad] Added more fields to meta analysis - wrote 2 file(s)

This commit is contained in:
[dyad]
2026-01-20 16:03:34 +01:00
parent 9626192d62
commit 1ab5727979
2 changed files with 112 additions and 0 deletions

View File

@@ -13,6 +13,9 @@ import {
X,
ImageOff,
Search,
ShieldCheck,
ShieldX,
Link as LinkIcon,
} from "lucide-react";
import {
extractMetaData,
@@ -31,6 +34,7 @@ import { TabIndicator } from "./tab-indicator";
import { getLengthIndicatorColor, type IndicatorColor } from "@/lib/analysis";
import { KeywordHighlighter } from "./keyword-highlighter";
import { SchemaDisplay } from "./schema-display";
import { Badge } from "./ui/badge";
interface MetaData {
title: string;
@@ -42,6 +46,9 @@ interface MetaData {
keyword?: string | null;
keywordCount?: number | null;
images?: ImageAltData[] | null;
canonical?: string | null;
keywords?: string | null;
robots?: string | null;
}
export function MetaForm() {
@@ -442,6 +449,105 @@ export function MetaForm() {
</div>
</div>
)}
<div>
<h3 className="font-semibold text-card-foreground">
Indexability
</h3>
<p className="text-sm text-muted-foreground mt-1 mb-2">
Indicates if search engines are allowed to index this
page.
</p>
{(() => {
const isIndexable =
!metaData.robots ||
!metaData.robots.toLowerCase().includes("noindex");
return (
<div
className={`flex items-start gap-3 p-3 rounded-md ${
isIndexable
? "bg-green-500/10 border-green-500/20"
: "bg-red-500/10 border-red-500/20"
}`}
>
{isIndexable ? (
<ShieldCheck className="h-5 w-5 text-green-500 mt-0.5 flex-shrink-0" />
) : (
<ShieldX className="h-5 w-5 text-red-500 mt-0.5 flex-shrink-0" />
)}
<div>
<p
className={`font-semibold ${
isIndexable
? "text-green-700 dark:text-green-400"
: "text-red-700 dark:text-red-400"
}`}
>
{isIndexable
? "Page is indexable"
: "Page is set to 'noindex'"}
</p>
<p className="text-sm text-muted-foreground">
{metaData.robots
? `Robots tag: "${metaData.robots}"`
: "No robots meta tag found."}
</p>
</div>
</div>
);
})()}
</div>
<div>
<div className="flex items-center justify-between">
<h3 className="font-semibold text-card-foreground">
Canonical URL
</h3>
<CopyButton
textToCopy={metaData.canonical || "Not found"}
/>
</div>
<p className="text-sm text-muted-foreground mt-1 mb-2">
The preferred URL for this page, to avoid duplicate
content issues.
</p>
<p className="text-muted-foreground bg-muted p-3 rounded-md min-h-[40px] break-all flex items-center gap-2">
{metaData.canonical ? (
<>
<LinkIcon className="h-4 w-4 flex-shrink-0" />
<span className="truncate">
{metaData.canonical}
</span>
</>
) : (
"Not found"
)}
</p>
</div>
<div>
<h3 className="font-semibold text-card-foreground">
Meta Keywords
</h3>
<p className="text-sm text-muted-foreground mt-1 mb-2">
Keywords associated with the page. Note: Most search
engines no longer use this tag for ranking.
</p>
<div className="text-muted-foreground bg-muted p-3 rounded-md min-h-[40px]">
{metaData.keywords ? (
<div className="flex flex-wrap gap-2">
{metaData.keywords
.split(",")
.map((k) => k.trim())
.filter(Boolean)
.map((k, i) => (
<Badge key={i} variant="secondary">
{k}
</Badge>
))}
</div>
) : (
"Not found"
)}
</div>
</div>
</div>
</div>
</CardContent>