Skip to content

Commit 6511f3b

Browse files
PalashAwasthi05Palash Awasthiclaude
authored
reflex-site-shared: canonical override + Try-for-free primary CTA (#6521)
Two small changes to reflex-site-shared for the Streamlit migration PR series: 1. create_meta_tags grows an optional canonical kwarg. When set, the rendered <link rel="canonical">, og:url, and twitter:url all point at that URL instead of the page's own url, so search engines and social crawlers index the same target. Default behavior unchanged when the kwarg is omitted. 2. 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 the three apps once their reflex-site-shared lockfiles are bumped. Pairs with: - reflex-dev/marketing PR adding the /migration/streamlit lander. - reflex-dev/blog PR refreshing /blog/reflex-streamlit with a frontmatter canonical override pointing at the new lander. Co-authored-by: Palash Awasthi <palash@Palashs-MacBook-Pro.local> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 048c7d8 commit 6511f3b

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

packages/reflex-site-shared/src/reflex_site_shared/meta/meta.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ def to_cdn_image_url(image: str | None) -> str:
126126

127127

128128
def create_meta_tags(
129-
title: str, description: str, image: str | None, url: str | None = None
129+
title: str,
130+
description: str,
131+
image: str | None,
132+
url: str | None = None,
133+
canonical: str | None = None,
130134
) -> list[dict[str, str] | rx.Component]:
131135
"""Create meta tags for a page.
132136
@@ -135,21 +139,28 @@ def create_meta_tags(
135139
description: The page description.
136140
image: The image path for social media previews (None to omit).
137141
url: The page URL (optional, defaults to REFLEX_DOMAIN_URL).
142+
canonical: Override for the canonical link. Use when one page should
143+
consolidate SEO signals to a different URL (for example, a blog
144+
post that canonicalizes to a dedicated comparison lander). When
145+
set, ``og:url`` and ``twitter:url`` also follow the canonical so
146+
social crawlers index the same target as search engines. Leave
147+
None to canonicalize to ``url``.
138148
139149
Returns:
140150
A list of meta tag dictionaries.
141151
"""
142152
page_url = url or REFLEX_DOMAIN_URL
153+
canonical_url = canonical if canonical is not None else page_url
143154
image_url = to_cdn_image_url(image) if image else None
144155

145156
return [
146157
*_build_meta_tags(
147158
title=title,
148159
description=description,
149160
image=image_url,
150-
url=page_url,
161+
url=canonical_url,
151162
),
152-
rx.el.link(rel="canonical", href=page_url),
163+
rx.el.link(rel="canonical", href=canonical_url),
153164
]
154165

155166

packages/reflex-site-shared/src/reflex_site_shared/views/cta_card.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ def cta_card():
2626
class_name="text-m-slate-7 dark:text-m-slate-6 text-sm font-medium",
2727
),
2828
rx.el.div(
29-
demo_form_dialog(
30-
trigger=marketing_button(
31-
"Book a Demo",
32-
variant="primary",
33-
),
34-
),
3529
rx.el.elements.a(
3630
marketing_button(
3731
"Try for free",
3832
ui.icon("ArrowRight01Icon"),
39-
variant="ghost",
33+
variant="primary",
4034
),
4135
href=REFLEX_BUILD_URL,
4236
target="_blank",
4337
),
38+
demo_form_dialog(
39+
trigger=marketing_button(
40+
"Book a Demo",
41+
variant="ghost",
42+
),
43+
),
4444
class_name="flex flex-row gap-4 items-center",
4545
),
4646
class_name="flex flex-col gap-6 justify-center max-w-[29.25rem]",

0 commit comments

Comments
 (0)