Skip to content

Commit bc18107

Browse files
authored
Merge pull request #73 from axelknock/main
add page title (FastHTML gallery) and favicon
2 parents 3c0184b + 923be3c commit bc18107

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

gallery.ico

9.44 KB
Binary file not shown.

main.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ def get_module_path(p,base_dir): return f'{base_dir}.{".".join(Path(p).parts[1:]
1010

1111
application_routes = [Mount(f"/app/{get_route(root)}", import_module(get_module_path(root,'examples')).app) for root, dirs, files in os.walk('examples') if 'app.py' in files]
1212

13+
site_title = 'FastHTML Gallery'
1314
descr = 'A gallery of FastHTML components showing common patterns in FastHTML apps, including chat bubbles, cascading dropdowns, interactive charts, etc.'
15+
ghub_link = A(UkIcon("github"), title="FastHTML Gallery on Github",
16+
href="https://github.com/AnswerDotAI/FastHTML-Gallery"),
1417

1518
hdrs = (
16-
*Socials(title='FastHTML Gallery', description=descr, site_name='gallery.fastht.ml', twitter_site='@isaac_flath', image=f'/social.png', url=''),
19+
*Socials(title=site_title, description=descr, site_name='gallery.fastht.ml', twitter_site='@isaac_flath', image=f'/social.png', url=''),
1720
toggle_script,
18-
*Theme.blue.headers(highlightjs=True),)
21+
*Theme.blue.headers(highlightjs=True),
22+
Link(rel='icon', type='image/x-ico', href="/files/gallery.ico"))
1923

2024
app = FastHTML(routes=application_routes+ [Mount('/files', StaticFiles(directory='.')),], hdrs=hdrs, pico=False)
2125

@@ -103,11 +107,13 @@ def homepage():
103107
cols_min=1, cols_sm=1, cols_md=2, cols_lg=3, cols_xl=3),
104108
cls='pt-6', open=True)))
105109

106-
return (NavBarContainer(
107-
NavBarLSide(H1("FastHTML Gallery" )),
110+
return (Title(site_title),
111+
NavBarContainer(
112+
NavBarLSide(H1(site_title)),
108113
NavBarRSide(
109114
Button(submit=False)("Toggle Animations", onclick="toggleAnimations()"),
110-
A(Button("Table View"), href="/table"))),
115+
A(Button("Table View"), href="/table"),
116+
ghub_link)),
111117
Container(*all_cards))
112118

113119

@@ -144,11 +150,13 @@ def SectionTable(section):
144150

145151
@app.get("/table")
146152
def table_view():
147-
return (NavBarContainer(
153+
return (Title(site_title),
154+
NavBarContainer(
148155
NavBarLSide(H1("FastHTML Gallery Table View")),
149156
NavBarRSide(
150157
Button(submit=False)("Toggle Animations", onclick="toggleAnimations()"),
151-
A(Button("Card View"), href="/"))),
158+
A(Button("Card View"), href="/"),
159+
ghub_link)),
152160
Container(*[SectionTable(section) for section in directories]))
153161

154162
serve()

0 commit comments

Comments
 (0)