CE: Per-page og:url + canonical in page_shell#308
Merged
Conversation
PR #307 added og:url and related meta tags through page_shell but hardcoded og:url to https://modelrelay.io/ (root) for every non-root page, and omitted <link rel="canonical"> entirely. That meant /login, /signup, /pricing, /setup, and /integrate all claimed root as their og:url and had no canonical link. - Thread request path through page_shell() and page_shell_custom(), render per-page og:url and canonical as https://modelrelay.io{path}. - Update every call site across modelrelay-web and modelrelay-cloud to pass the route's path. Dynamic paths (e.g. /dashboard/keys/{id}/revoke) are built via format!. - Add og:url + canonical for /pricing directly to its static template. - Update the static landing index.html to use https://modelrelay.io/ with a trailing slash so it matches the page_shell convention. - Add integration tests asserting /, /login, /signup, /pricing, and /checkout/cancel each render og:url and canonical containing their path.
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.
What
PR #307 added
og:urland related meta tags throughpage_shellbut hardcodedog:urltohttps://modelrelay.io/(root) for every non-root page, and omitted<link rel="canonical">entirely. That meant/login,/signup,/pricing,/setup, and/integrateall claimed root as theirog:urland had no canonical link.This PR threads the request path through
page_shell()andpage_shell_custom(), rendering per-pageog:urland<link rel="canonical">ashttps://modelrelay.io{path}, and updates every call site in the workspace to pass its route path.Changes
modelrelay-web/src/templates.rs:page_shellandpage_shell_customnow acceptpath: &str; render<meta property="og:url" content="https://modelrelay.io{path}">and<link rel="canonical" href="https://modelrelay.io{path}">.modelrelay-webandmodelrelay-cloud(routes/mod.rs,routes/auth.rs,routes/checkout.rs,routes/dashboard.rs) to pass its route path. Dynamic paths like/dashboard/keys/{id}/revokeare built viaformat!and threaded through helpers.templates/pricing.html(served statically withoutpage_shell): addog:urlandcanonicalfor/pricingdirectly.templates/index.html: normalize existingog:urlandcanonicaltohttps://modelrelay.io/with trailing slash so the landing page matches the convention used bypage_shell.tests/http_routes.rs: new integration tests asserting/,/login,/signup,/pricing, and/checkout/canceleach renderog:urlandcanonicalcontaining their page path. Added a session-layer helper so session-dependent routes render rather than 503.Title, description,
og:title,og:description, andtwitter:*tags are left untouched.Validation
cargo test -p modelrelay-cloud -p modelrelay-web— 64 tests passcargo fmt --check— cleancargo clippy -p modelrelay-cloud -p modelrelay-web --all-targets -- -D warnings— clean