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

80 lines
3.4 KiB
Plaintext
Raw Permalink 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">
{{if .search}}
{{.header}}
{{else}}
{{.header |unescaped}}
{{end}}
</h1>
</header>
{{end}}
{{ range $k,$v:=.posts}}
<article id="post-{{$v.Id}}"
class="post-{{$v.Id}} post {{if $v.Thumbnail.Path}}has-post-thumbnail{{end}} type-post status-publish format-standard hentry category">
{{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">
<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}}
2022-09-19 13:31:46 +00:00
{{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}}
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}}