Archived
1
0

more sfw fixes

This commit is contained in:
Jeff 2018-08-05 10:02:30 +10:00
parent c34bed4d85
commit eeac199b1e
2 changed files with 15 additions and 2 deletions

View File

@ -639,7 +639,7 @@ type thread struct {
_i18n *I18N _i18n *I18N
allowFiles bool allowFiles bool
prefix string prefix string
links []LinkModel links []linkModel
Posts []PostModel Posts []PostModel
SFW bool SFW bool
dirty bool dirty bool
@ -685,6 +685,11 @@ func (self *thread) Navbar() string {
param := make(map[string]interface{}) param := make(map[string]interface{})
param["name"] = fmt.Sprintf("Thread %s", self.Posts[0].ShortHash()) param["name"] = fmt.Sprintf("Thread %s", self.Posts[0].ShortHash())
param["frontend"] = self.Board() param["frontend"] = self.Board()
for idx := range self.links {
self.links[idx].link += "?sfw=1"
}
param["links"] = self.links param["links"] = self.links
param["prefix"] = self.prefix param["prefix"] = self.prefix
return template.renderTemplate("navbar", param, self._i18n) return template.renderTemplate("navbar", param, self._i18n)
@ -725,7 +730,7 @@ func createThreadModel(posts ...PostModel) ThreadModel {
dirty: true, dirty: true,
prefix: prefix, prefix: prefix,
Posts: posts, Posts: posts,
links: []LinkModel{ links: []linkModel{
linkModel{ linkModel{
text: group, text: group,
link: fmt.Sprintf("%sb/%s/", prefix, group), link: fmt.Sprintf("%sb/%s/", prefix, group),

View File

@ -25,7 +25,11 @@
<meta property="og:type" content="website"/> <meta property="og:type" content="website"/>
<meta property="og:title" content="{{board.Board}}"/> <meta property="og:title" content="{{board.Board}}"/>
<meta property="og:description" content="thread no. {{thread.OP.PostHash}} on changolia"/> <meta property="og:description" content="thread no. {{thread.OP.PostHash}} on changolia"/>
{{sfw}}
<meta property="og:url" content="{{prefix}}t/{{thread.OP.PostHash}}/?lang={{i18n.Name}}&sfw=1"/>
{{#sfw}}
<meta property="og:url" content="{{prefix}}t/{{thread.OP.PostHash}}/?lang={{i18n.Name}}"/> <meta property="og:url" content="{{prefix}}t/{{thread.OP.PostHash}}/?lang={{i18n.Name}}"/>
{{/sfw}}
<meta property="og:image" <meta property="og:image"
content="{{prefix}}static/changolia-logo.png"/> content="{{prefix}}static/changolia-logo.png"/>
</head> </head>
@ -33,7 +37,11 @@
{{{thread.Navbar}}} {{{thread.Navbar}}}
<hr /> <hr />
<div class="sitetitle"> <div class="sitetitle">
{{sfw}}
<h2><a href="{{thread.Prefix}}?lang={{i18n.Name}}&sfw=1">CHANGOLIA</a></h2>
{{#sfw}}
<h2><a href="{{thread.Prefix}}?lang={{i18n.Name}}">CHANGOLIA</a></h2> <h2><a href="{{thread.Prefix}}?lang={{i18n.Name}}">CHANGOLIA</a></h2>
{{/sfw}}
<b>Most of the rest of the wild west.</b> <b>Most of the rest of the wild west.</b>
</div> </div>
<center><b><a href="{{thread.BoardURL}}">{{thread.Board}}</a></b></center> <center><b><a href="{{thread.BoardURL}}">{{thread.Board}}</a></b></center>