wp-go/templates/posts/index.gohtml
2022-09-21 21:49:14 +08:00

89 lines
4.6 KiB
Plaintext

{{template "layout/base" .}}
{{define "head"}}
{{end}}
{{define "content" }}
{{if .posts}}
<div id="primary" class="content-area">
<main id="main" class="site-main">
{{if .header}}
<header class="page-header">
<h1 class="page-title">
{{if .search}}
{{.header}}
{{else}}
{{.header |unescaped}}
{{end}}
</h1>
</header>
{{end}}
{{ range $k,$v:=.posts}}
<article id="post-{{$v.Id}}"
class="post-{{$v.Id}} post type-post status-publish format-standard hentry category">
<header class="entry-header">
<h2 class="entry-title">
<a href="/p/{{$v.Id}}" rel="bookmark">{{$v.PostTitle}}</a>
</h2>
</header><!-- .entry-header -->
<div class="entry-content">
{{$v.PostContent|unescaped}}
</div><!-- .entry-content -->
<footer class="entry-footer">
<span class="posted-on">
<span class="screen-reader-text">发布于 </span>
<a href="/p/{{$v.Id}}" rel="bookmark">
<time class="entry-date published updated" datetime="{{$v.PostDateGmt}}">{{$v.PostDate|dateCh}}
</time>
</a>
</span>
{{if $v.CategoriesHtml}}
<span class="cat-links">
<span class="screen-reader-text">分类 </span>
{{$v.CategoriesHtml|unescaped}}
</span>
{{end}}
{{if $v.TagsHtml}}
<span class="tags-links">
<span class="screen-reader-text">标签 </span>
{{$v.TagsHtml|unescaped}}
</span>
{{end}}
{{if gt $v.CommentCount 0}}
<span class="comments-link">
<a href="/p/{{$v.Id}}#comments">
<span class="screen-reader-text">{{$v.PostTitle}}</span>有{{$v.CommentCount}}条评论
</a>
</span>
{{end}}
</footer><!-- .entry-footer -->
</article><!-- #post-{{$v.Id}} -->
{{end}}
{{template "layout/page" .}}
</main><!-- .site-main -->
</div>
{{else }}
{{template "layout/empty" .}}
{{end}}
{{end}}
{{define "footer"}}
<style>.wp-container-1 > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.wp-container-1 > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.wp-container-1 > .aligncenter { margin-left: auto !important; margin-right: auto !important; }</style>
<style>.wp-container-2 > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.wp-container-2 > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.wp-container-2 > .aligncenter { margin-left: auto !important; margin-right: auto !important; }</style>
<style>.wp-container-3 > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.wp-container-3 > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.wp-container-3 > .aligncenter { margin-left: auto !important; margin-right: auto !important; }</style>
<style>.wp-container-4 > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }.wp-container-4 > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }.wp-container-4 > .aligncenter { margin-left: auto !important; margin-right: auto !important; }</style>
<script src='/wp-content/themes/twentyfifteen/js/skip-link-focus-fix.js?ver=20141028' id='twentyfifteen-skip-link-focus-fix-js'></script>
<script id='twentyfifteen-script-js-extra'>
var screenReaderText = {"expand":"<span class=\"screen-reader-text\">\u5c55\u5f00\u5b50\u83dc\u5355<\/span>","collapse":"<span class=\"screen-reader-text\">\u6298\u53e0\u5b50\u83dc\u5355<\/span>"};
</script>
<script src='/wp-content/themes/twentyfifteen/js/functions.js?ver=20220524' id='twentyfifteen-script-js'></script>
{{end}}