@@ -245,9 +245,45 @@ func (s *WebServer) handleHome(w http.ResponseWriter, r *http.Request) {
245245 }
246246 }
247247
248+ // Fetch latest blocks from configured datasources for home page
249+ var homeBlocks []types.WebBlock
250+ if s .config .Home != nil && s .config .Home .Datasources != "" {
251+ // Parse comma-separated datasource names
252+ dsNames := strings .Split (s .config .Home .Datasources , "," )
253+ for _ , dsName := range dsNames {
254+ dsName = strings .TrimSpace (dsName )
255+ if dsName == "" {
256+ continue
257+ }
258+
259+ // Get the latest block from this datasource (empty query, limit 1)
260+ params := storage.SearchParams {
261+ Query : "" ,
262+ DatasourceFilters : []string {dsName },
263+ Page : 1 ,
264+ Limit : 1 ,
265+ }
266+
267+ results , err := s .storageManager .GetSearchService ().Search (params )
268+ if err != nil {
269+ log .Printf ("Error fetching latest block from %s: %v" , dsName , err )
270+ continue
271+ }
272+
273+ // Convert blocks to WebBlocks using the appropriate renderer
274+ if blocks , ok := results .Results [dsName ]; ok && len (blocks ) > 0 {
275+ for _ , block := range blocks {
276+ webBlock := s .convertBlockToWebBlock (block )
277+ homeBlocks = append (homeBlocks , webBlock )
278+ }
279+ }
280+ }
281+ }
282+
248283 data := types.PageData {
249284 Title : "Ergs - Data Explorer" ,
250285 Datasources : datasources ,
286+ HomeBlocks : homeBlocks ,
251287 TotalBlocks : totalBlocks ,
252288 ActiveDatasources : activeDatasources ,
253289 OldestBlock : oldestBlock ,
0 commit comments