Enable global SSR for SEO with responsive CSS and chart guards - #73
Open
google-labs-jules[bot] wants to merge 1 commit into
Open
Conversation
…dd mount guards to VegaLite charts
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This Pull Request re-enables global server-side rendering (SSR) to allow search engines to index public job listings, while resolving previous issues with server-side crashes and hydration mismatches. By offloading layout responsiveness to pure CSS and wrapping browser-dependent scripts/charts in client-side mounting guards, we achieve full search-engine crawlability without compromising layout stability or runtime performance.
Why These Changes Are Necessary
The Problem
Previously, global SSR was disabled (
export const ssr = false;) to prevent server-side crashes caused by client-dependent analytics scripts, device detection, and DOM-dependent data visualizations (Vega-Lite). However, disabling SSR meant that search engine crawlers received empty HTML shells, preventing them from indexing public job listings and hurting organic traffic acquisition.The Solution
We have re-enabled global SSR to ensure crawlers get fully-rendered HTML from the initial response. To prevent the crashes and hydration mismatches that previously plagued the system, we adopted three design patterns:
onMount).Device.isMobile) in favor of fluid Tailwind CSS responsive classes. This ensures the initial server render matches the client paint, dropping hydration errors to zero.onMountfires, using structured pulse skeletons to reserve layout space and eliminate Cumulative Layout Shift (CLS).What Changed
1. Re-enabled Server-Side Rendering (SSR)
src/routes/+layout.server.tsexport const ssr = false;toexport const ssr = true;.2. Isolated Client-Only Analytics
src/routes/+layout.svelteinject()function inside Svelte'sonMountlifecycle hook.windowanddocument).3. Transitioned to Pure CSS Responsive Layouts
src/routes/+page.sveltesvelte-device-infoimport and runtimeDevice.isMobilechecks. Replaced the sidebar container styles with Tailwind CSS responsive utilities:4. Added Mount Guards and Skeletons for Interactive Charts
src/lib/components/PostFilters.svelteisMountedstate variable that switches totrueon mount. Whilefalse, we render fluid, pulse-animated SVG skeletons in place of the Vega-Lite charts.