Moved away from local files to complete database driven articles
This commit is contained in:
@@ -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"`
|
||||
}
|
||||
Reference in New Issue
Block a user