@@ -40,7 +40,7 @@ use resource::{
4040 ListingSectionFilter , NoteSectionFilter , Page , PictureSectionFilter , PostSectionFilter ,
4141 Renderable , Resource , ResourceKind , Section ,
4242} ;
43- use site:: Site ;
43+ use site:: { HomepageFilter , Site } ;
4444use theme:: { Theme , ThemeConfig } ;
4545
4646const ALL_THEMES_URL : & str =
@@ -445,7 +445,20 @@ async fn handle_request(request: Request<State>) -> tide::Result<Response> {
445445 . get ( & format ! ( "/{}" , & slug) )
446446 . unwrap_or ( & default_index) ;
447447 if resource_path == "/" {
448- posts_section = Some ( Section :: from_resource ( r, & site) ?) ;
448+ match & site. config . homepage_filter {
449+ Some ( HomepageFilter :: Posts ) | None => {
450+ posts_section = Some ( Section :: from_resource ( r, & site) ?) ;
451+ }
452+ Some ( HomepageFilter :: Notes ) => {
453+ notes_section = Some ( Section :: from_resource ( r, & site) ?) ;
454+ }
455+ Some ( HomepageFilter :: Pictures ) => {
456+ pictures_section = Some ( Section :: from_resource ( r, & site) ?) ;
457+ }
458+ Some ( HomepageFilter :: Listings ) => {
459+ listings_section = Some ( Section :: from_resource ( r, & site) ?) ;
460+ }
461+ }
449462 }
450463 if resource_path == "/posts" {
451464 posts_section = Some ( Section :: from_resource ( r, & site) ?) ;
@@ -1280,10 +1293,12 @@ fn load_or_create_sites(
12801293
12811294 if try_import_ig ( root_path, & site, & secret_key) ? {
12821295 site. config . theme = site:: DEFAULT_THEME_PHOTOBLOG . to_string ( ) ;
1296+ site. config . homepage_filter = Some ( HomepageFilter :: Pictures ) ;
12831297 site:: save_config ( & config_path, & site. config ) ?;
12841298 site = site:: load_site ( root_path, & domain, themes, & None ) ?;
12851299 } else if try_import_twitter ( root_path, & site, & secret_key) ? {
12861300 site. config . theme = site:: DEFAULT_THEME_MICROBLOG . to_string ( ) ;
1301+ site. config . homepage_filter = Some ( HomepageFilter :: Notes ) ;
12871302 site:: save_config ( & config_path, & site. config ) ?;
12881303 site = site:: load_site ( root_path, & domain, themes, & None ) ?;
12891304 }
0 commit comments