Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7aecd6b

Browse files
committed
准备所有页面改版为新样式
1 parent 21a9692 commit 7aecd6b

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

websites/code/studygolang/src/filter/view.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,14 @@ func (this *ViewFilter) PostFilter(rw http.ResponseWriter, req *http.Request) bo
164164
}
165165

166166
// TODO: 新模版过度
167-
if strings.Contains(req.RequestURI, "articles") ||
168-
req.RequestURI == "/" ||
169-
strings.Contains(req.RequestURI, "search") {
167+
/*
168+
if strings.Contains(req.RequestURI, "articles") ||
169+
req.RequestURI == "/" ||
170+
strings.Contains(req.RequestURI, "search") {
171+
this.commonHtmlFiles = []string{config.ROOT + "/template/common/layout.html"}
172+
this.baseTplName = "layout.html"
173+
*/
174+
if true {
170175
this.commonHtmlFiles = []string{config.ROOT + "/template/common/layout.html"}
171176
this.baseTplName = "layout.html"
172177
} else if !this.isBackView {
@@ -185,10 +190,15 @@ func (this *ViewFilter) PostFilter(rw http.ResponseWriter, req *http.Request) bo
185190
if jsTpl := tpl.Lookup("js"); jsTpl == nil {
186191
tpl.Parse(`{{define "js"}}{{end}}`)
187192
}
188-
if jsTpl := tpl.Lookup("css"); jsTpl == nil {
193+
if cssTpl := tpl.Lookup("css"); cssTpl == nil {
189194
tpl.Parse(`{{define "css"}}{{end}}`)
190195
}
191196

197+
// 如果没有定义topnav模板,则定义之
198+
if topnavTpl := tpl.Lookup("topnav"); topnavTpl == nil {
199+
tpl.Parse(`{{define "topnav"}}{{end}}`)
200+
}
201+
192202
// 当前用户信息
193203
me, _ := CurrentUser(req)
194204
data["me"] = me

websites/code/studygolang/template/common/base.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,7 @@ <h3>
8989
<p class="copyright">&copy;2013 studygolang.com 采用 <a href="http://golang.org" target="_blank">Go语言</a> + <a href="http://www.mysql.com/" target="_blank">MYSQL 构建</a>
9090
&nbsp;&nbsp;当前在线:<span id="onlineusers"></span>人&nbsp;&nbsp;历史最高:<span id="maxonline"></span>
9191
<br/>中国 Golang 社区,Go语言学习园地,致力于构建完善的 Golang 中文社区,Go语言爱好者的学习家园。
92-
<script type="text/javascript">
93-
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
94-
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F224c227cd9239761ec770bc8c1fb134c' type='text/javascript'%3E%3C/script%3E"));
95-
</script>
96-
京ICP备14030343号-1
92+
京ICP备14030343号-1
9793
</p>
9894
</div>
9995
</div>

websites/code/studygolang/template/common/layout.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
</div>
8585
</header>
8686
<div class="wrapper">
87+
<div class="hidden-phone">
88+
<ul class="breadcrumb menu clearfix">
89+
{{template "topnav" .}}
90+
</ul>
91+
</div>
8792
<div class="container" role="main">
8893
{{template "content" .}}
8994
</div>

websites/code/studygolang/template/topics/list.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
{{define "title"}}社区 {{end}}
2+
{{define "seo"}}<meta name="keywords" content="Go语言博客文章, Go语言博文, Go语言, Golang, Go中文社区,Golang中文社区, Go语言社区, Go语言学习园地">
3+
<meta name="description" content="文章来自国内知名网站知名,Go爱好者学习笔记,经验分享;也有爱好者自己的博客文章,已经一些国外精彩文章。">{{end}}
14
{{define "topnav"}}
25
<li class="first"><a href="/">首页</a><span class="divider">/</span></li>
36
<li class=""><a href="/topics" itemprop="url"><span itemprop="title">社区</span></a><span class="divider">/</span></li>
@@ -122,7 +125,6 @@ <h2>统计信息</h2>
122125
</div>
123126
</div>
124127
{{end}}
125-
{{define "title"}}社区 {{end}}
126128
{{define "css"}}
127129
<link href="/static/css/topics.css" media="screen" rel="stylesheet" type="text/css">
128130
{{end}}

0 commit comments

Comments
 (0)