package model import ( "strings" ) // PageCategory represents a page category type PageCategory struct { Key string Plural string Icon string } // URLRoot is the "folder" used for searching within the category func (category *PageCategory) URLRoot() string { return strings.ToLower(category.Plural) } // PageCategories are used by the view model and page to enforce // a limited selection of categories. I may move it to a configuration // or the database, but for now I think this list is pretty fixed var PageCategories = []PageCategory{ {"OoC", "OoC", "ooc"}, {"Info", "Info", "info"}, {"News", "News", "news"}, {"Item", "Items", "item"}, {"Document", "Documents", "document"}, {"Background", "Background", "background"}, {"Story", "Stories", "story"}, } var pageCategories []string // init setups pageCategories func init() { pageCategories = make([]string, len(PageCategories)) for i, category := range PageCategories { pageCategories[i] = category.Key } }