Skip to content

Commit a38b857

Browse files
committed
fix: use explicit OG image metadata instead of file-based convention
1 parent 3361692 commit a38b857

File tree

6 files changed

+123
-35
lines changed

6 files changed

+123
-35
lines changed

deploy-check.sh

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
set -e
33

44
MSG="${1:-fix og-image}"
5+
DIR="$(cd "$(dirname "$0")" && pwd)"
56

67
# Stage and commit
78
git add -A
@@ -20,34 +21,8 @@ echo "Watching run $RUN_ID..."
2021
gh run watch "$RUN_ID" --exit-status || { echo "Build failed!"; gh run view "$RUN_ID" --log-failed; exit 1; }
2122

2223
echo ""
23-
echo "=== Deploy complete. Checking OG image ==="
24-
echo ""
25-
26-
# Check what meta tag says
27-
echo "--- Meta tags ---"
28-
curl -sL https://rbby.dev/gnata-sqlite/ | grep -i 'og:image' | head -5 || echo "(no og:image found)"
29-
30-
echo ""
31-
32-
# Extract OG image URL (macOS-compatible)
33-
OG_URL=$(python3 -c "
34-
import re, urllib.request
35-
html = urllib.request.urlopen('https://rbby.dev/gnata-sqlite/').read().decode()
36-
m = re.search(r'og:image\" content=\"([^\"]+)\"', html)
37-
print(m.group(1) if m else '')
38-
")
24+
echo "Waiting 30s for CDN propagation..."
25+
sleep 30
3926

40-
if [ -n "$OG_URL" ]; then
41-
echo "OG image URL: $OG_URL"
42-
STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "$OG_URL")
43-
CONTENT_TYPE=$(curl -sL -o /dev/null -w "%{content_type}" "$OG_URL")
44-
echo "HTTP status: $STATUS"
45-
echo "Content-Type: $CONTENT_TYPE"
46-
if [ "$STATUS" = "200" ] && echo "$CONTENT_TYPE" | grep -q "image"; then
47-
echo "OG image is working!"
48-
else
49-
echo "OG image is NOT working"
50-
fi
51-
else
52-
echo "Could not extract og:image URL"
53-
fi
27+
# Run verification
28+
"$DIR/verify-deploy.sh"

verify-deploy.sh

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/bin/bash
2+
# Verify all deployed pages are working and not returning 404/redirect HTML
3+
4+
RED='\033[0;31m'
5+
GREEN='\033[0;32m'
6+
YELLOW='\033[0;33m'
7+
NC='\033[0m'
8+
9+
BASE="https://rbby.dev/gnata-sqlite"
10+
FAIL=0
11+
12+
check_page() {
13+
local url="$1"
14+
local label="$2"
15+
16+
STATUS=$(curl -sL -o /tmp/verify-page.html -w "%{http_code}" "$url")
17+
18+
# Check for 404 HTML or redirect script
19+
IS_404=false
20+
if grep -q 'window.location.replace' /tmp/verify-page.html 2>/dev/null; then
21+
IS_404=true
22+
fi
23+
if grep -q '<title>404</title>' /tmp/verify-page.html 2>/dev/null; then
24+
IS_404=true
25+
fi
26+
# Check if it's the GitHub Pages 404
27+
if [ "$STATUS" = "404" ]; then
28+
IS_404=true
29+
fi
30+
# Check if content is suspiciously small (likely 404 redirect)
31+
SIZE=$(wc -c < /tmp/verify-page.html | tr -d ' ')
32+
if [ "$SIZE" -lt 500 ]; then
33+
IS_404=true
34+
fi
35+
36+
if [ "$IS_404" = true ]; then
37+
echo -e "${RED}FAIL${NC} [$STATUS] $label ($url) — got 404 or redirect page (${SIZE}B)"
38+
FAIL=1
39+
else
40+
echo -e "${GREEN}OK${NC} [$STATUS] $label ($url) (${SIZE}B)"
41+
fi
42+
}
43+
44+
check_asset() {
45+
local url="$1"
46+
local label="$2"
47+
local expect_type="$3"
48+
49+
STATUS=$(curl -sL -o /dev/null -w "%{http_code}" "$url")
50+
CTYPE=$(curl -sL -o /dev/null -w "%{content_type}" "$url")
51+
52+
if [ "$STATUS" = "200" ]; then
53+
if [ -n "$expect_type" ] && ! echo "$CTYPE" | grep -q "$expect_type"; then
54+
echo -e "${YELLOW}WARN${NC} [$STATUS] $label — wrong content-type: $CTYPE (expected $expect_type)"
55+
FAIL=1
56+
else
57+
echo -e "${GREEN}OK${NC} [$STATUS] $label ($CTYPE)"
58+
fi
59+
else
60+
echo -e "${RED}FAIL${NC} [$STATUS] $label ($url)"
61+
FAIL=1
62+
fi
63+
}
64+
65+
echo "=== Checking pages ==="
66+
check_page "$BASE/" "Docs landing"
67+
check_page "$BASE/docs" "Docs index"
68+
check_page "$BASE/docs/tutorials/getting-started" "Getting Started"
69+
check_page "$BASE/docs/tutorials/react-widget" "React Widget docs"
70+
check_page "$BASE/docs/explanation/architecture" "Architecture docs"
71+
check_page "$BASE/playground/" "Playground root"
72+
check_page "$BASE/playground/gnata" "Playground gnata mode"
73+
check_page "$BASE/playground/sqlite" "Playground sqlite mode"
74+
75+
echo ""
76+
echo "=== Checking OG image ==="
77+
# Extract OG URL from deployed HTML
78+
OG_URL=$(curl -sL "$BASE/" | python3 -c "
79+
import re, sys
80+
html = sys.stdin.read()
81+
m = re.search(r'og:image\x22 content=\x22([^\x22]+)\x22', html)
82+
print(m.group(1) if m else '')
83+
")
84+
85+
if [ -n "$OG_URL" ]; then
86+
echo "OG URL in HTML: $OG_URL"
87+
check_asset "$OG_URL" "OG image" "image"
88+
else
89+
echo -e "${RED}FAIL${NC} Could not find og:image in HTML"
90+
FAIL=1
91+
fi
92+
93+
echo ""
94+
echo "=== Checking key assets ==="
95+
check_asset "$BASE/gnata.wasm" "gnata.wasm" "application/wasm"
96+
check_asset "$BASE/gnata-lsp.wasm" "gnata-lsp.wasm" "application/wasm"
97+
check_asset "$BASE/playground/gnata.wasm" "playground gnata.wasm" "application/wasm"
98+
99+
echo ""
100+
if [ $FAIL -eq 0 ]; then
101+
echo -e "${GREEN}All checks passed!${NC}"
102+
else
103+
echo -e "${RED}Some checks failed.${NC}"
104+
fi
105+
exit $FAIL
File renamed without changes.

website/src/app/(home)/page.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,18 @@ const reactHtml = await codeToHtml(reactCode, {
102102

103103
import type { Metadata } from 'next';
104104

105+
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';
106+
105107
export const metadata: Metadata = {
106108
title: 'gnata-sqlite — End-to-end JSONata 2.x for SQLite, with React Editor',
107109
description: 'Let end-users write JSONata expressions against SQLite data. Loadable SQLite extension, 85KB TinyGo WASM LSP with autocomplete and hover docs, and a composable React editor widget. Open source, MIT licensed.',
110+
openGraph: {
111+
images: `${basePath}/og-image.png`,
112+
},
113+
twitter: {
114+
card: 'summary_large_image',
115+
images: `${basePath}/og-image.png`,
116+
},
108117
};
109118

110119
export default async function HomePage() {

website/src/app/layout.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ import { Provider } from '@/components/provider';
33
import type { Metadata } from 'next';
44
import './global.css';
55

6-
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';
7-
86
export const metadata: Metadata = {
9-
metadataBase: new URL(`https://rbby.dev${basePath}`),
7+
metadataBase: new URL('https://rbby.dev'),
108
};
119

1210
const onest = Onest({

website/src/lib/shared.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
export const appName = 'gnata-sqlite';
2+
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';
23
export const docsRoute = '/docs';
3-
export const docsImageRoute = '/og/docs';
4-
export const docsContentRoute = '/llms.mdx/docs';
4+
export const docsImageRoute = `${basePath}/og/docs`;
5+
export const docsContentRoute = `${basePath}/llms.mdx/docs`;
56
export const gitConfig = {
67
user: 'rbbydotdev',
78
repo: 'gnata-sqlite',

0 commit comments

Comments
 (0)