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
5 changes: 4 additions & 1 deletion pcweb/components/code_card.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

import reflex as rx
import reflex_ui as ui
from reflex.experimental.client_state import ClientStateVar
Expand Down Expand Up @@ -107,6 +109,7 @@ def code_card(app: dict) -> rx.Component:


def gallery_app_card(app: dict[str, str]) -> rx.Component:
slug = re.sub(r"[\s_]+", "-", app["title"]).lower()
return rx.flex(
rx.box(
rx.link(
Expand All @@ -116,7 +119,7 @@ def gallery_app_card(app: dict[str, str]) -> rx.Component:
alt="Image preview for app: " + app["title"],
class_name="size-full duration-150 object-cover hover:scale-105 transition-transform ease-out",
),
href=f"/docs/getting-started/open-source-templates/{app['title'].replace(' ', '-').lower()}",
href=f"/docs/getting-started/open-source-templates/{slug}",
),
class_name="relative border-slate-5 border-b border-solid w-full overflow-hidden h-[180px]",
),
Expand Down
4 changes: 1 addition & 3 deletions pcweb/pages/gallery/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ def load_all_gallery_apps():
paths = flexdown.utils.get_flexdown_files(folder)
for path in sorted(paths, reverse=True):
document = flexdown.Document.from_file(path) # This has metadata
document.metadata["title"] = (
document.metadata.get("title", "Untitled").replace("_", " ").title()
)
document.metadata["title"] = document.metadata.get("title", "Untitled")
clean_path = str(path).replace(".md", "/")
gallery_apps[(clean_path, folder)] = document
return gallery_apps
Expand Down
Loading