This repository was archived by the owner on Apr 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 232
Expand file tree
/
Copy pathmeta.py
More file actions
131 lines (121 loc) · 4.71 KB
/
meta.py
File metadata and controls
131 lines (121 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import reflex as rx
from pcweb.constants import REFLEX_DOMAIN, REFLEX_DOMAIN_URL, TWITTER_CREATOR
ONE_LINE_DESCRIPTION = "Build with AI, iterate in Python, deploy to any cloud. The unified platform to build and scale enterprise apps."
meta_tags = [
# HTML Meta Tags
{"name": "application-name", "content": "Reflex"},
{
"name": "keywords",
"content": "reflex, python, web apps, framework, open source, frontend, backend, full stack",
},
{
"name": "description",
"content": ONE_LINE_DESCRIPTION,
},
# Facebook Meta Tags
{"property": "og:url", "content": REFLEX_DOMAIN_URL},
{"property": "og:type", "content": "website"},
{"property": "og:title", "content": "Reflex · Build with AI, Deploy with Python"},
{
"property": "og:description",
"content": ONE_LINE_DESCRIPTION,
},
{"property": "og:image", "content": "/previews/index_preview.webp"},
# Twitter Meta Tags
{"name": "twitter:card", "content": "summary_large_image"},
{"property": "twitter:domain", "content": REFLEX_DOMAIN},
{"property": "twitter:url", "content": REFLEX_DOMAIN_URL},
{"name": "twitter:title", "content": "Reflex · Build with AI, Deploy with Python"},
{
"name": "twitter:description",
"content": ONE_LINE_DESCRIPTION,
},
{"name": "twitter:image", "content": "/previews/index_preview.webp"},
{"name": "twitter:creator", "content": TWITTER_CREATOR},
]
hosting_meta_tags = [
# HTML Meta Tags
{"name": "application-name", "content": "Reflex"},
{
"name": "keywords",
"content": "reflex, python, web apps, framework, open source, frontend, backend, full stack",
},
{
"name": "description",
"content": ONE_LINE_DESCRIPTION,
},
# Facebook Meta Tags
{"property": "og:url", "content": REFLEX_DOMAIN_URL},
{"property": "og:type", "content": "website"},
{"property": "og:title", "content": "Reflex · Build with AI, Deploy with Python"},
{
"property": "og:description",
"content": ONE_LINE_DESCRIPTION,
},
{"property": "og:image", "content": "/previews/hosting_preview.webp"},
# Twitter Meta Tags
{"name": "twitter:card", "content": "summary_large_image"},
{"property": "twitter:domain", "content": REFLEX_DOMAIN},
{"property": "twitter:url", "content": REFLEX_DOMAIN_URL},
{"name": "twitter:title", "content": "Reflex · Build with AI, Deploy with Python"},
{
"name": "twitter:description",
"content": ONE_LINE_DESCRIPTION,
},
{"name": "twitter:image", "content": "/previews/hosting_preview.webp"},
{"name": "twitter:creator", "content": TWITTER_CREATOR},
]
def favicons_links() -> list[rx.Component]:
return [
rx.el.link(
rel="apple-touch-icon", sizes="180x180", href="/meta/apple-touch-icon.png"
),
rx.el.link(
rel="icon", type="image/png", sizes="32x32", href="/meta/favicon-32x32.png"
),
rx.el.link(
rel="icon", type="image/png", sizes="16x16", href="/meta/favicon-16x16.png"
),
rx.el.link(rel="manifest", href="/meta/site.webmanifest"),
rx.el.link(rel="shortcut icon", href="/favicon.ico"),
]
def create_meta_tags(
title: str, description: str, image: str, url: str | None = None
) -> list[rx.Component]:
page_url = url if url else REFLEX_DOMAIN_URL
if image and not image.startswith(("http://", "https://")):
image_url = f"https://reflex.dev{'' if image.startswith('/') else '/'}{image}"
else:
image_url = image
return [
# HTML Meta Tags
{"name": "application-name", "content": "Reflex"},
{
"name": "keywords",
"content": "reflex, python, web apps, framework, open source, frontend, backend, full stack",
},
{
"name": "description",
"content": description,
},
# Facebook Meta Tags
{"property": "og:url", "content": page_url},
{"property": "og:type", "content": "website"},
{"property": "og:title", "content": title},
{
"property": "og:description",
"content": description,
},
{"property": "og:image", "content": image_url},
# Twitter Meta Tags
{"name": "twitter:card", "content": "summary_large_image"},
{"property": "twitter:domain", "content": REFLEX_DOMAIN},
{"property": "twitter:url", "content": page_url},
{"name": "twitter:title", "content": title},
{
"name": "twitter:description",
"content": description,
},
{"name": "twitter:image", "content": image_url},
{"name": "twitter:creator", "content": TWITTER_CREATOR},
]