🎨 Finish all baseof display coding.

This commit is contained in:
凡梦星尘
2022-06-09 09:12:22 +08:00
parent 2973eaf85d
commit 3bc7506f36
20 changed files with 262 additions and 94 deletions

View File

@@ -1,5 +1,3 @@
{{ $posts := len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
{{- .Scratch.Set "posts" $posts -}}
{{- $ms := .Site.Params.menuSets }}
{{- $curP := .Page }}
<nav class="site-nav">
@@ -11,7 +9,7 @@
<a href="{{ .URL }}" class="hvr-icon-pulse {{if $active }} menu-item-active{{ end }}" rel="section">
{{- if $ms.icons }}<i class="fa fa-{{ .Pre }} hvr-icon"></i>{{ end }}{{- .Name }}
{{- if and $ms.badges (eq .Identifier "archives" ) }}
<span class="badge">{{ $posts }}</span>
<span class="badge">{{ $.Scratch.Get "postsCount" }}</span>
{{- end }}
</a>
</li>

View File

@@ -1,10 +1,28 @@
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="{{ .Site.LauageCode }}">
{{ partial "post/header.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
{{ partial "post/body.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
{{- with .ctx }}
<link itemprop="mainEntityOfPage" href="{{ .Permalink }}">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="{{ .Site.Params.avatar.url }}">
<meta itemprop="name" content="{{ .Params.author | default .Site.Params.author }}">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="{{ .Site.Params.author }}">
<meta itemprop="description" content="{{ .Site.Params.description }}">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="{{ .Title }}">
<meta itemprop="description" content="{{ .Description | default .Summary }}">
</span>
{{- end }}
<header class="post-header">
{{ partial "post/header.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
</header>
<div class="post-body" itemprop="articleBody">
{{ partial "post/body.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
</div>
<footer class="post-footer">
{{ partial "post/footer.html" (dict "ctx" .ctx "IsHome" .IsHome) }}
</footer>
</article>
</div>
</div>

View File

@@ -1,13 +1,11 @@
{{ with .ctx }}
<div class="post-body" itemprop="articleBody">
{{- if $.IsHome }}
{{- if .Params.Expand }}
{{ .Content }}
{{- else }}
{{ .Summary }}
{{- end }}
{{- else }}
{{ .Content }}
{{- end }}
</div>
{{- if $.IsHome }}
{{- if .Params.Expand }}
{{ .Content }}
{{- else }}
{{ .Summary }}
{{- end }}
{{- else }}
{{ .Content }}
{{- end }}
{{ end }}

View File

@@ -1,54 +1,39 @@
{{ with .ctx }}
<link itemprop="mainEntityOfPage" href="{{ .Permalink }}">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="{{ .Site.Params.avatar.url }}">
<meta itemprop="name" content="{{ .Params.author | default .Site.Params.author }}">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="{{ .Site.Params.author }}">
<meta itemprop="description" content="{{ .Site.Params.description }}">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="{{ .Title }}">
<meta itemprop="description" content="{{ .Description | default .Summary }}">
</span>
<header class="post-header">
{{- if $.IsHome }} <h2 {{ else }} <h1 {{ end -}} class="post-title" itemprop="name headline">
{{- if and .Weight (gt .Weight 0) }}
<span class="post-sticky-flag" title="{{ T "PostStickyTitle" }}">
<i class="fa fa-thumbtack"></i>
</span>
{{- end }}
{{- if $.IsHome }}
{{- if and (isset .Params "extlink") (ne .Params.Extlink "") }}
<a href="{{ .Params.Extlink }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-title-link post-title-link-external">
{{ .Title }}
<i class="fa fa-external-link-alt"></i>
</a>
{{- else }}
<a href="{{ .Permalink }}" itemprop="url" class="post-title-link">{{ .Title }}</a>
{{- end }}
{{- else }}
{{- .Title }}
{{- if .Site.Params.postEdit.enable }}
{{- $editURL := printf "%s%s" .Site.Params.postEdit.url (path.Clean .File.Path) }}
<a href="{{ $editURL }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-edit-link" title="{{ T "PostEditTitle" }}"><i class="fa fa-pen-nib"></i></a>
{{- end }}
{{- end }}
{{- if $.IsHome }} <h2 {{ else }} <h1 {{ end -}} class="post-title" itemprop="name headline">
{{- if and .Weight (gt .Weight 0) }}
<span class="post-sticky-flag" title="{{ T "PostStickyTitle" }}">
<i class="fa fa-thumbtack"></i>
</span>
{{- end }}
{{- if $.IsHome }}
{{- if and (isset .Params "extlink") (ne .Params.Extlink "") }}
<a href="{{ .Params.Extlink }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-title-link post-title-link-external">
{{ .Title }}
<i class="fa fa-external-link-alt"></i>
</a>
{{- else }}
<a href="{{ .Permalink }}" itemprop="url" class="post-title-link">{{ .Title }}</a>
{{- end }}
{{- else }}
{{- .Title }}
{{- if .Site.Params.postEdit.enable }}
{{- $editURL := printf "%s%s" .Site.Params.postEdit.url (path.Clean .File.Path) }}
<a href="{{ $editURL }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-edit-link" title="{{ T "PostEditTitle" }}"><i class="fa fa-pen-nib"></i></a>
{{- end }}
{{- end }}
{{- if $.IsHome }} </h2> {{ else }} </h1> {{ end -}}
<div class="post-meta-container">
<div class="post-meta-items">
{{ partial "post/header_meta/created_date.html" . }}
{{ partial "post/header_meta/update_date.html" . }}
{{ partial "post/header_meta/categories.html" . }}
</div>
{{- if not $.IsHome }}
<div class="post-meta-items">
{{ partial "post/header_meta/words.html" . }}
{{ partial "post/header_meta/readtime.html" . }}
{{ partial "post/header_meta/views.html" . }}
</div>
{{ end }}
<div class="post-meta-container">
<div class="post-meta-items">
{{ partial "post/header_meta/created_date.html" . }}
{{ partial "post/header_meta/update_date.html" . }}
{{ partial "post/header_meta/categories.html" . }}
</div>
</header>
{{- if not $.IsHome }}
<div class="post-meta-items">
{{ partial "post/header_meta/words.html" . }}
{{ partial "post/header_meta/readtime.html" . }}
{{ partial "post/header_meta/views.html" . }}
</div>
{{ end }}
</div>
{{ end }}

View File

@@ -7,7 +7,7 @@
<span class="post-meta-item-text">{{- print (T "PostCatgs") (T "SymbolColon") -}}</span>
{{- range (first 1 .Params.categories) }}
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="{{ . | urlize }}" itemprop="url" rel="index">
<a href="/categories/{{ . | urlize }}" itemprop="url" rel="index">
<span itemprop="name">{{- . -}}</span>
</a>
</span>

View File

@@ -22,6 +22,6 @@
<i class="{{ .Site.Params.busuanzi.postViewsIcon }}"></i>
</span>
<span class="post-meta-item-text">{{ print (T "PostViews") (T "SymbolColon") }}</span>
<span id="busuanzi_value_page_pv"></span>
<span id="busuanzi_value_page_pv"><i class="fa fa-sync fa-spin"></i></span>
</span>
{{- end }}

View File

@@ -3,7 +3,6 @@
<span class="post-meta-item-icon">
<i class="far fa-file-word"></i>
</span>
<span class="post-meta-item-text">{{- print (T "PostWords") (T "SymbolColon") -}}</span>
<span>{{- T "PostWordCount" . -}}</span>
<span class="post-meta-item-text">{{- print (T "PostWords") (T "SymbolColon") -}}</span><span>{{- T "PostWordCount" . -}}</span>
</span>
{{- end }}

View File

@@ -13,19 +13,19 @@
<nav class="site-state">
<div class="site-state-item site-state-posts">
<a href="{{ "/posts/" | relLangURL }}">
<span class="site-state-item-count">{{ .Scratch.Get "posts" }}</span>
<span class="site-state-item-count">{{ .Scratch.Get "postsCount" }}</span>
<span class="site-state-item-name">{{ T "SbPostsLable" }}</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="{{ "/categories/" | relLangURL }}">
<span class="site-state-item-count">{{ len .Site.Taxonomies.categories }}</span>
<span class="site-state-item-count">{{ .Scratch.Get "catsCount" }}</span>
<span class="site-state-item-name">{{ T "SbCatesTitle" }}</span>
</a>
</div>
<div class="site-state-item site-state-tags">
<a href="{{ "/tags/" | relLangURL }}">
<span class="site-state-item-count">{{ len .Site.Taxonomies.tags }}</span>
<span class="site-state-item-count">{{ .Scratch.Get "tagsCount" }}</span>
<span class="site-state-item-name">{{ T "SbTagsTitle" }}</span>
</a>
</div>