Added site index file and created_at

This commit is contained in:
2026-04-06 18:01:37 +02:00
parent 3f1deae70e
commit 38fcdbf391
9 changed files with 59 additions and 14 deletions
+3 -3
View File
@@ -62,7 +62,7 @@ func NewStaticHandler(storagePath string, siteRepo repository.SiteRepository) fi
}
if urlPath == "/" || urlPath == "." {
urlPath = "/index.html"
urlPath = "/" + site.IndexFile
}
basePath := filepath.Join(storagePath, site.ID)
@@ -71,7 +71,7 @@ func NewStaticHandler(storagePath string, siteRepo repository.SiteRepository) fi
info, err := os.Stat(filePath)
if err == nil {
if info.IsDir() {
indexPath := filepath.Join(filePath, "index.html")
indexPath := filepath.Join(filePath, site.IndexFile)
if _, err := os.Stat(indexPath); err == nil {
return c.SendFile(indexPath)
}
@@ -81,7 +81,7 @@ func NewStaticHandler(storagePath string, siteRepo repository.SiteRepository) fi
}
if site.Spa {
indexPath := filepath.Join(basePath, "index.html")
indexPath := filepath.Join(basePath, site.IndexFile)
if _, err := os.Stat(indexPath); err == nil {
return c.SendFile(indexPath)
}