Skip to content

Commit d9c2129

Browse files
Palash Awasthiclaude
authored andcommitted
reflex-site-shared: add canonical override + Streamlit migration footer 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) <noreply@anthropic.com>
1 parent 9ed3692 commit d9c2129

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

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

Lines changed: 10 additions & 2 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,6 +139,10 @@ 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). Leave
145+
None to canonicalize to ``url``.
138146
139147
Returns:
140148
A list of meta tag dictionaries.
@@ -149,7 +157,7 @@ def create_meta_tags(
149157
image=image_url,
150158
url=page_url,
151159
),
152-
rx.el.link(rel="canonical", href=page_url),
160+
rx.el.link(rel="canonical", href=canonical or page_url),
153161
]
154162

155163

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ def footer_index(class_name: str = "", grid_class_name: str = "") -> rx.Componen
295295
footer_link_flex(
296296
"Migration",
297297
[
298+
footer_link("From Streamlit", "/migration/streamlit/"),
298299
footer_link("From No-Code", "/migration/no-code/"),
299300
footer_link("From Low-Code", "/migration/low-code/"),
300301
footer_link(

0 commit comments

Comments
 (0)