1
0

In case a category would consist of multiple words replace white space with a dot.

This commit is contained in:
Alexander Andreev 2023-05-23 00:29:16 +04:00
parent 33505a12d7
commit c7f421680e
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -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 {