👷 🐛 Add index post list content.

This commit is contained in:
凡梦星尘 2022-05-31 17:10:01 +08:00
parent 2fd445d193
commit eab0ea3bb1
5 changed files with 85 additions and 22 deletions

View File

@ -8,6 +8,8 @@ baseURL: /
theme: hugo-theme-next theme: hugo-theme-next
mainSections: ["post"]
defaultContentLanguage: zh-cn defaultContentLanguage: zh-cn
languages: languages:
zh-cn: zh-cn:
@ -304,7 +306,7 @@ params:
# Read more button # Read more button
# If true, the read more button will be displayed in excerpt section. # If true, the read more button will be displayed in excerpt section.
read_more_btn: true readMoreBtn: true
# Post meta display settings # Post meta display settings
postMeta: postMeta:

View File

@ -12,46 +12,48 @@ ColoneFlag:
other: ":" other: ":"
SbPostsLable: SbPostsLable:
other: "日志" other: 日志
SbCatesTitle: SbCatesTitle:
other: "分类" other: 分类
SbTagsTitle: SbTagsTitle:
other: "标签" other: 标签
TableOfContents: TableOfContents:
other: "文章目录" other: 文章目录
SiteOverview: SiteOverview:
other: "站点概览" other: 站点概览
RSSLable: RSSLable:
other: "RSS 订阅" other: RSS 订阅
CCLinkTitle: CCLinkTitle:
other: "共享知识" other: 共享知识
BackTopLabel: BackTopLabel:
other: "返回顶部" other: 返回顶部
PostStickyTitle:
other: 置顶
PostPublishDate: PostPublishDate:
other: "发表于" other: 发表于
PostPublishTime: PostPublishTime:
other: "创建时间" other: 创建时间
PostLastModDate: PostLastModDate:
other: "更新于" other: 更新于
PostLastModTime: PostLastModTime:
other: "修改时间" other: 修改时间
PostWords: PostWords:
other: "字数" other: 字数
PostWordCount: PostWordCount:
other: "{{- .WordCount -}}" other: "{{- .WordCount -}}"
PostReading: PostReading:
other: "阅读" other: 阅读
PostReadTime: PostReadTime:
other: "{{- .ReadingTime -}}分钟" other: "{{- .ReadingTime -}}分钟"
PostVisitor: PostVisitor:
other: "浏览数" other: 浏览数
PostCatg: PostCatg:
other: "分类" other: 分类
PostTag: PostTag:
other: "标签" other: 标签
PostReadMore: PostReadMore:
other: "阅读全文" other: 阅读全文
UserVistorsLabel: UserVistorsLabel:
other: 总访客量 other: 总访客量
@ -59,4 +61,4 @@ PageViewsLabel:
other: 总访问量 other: 总访问量
FooterPowerby: FooterPowerby:
other: "由 %s 强力驱动" other: 由 %s 强力驱动

View File

@ -40,9 +40,9 @@
</header> </header>
<!-- Widgets --> <!-- Widgets -->
{{ partial "widgets" (dict "P" $P) }} {{ partial "widgets" (dict "P" $P) }}
<div class="main-inner"> <div class="main-inner index posts-expand">
<!-- Submenu,Content,Comment --> <!-- Submenu,Content,Comment -->
{{- block "main" . }}{{- end }} {{- block "main" (dict "P" $P "Page" .Page "Paginate" (.Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections)) "Scratch" .Scratch) }}{{- end }}
</div> </div>
</main> </main>
<footer class="footer"> <footer class="footer">

View File

@ -1,2 +1,61 @@
{{- define "main" }} {{- define "main" }}
{{ $P := .P }}
{{- $lang := .Scratch.Get "lang" }}
{{/* $paginator := .Paginate (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections) */}}
{{- range .Paginate.Pages }}
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="{{ $lang }}">
<link itemprop="mainEntityOfPage" href="{{ .Permalink }}">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="{{ $P.avatar.url }}">
<meta itemprop="name" content="{{ $P.author }}">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="{{ .Title }}">
<meta itemprop="description" content="{{ .Description }}">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="{{ .Title }}">
<meta itemprop="description" content="{{ .Description }}">
</span>
<header class="post-header">
<h2 class="post-title" itemprop="name headline">
{{/*- with .Sticky }}
{{- if gt . 0 }}
<span class="post-sticky-flag" title="{{ T "PostStickyTitle" }}">
<i class="fa fa-thumbtack"></i>
</span>
{{- end }}
{{- end */}}
{{/*- if not (eq .Link "") }}
<a href="{{ .Link }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-title-link post-title-link-external">{{ .Title }}</a>
{{- else */}}
<a href="{{ .Permalink }}" itemprop="url" class="post-title-link">{{ .Title }}</a>
{{/*- end */}}
</h2>
<div class="post-meta-container">
{{/* partial "post/meta" . */}}
</div>
</header>
<!-- POST BODY -->
<div class="post-body" itemprop="articleBody">
{{/*- if .Expand }}
{{ .Content }}
{{ else */}}
{{ .Summary }}
{{/*- end */}}
</div>
<footer class="post-footer">
{{- if and $P.readMoreBtn }}
<div class="post-button">
<a class="btn" href="{{ .Permalink }}#more" rel="contents">
{{ T "PostReadMore" }} &raquo;
</a>
</div>
{{- end }}
<div class="post-eof"></div>
</footer>
</article>
</div>
{{- end }}
{{- end }} {{- end }}