Skip to content

reflex-site-shared: canonical override + Streamlit footer link + Try-for-free primary CTA#6521

Open
PalashAwasthi05 wants to merge 1 commit into
reflex-dev:mainfrom
PalashAwasthi05:streamlit-migration-shared
Open

reflex-site-shared: canonical override + Streamlit footer link + Try-for-free primary CTA#6521
PalashAwasthi05 wants to merge 1 commit into
reflex-dev:mainfrom
PalashAwasthi05:streamlit-migration-shared

Conversation

@PalashAwasthi05
Copy link
Copy Markdown

@PalashAwasthi05 PalashAwasthi05 commented May 16, 2026

Summary

Three small changes to reflex-site-shared for the Streamlit migration PR series:

  1. meta.create_meta_tags grows an optional canonical kwarg. When set, the rendered <link rel="canonical"> points at that URL instead of the page's own url. Default behavior is unchanged when the kwarg is omitted. The blog companion PR uses this to canonicalize /blog/reflex-streamlit to /migration/streamlit.

  2. Footer "Migration" column gets a From Streamlit entry pointing at /migration/streamlit/, ordered first to surface the most specific Streamlit-alternative target above the broader low-code link.

  3. cta_card (bottom CTA on every marketing page) swaps Try-for-free into the primary slot and demotes Book a Demo to the ghost-variant secondary. Affects every marketing-templated page across reflex-dev/marketing, reflex-dev/docs, and reflex-dev/blog once their reflex-site-shared lockfiles are bumped. No layout change beyond variant and ordering.

Why

The Streamlit lander targets paid-search traffic on "streamlit alternative" intent. That audience self-serves, so the primary CTA across the site should be "Try for free" with Book a Demo as a clearly secondary path.

Pairs with

  • (coming) reflex-dev/marketing PR adding the /migration/streamlit lander.
  • (coming) reflex-dev/blog PR refreshing /blog/reflex-streamlit with a frontmatter canonical override pointing at the new lander.

Test plan

  • create_meta_tags(..., canonical=None) produces the same output as before.
  • create_meta_tags(..., canonical="https://reflex.dev/foo") renders a single <link rel="canonical" href="https://reflex.dev/foo"> and no duplicate.
  • Footer "Migration" column shows "From Streamlit" at the top.
  • cta_card shows "Try for free" (primary, left) + "Book a Demo" (ghost, right) on every marketing page.

🤖 Generated with Claude Code

@PalashAwasthi05 PalashAwasthi05 requested a review from a team as a code owner May 16, 2026 08:32
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 16, 2026

Greptile Summary

This PR makes two additive changes to reflex-site-shared: create_meta_tags gains an optional canonical kwarg so callers can point the <link rel=\"canonical\"> at a different URL without a 301, and the footer's Migration column gets a new "From Streamlit" entry at the top.

  • meta.py: The canonical parameter defaults to None, preserving existing behavior. When provided, it replaces the auto-derived page_url in the canonical link element — but og:url and twitter:url (populated by _build_meta_tags) still use page_url, which may send mixed signals to social crawlers.
  • footer.py: One new footer_link(\"From Streamlit\", \"/migration/streamlit/\") entry, inserted first in the Migration list; no structural changes.

Confidence Score: 4/5

Safe to merge; changes are purely additive and do not touch any critical runtime paths.

Both changes are additive and backwards-compatible. The canonical kwarg defaults to None so all existing call sites are unaffected. The only concern is that when a canonical override is supplied, the OG/Twitter URL tags still reflect the originating page rather than the canonical target, which partially undermines the SEO consolidation goal of the feature. The empty-string fallback with or is a minor defensive gap.

A second look at meta.py is worthwhile — specifically whether og:url should also be updated when a canonical override is provided.

Important Files Changed

Filename Overview
packages/reflex-site-shared/src/reflex_site_shared/meta/meta.py Adds optional canonical kwarg to create_meta_tags; default behavior is preserved, but og:url/twitter:url are not updated to match the override and the fallback uses or rather than an is not None guard.
packages/reflex-site-shared/src/reflex_site_shared/views/footer.py Adds "From Streamlit" footer link at the top of the Migration column; straightforward additive change with no logic concerns.

Sequence Diagram

sequenceDiagram
    participant Caller as Blog / Marketing page
    participant CMT as create_meta_tags()
    participant BMT as _build_meta_tags()
    participant DOM as Rendered HTML

    Caller->>CMT: title, description, image, url, canonical
    CMT->>BMT: "title, description, image_url, url=page_url"
    BMT-->>CMT: "[og:url=page_url, twitter:url=page_url, ...]"
    CMT->>DOM: "link rel=canonical href=canonical"
    Note over DOM: og:url still points to blog post URL<br/>canonical points to migration lander
Loading

Reviews (1): Last reviewed commit: "reflex-site-shared: add canonical overri..." | Re-trigger Greptile

url=page_url,
),
rx.el.link(rel="canonical", href=page_url),
rx.el.link(rel="canonical", href=canonical or page_url),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 og:url / twitter:url out of sync with canonical override

When canonical is set to a different URL (e.g., https://reflex.dev/migration/streamlit), _build_meta_tags still receives url=page_url, so og:url and twitter:url continue to point at the originating blog post. Social crawlers (Facebook, Twitter/X) index og:url independently of <link rel="canonical">, so shares of the blog post will surface the blog URL rather than the canonical migration lander, sending mixed signals that partially undermine the SEO consolidation goal. Consider passing canonical or page_url as the url argument to _build_meta_tags as well, or adding a note in the docstring if the current split is intentional.

url=page_url,
),
rx.el.link(rel="canonical", href=page_url),
rx.el.link(rel="canonical", href=canonical or page_url),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The expression canonical or page_url silently falls back to page_url when canonical is an empty string "", which is technically a valid (though meaningless) input. Per the codebase's convention for optional string parameters, an explicit is not None guard avoids the ambiguity and is more defensive.

Suggested change
rx.el.link(rel="canonical", href=canonical or page_url),
rx.el.link(rel="canonical", href=canonical if canonical is not None else page_url),

Rule Used: When checking for the existence of a value that co... (source)

Learned From
reflex-dev/flexgen#2444

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 16, 2026

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing PalashAwasthi05:streamlit-migration-shared (0772902) with main (9ed3692)

Open in CodSpeed

…er link

- create_meta_tags grows an optional `canonical` kwarg so any consumer
  (blog post, lander) can declare a different canonical URL than the
  page's own. Default behavior is unchanged when the kwarg is omitted.
- Footer Migration column gets a "From Streamlit" entry pointing at
  /migration/streamlit/, ordered first to surface the most specific
  target.

Pairs with:
- reflex-dev/marketing PR adding the /migration/streamlit lander.
- reflex-dev/blog PR refreshing /blog/reflex-streamlit with a frontmatter
  canonical override that consumes the new kwarg.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@PalashAwasthi05 PalashAwasthi05 force-pushed the streamlit-migration-shared branch from d9c2129 to 0772902 Compare May 17, 2026 00:05
@PalashAwasthi05 PalashAwasthi05 changed the title reflex-site-shared: add canonical override + Streamlit migration footer link reflex-site-shared: canonical override + Streamlit footer link + Try-for-free primary CTA May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant