Example #1
0
//内容URL
func (m *Post) Link() string {
	if m.UrlName != "" {
		if m.UrlType == 1 {
			return fmt.Sprintf("/%s", util.Rawurlencode(m.UrlName))
		}
		return fmt.Sprintf("/article/%s", util.Rawurlencode(m.UrlName))
	}
	return fmt.Sprintf("/article/%d", m.Id)
}
Example #2
0
//标签连接
func (m *Tag) Link() string {
	return fmt.Sprintf("<a class=\"category\" href=\"/category/%s\">%s</a>", util.Rawurlencode(m.Name), m.Name)
}