Add meta tags for docpages#6464
Conversation
Greptile SummaryThis PR adds per-page SEO meta tags (
Confidence Score: 4/5Safe to merge; the changes are build-time only and do not affect request handling or data storage. The implementation is clean end-to-end and well-tested. The two observations are both minor: the packages/reflex-site-shared/src/reflex_site_shared/utils/url.py (localhost check) and docs/app/reflex_docs/reflex_docs.py (_seo_meta_tags deduplication assumptions). Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
FM[Markdown Frontmatter
description / image] --> P[_parser.py
_extract_frontmatter]
P --> FMT[FrontMatter dataclass
+ description + image]
FMT --> Cache[_frontmatter_for
lru_cache]
Cache --> GD[get_description_from_frontmatter]
Cache --> GI[get_image_from_frontmatter]
GD --> MDP[make_docpage / multi_docs]
GI --> MDP
MDP --> DP[docpage decorator
description + image]
DP --> Route[Route
path / title / description / image]
Route --> RD[reflex_docs.py loop]
RD --> CDN[to_cdn_image_url]
RD --> PU[public_url
canonical URL]
CDN --> SEO[_seo_meta_tags
create_meta_tags - deduped]
PU --> SEO
SEO --> AP[app.add_page
meta list]
Route --> AP
Reviews (1): Last reviewed commit: "Add meta tags for docpages" | Re-trigger Greptile |
…dates # Conflicts: # docs/app/agent_files/_plugin.py # docs/app/reflex_docs/pages/docs/__init__.py # docs/app/reflex_docs/pages/docs/component.py
|
|
||
| config = get_config() | ||
| deploy_url = (config.deploy_url or "").removesuffix("/") | ||
| if fallback_base is not None and (not deploy_url or "localhost" in deploy_url): |
There was a problem hiding this comment.
we might be able to use is_prod_mode here. Now we are doing a simple string check that can fail.
from reflex.utils.exec import is_prod_mode and also move the get_config import on top.
from reflex.utils.exec import is_prod_mode
from reflex_base.config import get_config
def public_url(path: str = "", fallback_base: str | None = None) -> str:
if fallback_base is not None and not is_prod_mode():
return fallback_base.rstrip("/") + path
config = get_config()
deploy_url = (config.deploy_url or "").removesuffix("/")
frontend_path = (config.frontend_path or "").strip("/")
if frontend_path:
base = f"{deploy_url}/{frontend_path}" if deploy_url else f"/{frontend_path}"
else:
base = deploy_url
return f"{base}{path}" if base else path| return ( | ||
| f"{base_url}/{url_path.as_posix()}" if base_url else f"/{url_path.as_posix()}" | ||
| ) | ||
| from reflex_site_shared.utils.url import public_url |
There was a problem hiding this comment.
we also might wan to move this to top. and same in _docs_home_url
No description provided.