generated from bmf-san/gobel-client-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.go
41 lines (36 loc) · 1.14 KB
/
profile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package presenter
import (
"bytes"
"html/template"
"net/http"
"os"
"github.com/bmf-san/bmf-tech-client/app/model"
)
// ExecuteProfileIndex responses a index template.
func (pt *Presenter) ExecuteProfileIndex(buf *bytes.Buffer, r *http.Request) (*bytes.Buffer, error) {
fm := template.FuncMap{
"year": pt.year,
"isAd": pt.IsAd,
}
u := os.Getenv("BASE_URL")
m := &model.Meta{
Title: "bmf-tech.com - プロフィール",
Canonical: u,
Description: "bmf-tech.comのプロフィールページです。",
OGTitle: "bmf-tech.com - プロフィール",
OGDescription: "bmf-tech.comのプロフィールページです。",
OGURL: u,
OGType: "website",
OGImage: "",
OGSiteName: "bmf-tech",
OGLocale: "ja_JP",
TwitterCard: "summary",
TwitterSite: "@bmf_san",
NoIndex: false,
}
tpl := template.Must(template.New("base").Funcs(fm).ParseFS(pt.templates, "templates/layout/base.tpl", "templates/partial/meta.tpl", "templates/profile/index.tpl"))
if err := tpl.ExecuteTemplate(buf, "base", map[string]interface{}{"Meta": m}); err != nil {
return nil, err
}
return buf, nil
}