@@ -10,12 +10,16 @@ def get_module_path(p,base_dir): return f'{base_dir}.{".".join(Path(p).parts[1:]
1010
1111application_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'
1314descr = '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
1518hdrs = (
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
2024app = 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" )
146152def 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
154162serve ()
0 commit comments