Conversation
Greptile SummaryThis PR adds a
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Blog page() called"] --> B["Compute page_url\nREFLEX_URL + route"]
B --> C["rx.el.link canonical\n⚠️ placed in body section"]
B --> D["blog_jsonld script\nin body - valid for JSON-LD"]
C --> E["Rendered HTML\n<section>\n <link rel=canonical> ❌\n ...body content...\n</section>"]
D --> E
F["Expected HTML\n<head>\n <link rel=canonical> ✅\n</head>"] -. "should be" .-> E
E --> G["Google crawler\nmay ignore body canonical"]
Reviews (1): Last reviewed commit: "Merge branch 'main' into fix-canonical-r..." | Re-trigger Greptile |
pcweb/pages/blog/page.py
Outdated
| ) | ||
|
|
||
| return rx.el.section( | ||
| rx.el.link(rel="canonical", href=page_url), |
There was a problem hiding this comment.
Canonical tag placed in
<body>, not <head>
<link rel="canonical"> must be in the HTML <head> to be reliably recognized by search engines. Placing it inside rx.el.section renders it as a child of a <section> body element, which is not valid HTML and may be ignored by Google's canonical URL parser.
The PR's stated goal is to fix redirect handling via Google canonical — but this placement makes it unlikely to take effect. According to Google's documentation, canonical tags should appear in the <head> of the page.
The correct approach would be to inject the canonical URL into the <head> via Reflex's app.add_page() head_components parameter (or equivalent), rather than embedding it in the body component tree. For example, at the point where blog routes are registered in pcweb/pcweb.py, a head_components=[rx.el.link(rel="canonical", href=page_url)] argument could be passed.
No description provided.