user viper
This commit is contained in:
@@ -22,19 +22,19 @@ func (tm *ThemeManager) LoadTheme(themeName string) error {
|
||||
tm.CurrentTheme = themeName
|
||||
|
||||
// Step 1: Validate the theme by reading theme.yaml
|
||||
themeConfigPath := fmt.Sprintf("h:/code/go_blog/themes/%s/theme.yaml", themeName)
|
||||
themeConfigPath := fmt.Sprintf("h:/code/go_blog/web/themes/%s/theme.yaml", themeName)
|
||||
if _, err := os.Stat(themeConfigPath); os.IsNotExist(err) {
|
||||
return fmt.Errorf("theme %s does not exist or is invalid", themeName)
|
||||
}
|
||||
|
||||
// Step 2: Precompile all HTML templates and cache them
|
||||
tm.Templates = make(map[string]*template.Template)
|
||||
templateDir := fmt.Sprintf("h:/code/go_blog/themes/%s/templates", themeName)
|
||||
templateDir := fmt.Sprintf("h:/code/go_blog/web/themes/%s/tmplates/", themeName)
|
||||
err := filepath.Walk(templateDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !info.IsDir() && strings.HasSuffix(info.Name(), ".html") {
|
||||
if !info.IsDir() && strings.HasSuffix(info.Name(), ".tmpl") {
|
||||
tmpl, err := template.ParseFiles(path)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user