🏗️ Finish post edit widget coding.

This commit is contained in:
凡梦星尘 2022-06-04 10:43:00 +08:00
parent fa5195c8a2
commit 6c362cf117
14 changed files with 30 additions and 21 deletions

View File

@ -94,9 +94,10 @@
margin: 0 .5em; margin: 0 .5em;
} }
/* Make post meta dislay in oneline
.post-meta-item-icon { .post-meta-item-icon {
margin-right: 3px; margin-right: 3px;
} } */
.post-meta-item-text { .post-meta-item-text {
@if not $post_meta_item_text { @if not $post_meta_item_text {

View File

@ -16,11 +16,11 @@ markup:
defaultContentLanguage: zh-cn defaultContentLanguage: zh-cn
languages: languages:
zh-cn: zh-cn:
title: NexT title: Hugo NexT
languageName: 中文 languageName: 中文
weight: 1 weight: 1
en-us: en-us:
title: NexT title: Hugo NexT
languageName: English languageName: English
weight: 2 weight: 2
params: params:
@ -178,7 +178,7 @@ params:
sidebar: sidebar:
# Sidebar Position. # Sidebar Position.
position: right position: left
#position: right #position: right
# Manual define the sidebar width. If commented, will be default for: # Manual define the sidebar width. If commented, will be default for:
@ -367,7 +367,7 @@ params:
# Post edit # Post edit
# Easily browse and edit blog source code online. # Easily browse and edit blog source code online.
postEdit: postEdit:
enable: false enable: true
url: https://github.com/user-name/repo-name/tree/branch-name/subdirectory-name/ # Link for view source url: https://github.com/user-name/repo-name/tree/branch-name/subdirectory-name/ # Link for view source
#url: https://github.com/user-name/repo-name/edit/branch-name/subdirectory-name/ # Link for fork & edit #url: https://github.com/user-name/repo-name/edit/branch-name/subdirectory-name/ # Link for fork & edit

View File

@ -19,9 +19,9 @@ url: hello-world.html
weight: 1 weight: 1
--- ---
“Hugo 是现今世界上最快的网站建设框架。” > “使用 `weight` 关键字置顶文章。”
[Hugo](https://gohugo.io/) 也是最流行的开源静态站点生成器之一。 凭借其惊人的速度和灵活性Hugo 让建设网站再次变得有趣起来。 [Hugo](https://gohugo.io/) 是现今世界上最快的网站建设框架,也是最流行的开源静态站点生成器之一。 凭借其惊人的速度和灵活性Hugo 让建设网站再次变得有趣起来。
<!--more--> <!--more-->

View File

@ -3,8 +3,8 @@ title: "Markdown 语法支持"
description: "描述下 NexT 主题所支持的各种 markdown 语法及效果展示。" description: "描述下 NexT 主题所支持的各种 markdown 语法及效果展示。"
isCJKLanguage: false isCJKLanguage: false
lastmod: 2022-06-01T11:52:18+08:00 lastmod: 2022-06-03T11:52:18+08:00
publishDate: 2022-06-01T11:52:18+08:00 publishDate: 2022-06-03T11:52:18+08:00
author: Mainroad author: Mainroad
originLink: https://mainroad-demo.netlify.app/post/basic-elements/ originLink: https://mainroad-demo.netlify.app/post/basic-elements/

View File

@ -52,6 +52,8 @@ PostTag:
other: "Tags" other: "Tags"
PostReadMore: PostReadMore:
other: "Read More" other: "Read More"
PostEditTitle:
other: Edit this post
PostCRAuthor: PostCRAuthor:
other: Post Author other: Post Author

View File

@ -54,6 +54,8 @@ PostTags:
other: 标签 other: 标签
PostReadMore: PostReadMore:
other: 阅读全文 other: 阅读全文
PostEditTitle:
other: 编辑
PostCRAuthor: PostCRAuthor:
other: 本文作者 other: 本文作者

View File

@ -21,7 +21,7 @@
{{- end }} {{- end }}
</li> </li>
<li class="post-copyright-license"> <li class="post-copyright-license">
<strong>{{ print (T "PostCRLink") (T "SymbolColon") }} </strong> <strong>{{ print (T "PostCRLicenseTitle") (T "SymbolColon") }} </strong>
{{- $ccText := .Site.Params.creativeCommons.license | upper }} {{- $ccText := .Site.Params.creativeCommons.license | upper }}
{{- $lang := .Scratch.Get "lang" }} {{- $lang := .Scratch.Get "lang" }}
{{- $ccLink := printf "<a target='_blank' href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.%s'>%s</a>" (substr $lang 0 2) $ccText }} {{- $ccLink := printf "<a target='_blank' href='https://creativecommons.org/licenses/by-nc-sa/4.0/deed.%s'>%s</a>" (substr $lang 0 2) $ccText }}

View File

@ -29,7 +29,11 @@
<a href="{{ .Permalink }}" itemprop="url" class="post-title-link">{{ .Title }}</a> <a href="{{ .Permalink }}" itemprop="url" class="post-title-link">{{ .Title }}</a>
{{- end }} {{- end }}
{{- else }} {{- else }}
{{ .Title }} {{- .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 }} {{- end }}
</h2> </h2>
<div class="post-meta-container"> <div class="post-meta-container">

View File

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

View File

@ -5,7 +5,7 @@
<span class="post-meta-item-icon"> <span class="post-meta-item-icon">
<i class="far fa-calendar"></i> <i class="far fa-calendar"></i>
</span> </span>
<span class="post-meta-item-text">{{ print (T "PostPublishDate") (T "SymbolColon") }}</span> <span class="post-meta-item-text">{{- print (T "PostPublishDate") (T "SymbolColon") -}}</span>
<time title="{{ print (T "PostPublishDate") (T "SymbolColon") }}{{ .PublishDate }}" itemprop="dateCreated datePublished" datetime="{{ .PublishDate }}"> <time title="{{ print (T "PostPublishDate") (T "SymbolColon") }}{{ .PublishDate }}" itemprop="dateCreated datePublished" datetime="{{ .PublishDate }}">
{{- .PublishDate.Format .Site.Params.dateFormat -}} {{- .PublishDate.Format .Site.Params.dateFormat -}}
</time> </time>

View File

@ -3,7 +3,7 @@
<span class="post-meta-item-icon"> <span class="post-meta-item-icon">
<i class="far fa-clock"></i> <i class="far fa-clock"></i>
</span> </span>
<span class="post-meta-item-text">{{ print (T "PostReading") (T "SymbolColon") }} &asymp;</span> <span class="post-meta-item-text">{{- print (T "PostReading") (T "SymbolColon") -}}&asymp;</span>
<span>{{- T "PostReadTime" . -}}</span> <span>{{- T "PostReadTime" . -}}</span>
</span> </span>
{{- end }} {{- end }}

View File

@ -5,8 +5,8 @@
<span class="post-meta-item-icon"> <span class="post-meta-item-icon">
<i class="far fa-calendar-check"></i> <i class="far fa-calendar-check"></i>
</span> </span>
<span class="post-meta-item-text">{{ print (T "PostLastModDate") (T "SymbolColon") }}</span> <span class="post-meta-item-text">{{- print (T "PostLastModDate") (T "SymbolColon") -}}</span>
<time title="{{ print (T "PostLastModTime") (T "SymbolColon") }}{{ $modTime }}" itemprop="dateModified" datetime="{{ $modTime }}">{{ .Lastmod.Format .Site.Params.dateFormat }}</time> <time title="{{ print (T "PostLastModTime") (T "SymbolColon") }}{{ $modTime }}" itemprop="dateModified" datetime="{{ $modTime }}">{{- .Lastmod.Format .Site.Params.dateFormat -}}</time>
</span> </span>
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@ -3,7 +3,7 @@
<span class="post-meta-item-icon"> <span class="post-meta-item-icon">
<i class="far fa-eye"></i> <i class="far fa-eye"></i>
</span> </span>
<span class="post-meta-item-text">{{ print (T "PostViews") (T "SymbolColon") }}</span> <span class="post-meta-item-text">{{- print (T "PostViews") (T "SymbolColon") -}}</span>
<span class="leancloud-visitors-count"></span> <span class="leancloud-visitors-count"></span>
</span> </span>
{{- end }} {{- end }}

View File

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