Skip to content

Commit 8bf46d5

Browse files
committed
feat(seo): add robots meta, twitter cards, OG type, and breadcrumb schema
- Add robots meta tag (index, follow) to all pages - Add Twitter Card meta tags (summary_large_image) - Make OG type dynamic (website vs article per page) - Support per-page OG image with article-specific override - Generate BreadcrumbList JSON-LD dynamically for all pages
1 parent c78626c commit 8bf46d5

File tree

5 files changed

+67
-2
lines changed

5 files changed

+67
-2
lines changed

conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ site_author_skills="Site Reliability Engineering, Platform Engineering, Kubernet
2424
page_title="$site_title"
2525
page_path=""
2626
page_type="website"
27+
og_type="website"
28+
og_image="$ASSETS_DIR/me.webp"
2729

2830
# Only link if explicitly set to.
2931
link_index=false

gen

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,57 @@ JSONLD
381381
printf "Injected Article JSON-LD for %s\n" "$file_name"
382382
fi
383383
384+
# Inject BreadcrumbList JSON-LD for all pages with a header
385+
if [ "${add_header:-"false"}" != "false" ] && [ -n "$page_path" ]; then
386+
if [ "$file_name" = "index.html" ]; then
387+
breadcrumb_jsonld=$(
388+
cat << JSONLD
389+
<script type="application/ld+json">
390+
{
391+
"@context": "https://schema.org",
392+
"@type": "BreadcrumbList",
393+
"itemListElement": [
394+
{
395+
"@type": "ListItem",
396+
"position": 1,
397+
"name": "Home",
398+
"item": "$site_url"
399+
}
400+
]
401+
}
402+
</script>
403+
JSONLD
404+
)
405+
else
406+
breadcrumb_jsonld=$(
407+
cat << JSONLD
408+
<script type="application/ld+json">
409+
{
410+
"@context": "https://schema.org",
411+
"@type": "BreadcrumbList",
412+
"itemListElement": [
413+
{
414+
"@type": "ListItem",
415+
"position": 1,
416+
"name": "Home",
417+
"item": "$site_url"
418+
},
419+
{
420+
"@type": "ListItem",
421+
"position": 2,
422+
"name": "$title",
423+
"item": "$site_url/$page_path"
424+
}
425+
]
426+
}
427+
</script>
428+
JSONLD
429+
)
430+
fi
431+
replace "$BUILD_DIR/$file_name" "BREADCRUMB_JSONLD" "$breadcrumb_jsonld" "true"
432+
printf "Injected BreadcrumbList JSON-LD for %s\n" "$file_name"
433+
fi
434+
384435
printf "Finished generating %s\n\n" "$BUILD_DIR/$file_name"
385436
}
386437

header.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,25 @@
88
<meta name="keywords" content="${site_keywords}" />
99
<meta name="description" content="${site_description}" />
1010
<meta name="author" content="${site_author}" />
11+
<meta name="robots" content="index, follow" />
1112
<title>${page_title}</title>
1213

1314
<link rel="canonical" href="${site_url}/${page_path}" />
1415

1516
<!-- Open Graph -->
1617
<meta property="og:title" content="${page_title}" />
1718
<meta property="og:description" content="${site_description}" />
18-
<meta property="og:type" content="website" />
19+
<meta property="og:type" content="${og_type}" />
1920
<meta property="og:url" content="${site_url}/${page_path}" />
20-
<meta property="og:image" content="${ASSETS_DIR}/me.webp" />
21+
<meta property="og:image" content="${og_image}" />
2122
<meta property="og:locale" content="en_US" />
2223

24+
<!-- Twitter Card -->
25+
<meta name="twitter:card" content="summary_large_image" />
26+
<meta name="twitter:title" content="${page_title}" />
27+
<meta name="twitter:description" content="${site_description}" />
28+
<meta name="twitter:image" content="${og_image}" />
29+
2330
<meta name="theme-color" content="#0d1117" media="(prefers-color-scheme: dark)" />
2431
<meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)" />
2532

@@ -43,6 +50,8 @@
4350
}
4451
</script>
4552

53+
<!-- BREADCRUMB_JSONLD -->
54+
4655
<!-- Preload critical fonts (400=body, 600=nav, 700=headings) -->
4756
<link rel="preload" href="${ASSETS_DIR}/fonts/ibm-plex-serif-400-latin.woff2" as="font" type="font/woff2" crossorigin>
4857
<link rel="preload" href="${ASSETS_DIR}/fonts/ibm-plex-serif-600-latin.woff2" as="font" type="font/woff2" crossorigin>

highlights.html/conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ site_description="$description"
44
page_title="$title"
55
page_path="highlights.html"
66
page_type="article"
7+
og_type="article"
78
site_keywords="highlights, notes, reading, kindle, books, quotes"
89

910
is_markdown="true"

openclaw-helm.html/conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ site_description="$description"
44
page_title="$title"
55
page_path="openclaw-helm.html"
66
page_type="article"
7+
og_type="article"
8+
og_image="$ASSETS_DIR/openclaw-helm/openclaw-logo-text.webp"
79
site_keywords="openclaw, moltbot, clawdbot, kubernetes, helm, argocd, gitops, security, container isolation, ai agent, homelab, cloudflare tunnel, vault, secrets management"
810

911
is_markdown="true"

0 commit comments

Comments
 (0)