index页面


一个最基本的index页面定义,在结构上我们建议如下拆分

<!doctype html>
<html>

<head>
    {{template "header.html" .}}
</head>

<body>
    {{template "nav.html" .}}
    <div class="container pd-10">       
        <div class="col-md-9">
            <div class="panel bg-white pd-5">
                <!-- Default panel contents -->
                <div class="panel-heading">最新资讯<span style="float: right;">更多</span></div>
                <!-- List group -->
                <ul class="list-group">
                    {{range ArticleNews 10}}
                    {{if ne "" .Img}}
                    <li class="list-group-item" style="overflow: hidden;">
                        
                            <img src="{{.Img}}"  title="{{.Title}}">
                        
                        <ul class="cate-right">
                            <li class="title">{{.Title}}</li>
                            <li><i
                                    class="glyphicon glyphicon-time"></i><span><time>{{.CreatedAt|Time2StrData}}</time></span>
                                <i
                                    class="glyphicon glyphicon-folder-open"></i><span>{{ArticleCateName .ArticleCateID}}</span>
                            </li>
                            <li class="hidden-xs">{{StrSub .Content 0|Str2Html}}</li>
                        </ul>
                    </li>
                    {{else}}
                    <li class="list-group-item" style="overflow: hidden;">
                        <ul class="cate-right no-right">
                            <li class="title">{{.Title}}</li>
                            <li><i
                                    class="glyphicon glyphicon-time"></i><span><time>{{.CreatedAt|Time2StrData}}</time></span>
                                <i
                                class="glyphicon glyphicon-folder-open"></i><span>{{ArticleCateName .ArticleCateID}}</span>
                            </li>
                            <li class="hidden-xs">{{StrSub .Content 0|Str2Html}}</li>
                        </ul>
                    </li>

                    {{end}}
                    
                    {{end}}
                </ul>
                <div class="panel-footer">
                    <nav aria-label="...">
                        <ul class="pager">
                            <li>更多</li>
                        </ul>
                    </nav>
                </div>
            </div>
        </div>

        <div class="col-md-3">
            {{template "sidebar" .}}
        </div>
        
    </div>




    {{template "footer.html" .}}
    {{template "js.html" .}}

</body>

</html>