diff --git a/post.go b/post.go index 2c5e144..2d33fcc 100644 --- a/post.go +++ b/post.go @@ -26,7 +26,7 @@ type GenericPost struct { } func (post *GenericPost) TemplateDir() string { - return "article" + return post.Meta().Type } type Post interface { diff --git a/post_types.go b/post_types.go deleted file mode 100644 index 4ca9f0d..0000000 --- a/post_types.go +++ /dev/null @@ -1,41 +0,0 @@ -package owl - -type Note struct { - GenericPost -} - -func (n *Note) TemplateDir() string { - return "note" -} - -type Article struct { - GenericPost -} - -func (a *Article) TemplateDir() string { - return "article" -} - -type Page struct { - GenericPost -} - -func (p *Page) TemplateDir() string { - return "page" -} - -type Bookmark struct { - GenericPost -} - -func (b *Bookmark) TemplateDir() string { - return "bookmark" -} - -type Reply struct { - GenericPost -} - -func (r *Reply) TemplateDir() string { - return "reply" -} diff --git a/user.go b/user.go index b196401..78b7a1d 100644 --- a/user.go +++ b/user.go @@ -285,18 +285,6 @@ func (user User) GetPost(id string) (Post, error) { } post := GenericPost{user: &user, id: id} - switch post.Meta().Type { - case "article": - return &Article{GenericPost: post}, nil - case "note": - return &Note{GenericPost: post}, nil - case "reply": - return &Reply{GenericPost: post}, nil - case "bookmark": - return &Bookmark{GenericPost: post}, nil - case "page": - return &Page{GenericPost: post}, nil - } return &post, nil }