In case a category would consist of multiple words replace white space with a dot.
This commit is contained in:
parent
33505a12d7
commit
c7f421680e
@ -32,7 +32,9 @@ func NewPost(category Category, title, body string) (*Post, error) {
|
||||
}
|
||||
|
||||
func (p *Post) PostID() string {
|
||||
return fmt.Sprint(strings.ToLower(p.Category.Name), "-", p.Date.Format("20060102-1504"))
|
||||
name := strings.ToLower(p.Category.Name)
|
||||
name = strings.ReplaceAll(name, " ", ".")
|
||||
return fmt.Sprint(name, "-", p.Date.Format("20060102-1504"))
|
||||
}
|
||||
|
||||
type Mindflow interface {
|
||||
|
Loading…
Reference in New Issue
Block a user