{{$title := .Site.Title}}{{$description := .Site.Description}}{{$keywords := .Site.Keywords}}{{$canonical := ""}}{{$isGuide := false}} {{if eq .Type "search"}}{{$title = printf "搜索:%s · 有礼之间" (index .Request.Query "key")}}{{else if .Content}}{{$title = printf "%s · 有礼之间" .Content.Title}}{{$description = .Content.Description}}{{with index .Content.Ext "seo_keywords"}}{{$keywords = .}}{{end}}{{with ColumnByID .Content.ColumnId}}{{$isGuide = eq .Kind 1}}{{end}}{{if .Site.URL}}{{$canonical = url .Site.URL .Content.URL}}{{end}}{{else if and .Single (eq .Type "page")}}{{$title = .Single.Title}}{{$description = .Single.Description}}{{if not $description}}{{$description = StrLimit (StripHTML .Single.Content) 150 "…"}}{{end}}{{$keywords = .Single.Keywords}}{{if .Site.URL}}{{$canonical = url .Site.URL .Single.URL}}{{end}}{{else if .CurrentColumn}}{{$title = .CurrentColumn.Title}}{{$description = .CurrentColumn.Description}}{{$keywords = .CurrentColumn.Keywords}}{{if .Pager}}{{if gt .Pager.Current 1}}{{$title = printf "%s · 第%d页" $title .Pager.Current}}{{end}}{{end}}{{if and .Site.URL .Pager}}{{if le .Pager.Current 1}}{{$canonical = url .Site.URL .CurrentColumn.URL}}{{end}}{{end}}{{else if and (eq .Type "home") .Site.URL}}{{$canonical = url .Site.URL (page_url "")}}{{end}} {{$title}}{{if $keywords}}{{end}}{{if or (eq .Type "search") (eq .Type "shop_page") (eq .Type "404")}}{{end}}{{if $canonical}}{{end}}