Moved away from local files to complete database driven articles

This commit is contained in:
2021-12-20 23:10:04 +01:00
parent bc3ec64b3c
commit c909339a73
20 changed files with 302 additions and 299 deletions

View File

@@ -1,35 +0,0 @@
package schema
import (
"fmt"
"path/filepath"
)
type Article struct {
Name string
Title string
Summary string
Image string
Added int64
Modified int64
}
func (a Article) FilePath(articleDir string) string {
return filepath.Join(articleDir, a.Name) + ".md"
}
func (a Article) ToArticleSummary() ArticleSummary {
return ArticleSummary{
Title: a.Title,
Summary: a.Summary,
Image: a.Image,
Link: fmt.Sprintf("/article/%s", a.Name),
}
}
type ArticleSummary struct {
Title string `json:"title"`
Summary string `json:"summary"`
Image string `json:"image"`
Link string `json:"link"`
}