canonical / canonical-absent
Does a missing canonical affect social previews?
Use the separate page tabs for favicon, initial paint, mobile viewport and installation checks. Embedded views do not reproduce browser tab UI.
Your current page
Current Astro source
---
// Local sample values make this existing draft renderable for comparison.
// The original source is preserved in metadata-cases/original-index.astro.txt.
import { assetHref, normalizeBase } from '../metadata-cases/cases';
const base = import.meta.env.BASE_URL;
const fullTitle = 'Current metadata draft';
const description = 'The existing head structure with local sample values for comparison.';
const styleURL = assetHref('reference.css', base);
const SITE_NAME = 'Metadata research';
const noindex = false;
const canonical = new URL(normalizeBase(base), Astro.url.origin).href;
const ogType = 'website' as 'website' | 'article';
const ogImage = new URL(assetHref('social-red.png', base), Astro.url.origin).href;
const publishedTime = undefined as Date | undefined;
const modifiedTime = undefined as Date | undefined;
const jsonLd = undefined as Record<string, unknown> | undefined;
---
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>{fullTitle}</title>
<meta name="color-scheme" content="dark light" />
<link rel="stylesheet" href={styleURL} />
<link rel="icon" href={`${normalizeBase(base)}favicon.ico`} />
<!-- sizes="32x32" -->
<link rel="icon" type="image/svg+xml" href={assetHref('icon-blue.svg', base)} />
<link rel="apple-touch-icon" href={assetHref('apple-touch-icon.png', base)} />
<link rel="manifest" href={assetHref('app.webmanifest', base)} />
{!noindex && <link rel="canonical" href={canonical} />}
<meta name="description" content={description} />
{noindex && <meta name="robots" content="noindex" />}
{!noindex && (
<>
<meta property="og:site_name" content={SITE_NAME} />
<meta property="og:type" content={ogType} />
<meta property="og:url" content={canonical} />
<meta property="og:title" content={fullTitle} />
<meta property="og:description" content={description} />
<meta property="og:image" content={ogImage} />
<meta name="twitter:card" content="summary_large_image" />
{ogType === "article" && publishedTime && (
<meta
property="article:published_time"
content={publishedTime.toISOString()}
/>
)}
{ogType === "article" && modifiedTime && (
<meta
property="article:modified_time"
content={modifiedTime.toISOString()}
/>
)}
</>
)}
{jsonLd && (
<script
type="application/ld+json"
is:inline
set:html={JSON.stringify(jsonLd).replace(/</g, "\\u003c")}
/>
)}
<slot name="head" />
</head>
<body>
<h1>Astro</h1>
<p><a href={`${normalizeBase(base)}cases/`}>Compare metadata cases</a></p>
</body>
</html>
canonical-absent
Open case · Complete fixture HTML
Share URL: https://3c4fa30b.astro-metadata-lab.pages.dev/cases/canonical/canonical-absent/
Fixture head
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="color-scheme" content="light dark">
<title>HTML title — canonical-absent</title>
<meta name="description" content="HTML description — canonical-absent">
<meta property="og:type" content="website">
<meta property="og:url" content="https://3c4fa30b.astro-metadata-lab.pages.dev/cases/canonical/canonical-absent/">
<meta property="og:title" content="HTML title — canonical-absent">
<meta property="og:description" content="HTML description — canonical-absent">
<meta property="og:image" content="https://3c4fa30b.astro-metadata-lab.pages.dev/cases/assets/social-red.png">
<meta property="og:image:alt" content="Red research image">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta name="twitter:card" content="summary_large_image">
<link rel="icon" href="/cases/assets/icon-red.ico" sizes="32x32">
<link rel="icon" href="/cases/assets/icon-blue.svg" type="image/svg+xml">Case options
{
"canonical": null
}