Skip to content

Commit 7ea5587

Browse files
committed
fix: eliminate FOUC and switch og:image to PNG
Replace `import appCss from '#/styles.css?url'` + `head.links` stylesheet entry with a side-effect import. The two-pass Vite build (SSR + client) was hashing the same CSS to different bytes; the SSR HTML referenced one hash while only the other lived on disk, so the browser 404'd on the stylesheet and painted unstyled until React 19 swapped in the working one at hydration. Side-effect import routes both passes through the unified asset pipeline so the URL matches. Switch og:image from SVG to a 1200x630 PNG rendered from the SVG source (Twitter/Facebook/LinkedIn don't render SVG previews reliably) and add og:image:width/height/type/alt + twitter:image:alt so crawlers can lay out the card before the image fetch resolves.
1 parent 666906b commit 7ea5587

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

public/og-image.png

149 KB
Loading

src/lib/seo.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface HeadPayload {
1919
}
2020

2121
const SITE_NAME = 'Packyard Documentation'
22-
const DEFAULT_OG_IMAGE = '/og-image.svg'
22+
const DEFAULT_OG_IMAGE = '/og-image.png'
2323

2424
export function buildPageHead(input: SeoInput): HeadPayload {
2525
const origin = stripTrailing(input.baseUrl)
@@ -34,9 +34,14 @@ export function buildPageHead(input: SeoInput): HeadPayload {
3434
{ property: 'og:title', content: input.title },
3535
{ property: 'og:url', content: canonical },
3636
{ property: 'og:image', content: image },
37+
{ property: 'og:image:width', content: '1200' },
38+
{ property: 'og:image:height', content: '630' },
39+
{ property: 'og:image:type', content: 'image/png' },
40+
{ property: 'og:image:alt', content: input.title },
3741
{ name: 'twitter:card', content: 'summary_large_image' },
3842
{ name: 'twitter:title', content: input.title },
3943
{ name: 'twitter:image', content: image },
44+
{ name: 'twitter:image:alt', content: input.title },
4045
]
4146

4247
if (input.description) {

src/routes/__root.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Footer from '#/components/Footer'
99
import Header from '#/components/Header'
1010
import { getDocsConfig } from '#/lib/docs.server'
1111

12-
import appCss from '#/styles.css?url'
12+
import '#/styles.css'
1313

1414
const getRootData = createServerFn({ method: 'GET' }).handler(async () => {
1515
const config = getDocsConfig()
@@ -40,7 +40,6 @@ export const Route = createRootRoute({
4040
},
4141
],
4242
links: [
43-
{ rel: 'stylesheet', href: appCss },
4443
{ rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' },
4544
],
4645
}),

0 commit comments

Comments
 (0)