Fixing way to get current page

This commit is contained in:
Andreas Mieke 2015-10-01 19:51:43 +02:00
parent 1277dbe5b1
commit f9d7fd0852
2 changed files with 11 additions and 2 deletions

View file

@ -9,7 +9,7 @@
<link rel="stylesheet" href="/assets/css/gronkh.css" /> <link rel="stylesheet" href="/assets/css/gronkh.css" />
<script src="/assets/js/vendor/modernizr.js"></script> <script src="/assets/js/vendor/modernizr.js"></script>
{{ if .data }} {{ if .data }}
{{ if .data.EP }} {{ if eq .page "ep" }}
<meta property="og:type" content="video" /> <meta property="og:type" content="video" />
<meta property="og:url" content="https://gronkh.1750studios.com/lets-play/{{ .data.LP.Slug.String }}/{{ .data.EP.Slug.String }}" /> <meta property="og:url" content="https://gronkh.1750studios.com/lets-play/{{ .data.LP.Slug.String }}/{{ .data.EP.Slug.String }}" />
<meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:card" content="summary_large_image" />
@ -19,7 +19,7 @@
<meta property="og:image" name="twitter:image" content="https://gronkh.1750studios.com{{ .data.EP.ThumbB.String }}" /> <meta property="og:image" name="twitter:image" content="https://gronkh.1750studios.com{{ .data.EP.ThumbB.String }}" />
<meta property="og:updated_time" content="{{ .data.EP.Aired }}" /> <meta property="og:updated_time" content="{{ .data.EP.Aired }}" />
{{ end }} {{ end }}
{{ if .data.LT }} {{ if eq .page "lt" }}
<meta property="og:type" content="video" /> <meta property="og:type" content="video" />
<meta property="og:url" content="https://gronkh.1750studios.com/testet/{{ .data.LT.Slug.String }}" /> <meta property="og:url" content="https://gronkh.1750studios.com/testet/{{ .data.LT.Slug.String }}" />
<meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:card" content="summary_large_image" />

View file

@ -25,6 +25,7 @@ func GetIndex(c *gin.Context) {
c.HTML(http.StatusOK, "index.html", gin.H{ c.HTML(http.StatusOK, "index.html", gin.H{
"title": "Neue Episoden", "title": "Neue Episoden",
"data": data, "data": data,
"page": "index",
}) })
} }
@ -40,6 +41,7 @@ func GetLps(c *gin.Context) {
c.HTML(http.StatusOK, "lps.html", gin.H{ c.HTML(http.StatusOK, "lps.html", gin.H{
"title": "Let's Plays", "title": "Let's Plays",
"data": data, "data": data,
"page": "lps",
}) })
} }
@ -56,6 +58,7 @@ func GetLt(c *gin.Context) {
c.HTML(http.StatusOK, "lt.html", gin.H{ c.HTML(http.StatusOK, "lt.html", gin.H{
"title": LT.Name.String, "title": LT.Name.String,
"data": gin.H{"LT": LT, "AT": AT, "DESC": template.HTML(LT.Descr.String)}, "data": gin.H{"LT": LT, "AT": AT, "DESC": template.HTML(LT.Descr.String)},
"page": "lt",
}) })
} else { } else {
//LT not found //LT not found
@ -73,6 +76,7 @@ func GetLt(c *gin.Context) {
c.HTML(http.StatusOK, "lts.html", gin.H{ c.HTML(http.StatusOK, "lts.html", gin.H{
"title": "Let's Tests", "title": "Let's Tests",
"data": data, "data": data,
"page": "lts",
}) })
} }
} }
@ -98,6 +102,7 @@ func GetAt(c *gin.Context) {
c.HTML(http.StatusOK, "at.html", gin.H{ c.HTML(http.StatusOK, "at.html", gin.H{
"title": AT.Name.String, "title": AT.Name.String,
"data": data, "data": data,
"page": "at",
}) })
} else { } else {
//LT not found //LT not found
@ -113,6 +118,7 @@ func GetAt(c *gin.Context) {
c.HTML(http.StatusOK, "ats.html", gin.H{ c.HTML(http.StatusOK, "ats.html", gin.H{
"title": "Sprecher", "title": "Sprecher",
"data": data, "data": data,
"page": "ats",
}) })
} }
@ -139,6 +145,7 @@ func GetLEpisode(c *gin.Context) {
c.HTML(http.StatusOK, "episode.html", gin.H{ c.HTML(http.StatusOK, "episode.html", gin.H{
"title": EP.Name.String + " " + LP.Name.String, "title": EP.Name.String + " " + LP.Name.String,
"data": gin.H{"EP": EP, "LP": LP, "AT": AT, "DESC": template.HTML(EP.Descr.String), "NEXT": next, "PREV": previous}, "data": gin.H{"EP": EP, "LP": LP, "AT": AT, "DESC": template.HTML(EP.Descr.String), "NEXT": next, "PREV": previous},
"page": "ep",
}) })
} else { } else {
//EP not found //EP not found
@ -159,6 +166,7 @@ func GetLEpisode(c *gin.Context) {
"title": LP.Name.String, "title": LP.Name.String,
"data": data, "data": data,
"message": Message{Type: "alert", String: "Fehler 404: Episode nicht gefunden!"}, "message": Message{Type: "alert", String: "Fehler 404: Episode nicht gefunden!"},
"page": "lp",
}) })
} }
} else { } else {
@ -179,6 +187,7 @@ func GetLEpisode(c *gin.Context) {
c.HTML(http.StatusOK, "lp.html", gin.H{ c.HTML(http.StatusOK, "lp.html", gin.H{
"title": LP.Name.String, "title": LP.Name.String,
"data": data, "data": data,
"page": "lp",
}) })
} }
} else { } else {