wp-go/app/theme/twentyfifteen/posts/index.gohtml

78 lines
3.5 KiB
Plaintext
Raw Normal View History

2022-09-18 16:07:23 +00:00
{{template "layout/base" .}}
2022-09-21 13:49:14 +00:00
2022-09-18 16:07:23 +00:00
{{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">
2023-02-09 12:57:09 +00:00
{{.header |unescaped}}
2022-09-18 16:07:23 +00:00
</h1>
</header>
{{end}}
{{ range $k,$v:=.posts}}
2023-04-15 16:57:50 +00:00
<article class="{{ $v|postsFn $.calPostClass}}">
{{if $v.Thumbnail.Path}}
<a class="post-thumbnail" href="/p/{{$v.Id}}" aria-hidden="true">
2023-01-19 14:52:24 +00:00
<img width="{{$v.Thumbnail.Width}}" height="{{$v.Thumbnail.Height}}" src="{{$v.Thumbnail.Path}}" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="{{$v.PostTitle}}" decoding="async">
</a>
{{end}}
2022-09-18 16:07:23 +00:00
<header class="entry-header">
<h2 class="entry-title">
<a href="/p/{{$v.Id}}" rel="bookmark">{{$v.PostTitle}}</a>
</h2>
</header>
<!-- .entry-header -->
2022-09-18 16:07:23 +00:00
<div class="entry-content">
{{$v.PostContent|unescaped}}
</div><!-- .entry-content -->
<footer class="entry-footer">
2023-03-29 13:58:39 +00:00
{{if $v.IsSticky}}
<span class="sticky-post">特色</span>
{{end}}
<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>
2022-09-18 16:07:23 +00:00
{{if $v.CategoriesHtml}}
<span class="cat-links">
2023-03-29 13:58:39 +00:00
<span class="screen-reader-text">分类 </span>
{{$v.CategoriesHtml|unescaped}}
</span>
2022-09-18 16:07:23 +00:00
{{end}}
{{if $v.TagsHtml}}
<span class="tags-links">
2023-03-29 13:58:39 +00:00
<span class="screen-reader-text">标签 </span>
{{$v.TagsHtml|unescaped}}
</span>
2022-09-18 16:07:23 +00:00
{{end}}
2022-09-19 13:31:46 +00:00
{{if gt $v.CommentCount 0}}
<span class="comments-link">
2023-03-29 13:58:39 +00:00
<a href="/p/{{$v.Id}}#comments">
<span class="screen-reader-text">{{$v.PostTitle}}</span>有{{$v.CommentCount}}条评论
</a>
</span>
2022-09-19 13:31:46 +00:00
{{end}}
2022-09-18 16:07:23 +00:00
</footer><!-- .entry-footer -->
</article><!-- #post-{{$v.Id}} -->
{{end}}
{{template "layout/page" .}}
</main><!-- .site-main -->
</div>
{{else }}
{{template "layout/empty" .}}
{{end}}
{{end}}