Skip to content

Commit a047b5c

Browse files
committed
Update canonical link
1 parent 61af3ad commit a047b5c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

quartz/plugins/emitters/aliases.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ async function* processFile(ctx: BuildCtx, file: VFile) {
1616
) as FullSlug
1717

1818
const redirUrl = resolveRelative(aliasTargetSlug, ogSlug)
19+
// Create absolute URL for canonical and meta refresh
20+
const baseUrl = ctx.cfg.configuration.baseUrl || ""
21+
const absoluteUrl = baseUrl ? `https://${baseUrl}/${ogSlug}` : redirUrl
22+
1923
yield write({
2024
ctx,
2125
content: `
2226
<!DOCTYPE html>
2327
<html lang="en-us">
2428
<head>
2529
<title>${ogSlug}</title>
26-
<link rel="canonical" href="${redirUrl}">
30+
<link rel="canonical" href="${absoluteUrl}">
2731
<meta name="robots" content="noindex">
2832
<meta charset="utf-8">
2933
<meta http-equiv="refresh" content="0; url=${redirUrl}">

0 commit comments

Comments
 (0)