Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions packages/reflex-site-shared/src/reflex_site_shared/meta/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ def to_cdn_image_url(image: str | None) -> str:


def create_meta_tags(
title: str, description: str, image: str | None, url: str | None = None
title: str,
description: str,
image: str | None,
url: str | None = None,
canonical: str | None = None,
) -> list[dict[str, str] | rx.Component]:
"""Create meta tags for a page.

Expand All @@ -135,21 +139,28 @@ def create_meta_tags(
description: The page description.
image: The image path for social media previews (None to omit).
url: The page URL (optional, defaults to REFLEX_DOMAIN_URL).
canonical: Override for the canonical link. Use when one page should
consolidate SEO signals to a different URL (for example, a blog
post that canonicalizes to a dedicated comparison lander). When
set, ``og:url`` and ``twitter:url`` also follow the canonical so
social crawlers index the same target as search engines. Leave
None to canonicalize to ``url``.

Returns:
A list of meta tag dictionaries.
"""
page_url = url or REFLEX_DOMAIN_URL
canonical_url = canonical if canonical is not None else page_url
image_url = to_cdn_image_url(image) if image else None

return [
*_build_meta_tags(
title=title,
description=description,
image=image_url,
url=page_url,
url=canonical_url,
),
rx.el.link(rel="canonical", href=page_url),
rx.el.link(rel="canonical", href=canonical_url),
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ def cta_card():
class_name="text-m-slate-7 dark:text-m-slate-6 text-sm font-medium",
),
rx.el.div(
demo_form_dialog(
trigger=marketing_button(
"Book a Demo",
variant="primary",
),
),
rx.el.elements.a(
marketing_button(
"Try for free",
ui.icon("ArrowRight01Icon"),
variant="ghost",
variant="primary",
),
href=REFLEX_BUILD_URL,
target="_blank",
),
demo_form_dialog(
trigger=marketing_button(
"Book a Demo",
variant="ghost",
),
),
class_name="flex flex-row gap-4 items-center",
),
class_name="flex flex-col gap-6 justify-center max-w-[29.25rem]",
Expand Down
Loading