Conversation
Greptile SummaryThis PR adds 40 new SEO-targeted blog posts (all without an Key changes:
Confidence Score: 5/5Safe to merge — all previously identified image-handling issues are properly resolved with no new regressions. All prior P1 findings (broken og:image/twitter:image tags, invalid JSON-LD image field) are fixed. The new posts are hidden from the card grid via show_in_cards: false, so no layout regressions. No new issues were found across the 43 changed files. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant MD as Blog Post (.md)
participant BP as blog.py / page.py
participant MP as marketing_page
participant Meta as meta.py
MD->>BP: metadata (no 'image' key)
BP->>BP: metadata.get('image') or None → None
BP->>MP: marketing_page(image=None, meta=[...])
BP->>Meta: create_meta_tags(image=None)
Meta->>Meta: image_url = None (skip to_cdn_image_url)
Meta->>Meta: _build_meta_tags(image=None)
Meta-->>Meta: if image: → False, skip og:image & twitter:image
Meta-->>BP: tags without og:image / twitter:image
BP->>Meta: blog_jsonld(image=None)
Meta->>Meta: image_url = None (skip to_cdn_image_url)
Meta->>Meta: if image_url: → False, omit 'image' from posting
Meta-->>BP: valid JSON-LD without image field
BP->>BP: if meta.get('image'): → False → rx.fragment()
BP-->>MP: page rendered without image element
Greploops — Automatically fix all review issues by running Reviews (2): Last reviewed commit: "image fix" | Re-trigger Greptile |
pcweb/pages/blog/page.py
Outdated
| date=str(meta["date"]), | ||
| image=meta["image"], | ||
| image=meta.get("image", ""), |
There was a problem hiding this comment.
Empty string produces invalid JSON-LD
image field
meta.get("image", "") returns "" when no image is present. blog_jsonld in meta.py then calls to_cdn_image_url(""), which returns "" (line 100: return image or ""), and unconditionally assigns "image": "" to the posting dict (line 161). This results in invalid schema.org structured data — an empty string is not a valid URL for the image property — which Google Search Console will flag as a structured data error and which can hurt SEO for imageless posts.
The fix requires two coordinated changes:
- Pass
Nonehere instead of"":
| date=str(meta["date"]), | |
| image=meta["image"], | |
| image=meta.get("image", ""), | |
| image=meta.get("image") or None, |
- Update
blog_jsonldinpcweb/meta/meta.pyto conditionally include the image field:
image_url = to_cdn_image_url(image) if image else None
posting: dict = {
"@type": "BlogPosting",
"headline": title,
"description": description,
"datePublished": str(date),
"url": url,
"author": author_node,
}
if image_url:
posting["image"] = image_url| title=seo_title, | ||
| description=document.metadata["description"], | ||
| image=document.metadata["image"], | ||
| image=document.metadata.get("image", ""), | ||
| meta=create_meta_tags( | ||
| title=seo_title, | ||
| description=document.metadata["description"], | ||
| image=document.metadata["image"], | ||
| image=document.metadata.get("image", ""), | ||
| url=f"https://reflex.dev{route}", |
There was a problem hiding this comment.
Empty string produces broken
og:image / twitter:image meta tags
Both image=document.metadata.get("image", "") calls (lines 230 and 234) pass "" to marketing_page and create_meta_tags when no image is present. In create_meta_tags (meta.py line 122), "" is falsy so image_url = "", which is then forwarded to _build_meta_tags. That function unconditionally emits:
<meta property="og:image" content="">
<meta name="twitter:image" content="">Social media crawlers (Facebook, Twitter/X, LinkedIn) will see these tags, attempt to resolve an empty URL, and render broken or missing share previews — this is actively worse than omitting the tags entirely.
Change both fallbacks from "" to None (or omit them) and update _build_meta_tags in meta.py to skip the image tags when the value is falsy:
# In blog.py (apply to both occurrences)
image=document.metadata.get("image") or None,# In meta.py _build_meta_tags, replace the two image lines:
*([{"property": "og:image", "content": image}, {"name": "twitter:image", "content": image}] if image else []),|
@greptile-ai |
No description provided.