示例#1
0
func setStoriesMetadata(view *view.Renderer, request *http.Request) {
	view.AddKey("pubdate", time.Now()) // could use latest story date instead?
	view.AddKey("meta_title", "London TechCity News")
	view.AddKey("meta_desc", "News for the London Tech Scene, in the style of Hacker News. A curated selection of the latest links about the London TechCity")
	view.AddKey("meta_keywords", "london news, blog, links, developers, apps, web applications, techcity, londonm, silicon roundabout")

	p := strings.Replace(request.URL.Path, ".xml", "", 1)
	if p == "/" {
		p = "/index"
	}

	q := request.URL.RawQuery
	if len(q) > 0 {
		q = "?" + q
	}

	url := fmt.Sprintf("%s.xml%s", p, q)
	view.AddKey("meta_rss", url)

}
示例#2
0
func setStoriesMetadata(view *view.Renderer, request *http.Request) {
	view.AddKey("pubdate", time.Now()) // could use latest story date instead?
	view.AddKey("meta_title", "Golang News")
	view.AddKey("meta_desc", "News for Go Hackers, in the style of Hacker News. A curated selection of the latest links about the Go programming language.")
	view.AddKey("meta_keywords", "golang news, blog, links, go developers, go web apps, web applications, fragmenta")

	p := strings.Replace(request.URL.Path, ".xml", "", 1)
	if p == "/" {
		p = "/index"
	}

	q := request.URL.RawQuery
	if len(q) > 0 {
		q = "?" + q
	}

	url := fmt.Sprintf("http://%s%s.xml%s", request.Host, p, q)
	view.AddKey("meta_rss", url)

}