Feat: add repost feature (#156)

This commit is contained in:
Cell
2022-07-10 18:21:35 +08:00
parent 38314a5d0f
commit 35d54b22cb
29 changed files with 102 additions and 12 deletions
+1
View File
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
- :sparkles: Feat: add total word count feature in section and remove from footer ([#124](https://github.com/Lruihao/FixIt/issues/124))
- :sparkles: Feat: enhance auto toc feature ([#104](https://github.com/Lruihao/FixIt/issues/104) [#136](https://github.com/Lruihao/FixIt/issues/136))
- :sparkles: Feat(SEO): add options to make output baidu_urls.txt file ([#138](https://github.com/Lruihao/FixIt/issues/138))
- :sparkles: Feat: add repost feature ([#156](https://github.com/Lruihao/FixIt/issues/156))
- :bug: Fix: unable to show search bar of header at mobile mode ([#143](https://github.com/Lruihao/FixIt/issues/143))
- :bug: Fix: Giscus comments invalid config `inputPosition`
- :bug: Fix: busuanzi logic error
+4
View File
@@ -35,6 +35,10 @@ lightgallery: false
seo:
images: []
repost:
enable: true
url: ""
# See details front matter: /theme-documentation-content/#front-matter
---
+4
View File
@@ -35,6 +35,10 @@ lightgallery: false
seo:
images: []
repost:
enable: true
url: ""
# See details front matter: /theme-documentation-content/#front-matter
---
+7
View File
@@ -8,6 +8,13 @@
font-size: 1.6rem;
font-weight: bold;
line-height: 140%;
.icon-repost {
color: var(--#{$prefix}success);
display: inline-block;
width: max-content;
margin-right: 0.25rem;
}
}
.single-subtitle {
+5
View File
@@ -700,6 +700,11 @@ enableEmoji = true
# Gravatar is force-used as the author's avatar since v0.2.14
# 强制使用 Gravatar 作为作者头像 since v0.2.14
gravatarForce = true
# Repost config since v0.2.15
# 转载配置 since v0.2.15
[params.page.repost]
enable = false
url = ""
# Table of the contents config
# 目录配置
[params.page.toc]
@@ -3,8 +3,6 @@ title: "Basic Markdown Syntax"
date: 2019-12-01T21:57:40+08:00
lastmod: 2022-03-01T22:30:40+08:00
draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "This article shows the basic Markdown syntax and format."
resources:
- name: "featured-image"
@@ -14,6 +12,10 @@ tags: ["Markdown", "HTML"]
categories: ["Markdown"]
lightgallery: true
repost:
enable: true
url: "https://hugoloveit.com/basic-markdown-syntax/"
---
This article offers a sample of basic Markdown syntax that can be used in Hugo content files.
@@ -3,8 +3,6 @@ title: "Markdown 基本语法"
date: 2019-12-01T21:57:40+08:00
lastmod: 2022-01-20T17:44:40+08:00
draft: false
author: "Dillon"
authorLink: "https://dillonzq.com"
description: "这篇文章展示了基本的 Markdown 语法和格式。"
resources:
- name: "featured-image"
@@ -14,6 +12,10 @@ tags: ["Markdown", "HTML"]
categories: ["Markdown"]
lightgallery: true
repost:
enable: true
url: "https://hugoloveit.com/zh-cn/basic-markdown-syntax/"
---
这篇文章提供了可以在 Hugo 的文章中使用的基本 Markdown 语法示例。
@@ -3,8 +3,6 @@ weight: 5
title: "Theme Documentation - PWA Support"
date: 2022-01-26T09:32:56+08:00
draft: false
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "Guide to setup PWA in FixIt."
tags: ["PWA"]
@@ -23,6 +21,10 @@ menu:
title: "Guide to setup PWA in FixIt."
parent: "documentation"
pre: "<i class='fa-brands fa-readme fa-fw fa-sm'></i>"
repost:
enable: true
url: "https://hugodoit.com/pwa-support/"
---
Find out how to turn your FixIt site into a Progressive Web App.
@@ -3,8 +3,6 @@ weight: 5
title: "主题文档 - PWA 支持"
date: 2022-01-26T11:10:56+08:00
draft: false
author: "Lruihao"
authorLink: "https://lruihao.cn"
description: "在 FixIt 中设置 PWA 的指南。"
tags: ["PWA"]
@@ -22,6 +20,10 @@ menu:
title: "在 FixIt 中设置 PWA 的指南。"
parent: "documentation"
pre: "<i class='fa-brands fa-readme fa-fw fa-sm'></i>"
repost:
enable: true
url: "https://hugodoit.com/zh-cn/pwa-support/"
---
了解如何在 FixIt 主题中配置渐进式网络应用程序 (PWA)。
@@ -473,6 +473,10 @@ Please open the code block below to view the complete sample configuration :(fa-
pageStyle = "normal"
# {{< version 0.2.14 >}} Gravatar is force-used as the author's avatar
gravatarForce = false
# {{< version 0.2.15 >}} Repost config
[params.page.repost]
enable = false
url = ""
# {{< version 0.2.0 >}} Table of the contents config
[params.page.toc]
# whether to enable the table of the contents
@@ -475,6 +475,10 @@ hugo
pageStyle = "normal"
# {{< version 0.2.14 >}} 强制使用 Gravatar 作为作者头像
gravatarForce = true
# {{< version 0.2.15 >}} 转载配置
[params.page.repost]
enable = false
url = ""
# {{< version 0.2.0 >}} 目录配置
[params.page.toc]
# 是否使用目录
@@ -118,6 +118,8 @@ It is necessary only if the front matters and the `page` part in your [site conf
* **password**: {{< version 0.2.15 >}} password of encrypted page content, see [Theme Documentation - Content Encryption](../theme-documentation-content-encryption/)
* **message**: {{< version 0.2.15 >}} encryption prompt, see [Theme Documentation - Content Encryption](../theme-documentation-content-encryption/)
* **repost**: {{< version 0.2.15 >}} the same as the `params.page.repost` part in the [site configuration](../theme-documentation-basics#site-configuration).
{{< admonition tip >}}
{{< version 0.2.10 >}}
@@ -116,6 +116,8 @@ menu:
* **password**: {{< version 0.2.15 >}} 加密页面内容的密码,详见 [主题文档 - 内容加密](../theme-documentation-content-encryption/)
* **message**: {{< version 0.2.15 >}} 加密提示信息,详见 [主题文档 - 内容加密](../theme-documentation-content-encryption/)
* **repost**: {{< version 0.2.15 >}} 和 [网站配置](../theme-documentation-basics#site-configuration) 中的 `params.page.repost` 部分相同
{{< admonition tip >}}
{{< version 0.2.10 >}}
+2
View File
@@ -145,6 +145,8 @@ other = "Teilen auf"
# === posts/single.html ===
[contents]
other = "Inhalt"
[repost]
other = "" # waitting for translation
[publishedOnDate]
other = "veröffentlicht auf {{ .Date }}"
+3
View File
@@ -142,6 +142,9 @@ other = "Share on"
[contents]
other = "Contents"
[repost]
other = "Repost"
[publishedOnDate]
other = "published on {{ .Date }}"
+2
View File
@@ -145,6 +145,8 @@ other = "Compartir en"
# === posts/single.html ===
[contents]
other = "Contenido"
[repost]
other = "" # waitting for translation
[publishedOnDate]
other = "publicado el {{ .Date }}"
+2
View File
@@ -145,6 +145,8 @@ other = "Partager sur"
# === posts/single.html ===
[contents]
other = "Contenu"
[repost]
other = "" # waitting for translation
[publishedOnDate]
other = "publié le {{ .Date }}"
+2
View File
@@ -145,6 +145,8 @@ other = "Condividi su"
# === posts/single.html ===
[contents]
other = "Contenuti"
[repost]
other = "" # waitting for translation
[publishedOnDate]
other = "pubblicato su {{ .Date }}"
+2
View File
@@ -142,6 +142,8 @@ other = "Udostępnij na"
# === posts/single.html ===
[contents]
other = "Spis treści"
[repost]
other = "" # waitting for translation
[publishedOnDate]
other = "opublikowano {{ .Date }}"
+2
View File
@@ -145,6 +145,8 @@ other = "Compartilhe em"
# === posts/single.html ===
[contents]
other = "Conteúdos"
[repost]
other = "" # waitting for translation
[publishedOnDate]
other = "publicado em {{ .Date }}"
+2
View File
@@ -145,6 +145,8 @@ other = "Distribuie pe"
# === posts/single.html ===
[contents]
other = "Cuprins"
[repost]
other = "" # waitting for translation
[publishedOnDate]
other = "publicat la {{ .Date }}"
+2
View File
@@ -145,6 +145,8 @@ other = "Поделиться в"
# === posts/single.html ===
[contents]
other = "Содержание"
[repost]
other = "" # waitting for translation
[publishedOnDate]
other = "Опубликовано {{ .Date }}"
+2
View File
@@ -142,6 +142,8 @@ other = "Подели на"
# === posts/single.html ===
[contents]
other = "Садржаји"
[repost]
other = "" # waitting for translation
[publishedOnDate]
other = "објављено {{ .Date }}"
+2
View File
@@ -144,6 +144,8 @@ other = "Chia sẻ trên"
# === posts/single.html ===
[contents]
other = "Nội dung"
[repost]
other = "" # waitting for translation
[publishedOnDate]
other = "đăng ngày {{ .Date }}"
+3
View File
@@ -148,6 +148,9 @@ other = "分享到"
[contents]
other = "目录"
[repost]
other = "转载"
[publishedOnDate]
other = "发布于 {{ .Date }}"
+3
View File
@@ -148,6 +148,9 @@ other = "分享到"
[contents]
other = "目錄"
[repost]
other = "轉貼"
[publishedOnDate]
other = "發佈於 {{ .Date }}"
+1 -3
View File
@@ -41,9 +41,7 @@
<h2 class="group-title">{{ .Key }}</h2>
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">
{{- .Title -}}
</a>
<a href="{{ .RelPermalink }}" class="archive-item-link">{{- .Title -}}</a>
<span class="archive-item-date" title='{{ "2006-01-02 15:04:05" | .Date.Format }}'>
{{- $.Site.Params.section.dateFormat | default "01-02" | .Date.Format -}}
</span>
+8
View File
@@ -19,6 +19,14 @@
{{- /* Title */ -}}
<h1 class="single-title" itemprop="name headline">
{{ $repost := $params.repost | default dict }}
{{- with $repost -}}
{{- if eq .Enable true -}}
{{- $icon := dict "Class" "fa-solid fa-share fa-fw" -}}
{{- $title := cond (hasPrefix .Url "http") (printf "%v -> %v" (T "repost") .Url ) (T "repost") -}}
<span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span>
{{- end -}}
{{- end -}}
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h1>
+15 -1
View File
@@ -20,7 +20,21 @@
<article class="page single">
<div class="header">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__flipInX">{{ .Title }}</h1>
<h1 class="single-title animate__animated animate__flipInX">
{{ $repost := $params.repost | default dict }}
{{- with $repost -}}
{{- if eq .Enable true -}}
{{- $icon := dict "Class" "fa-solid fa-share fa-fw" -}}
{{- $title := cond (hasPrefix .Url "http") (printf "%v -> %v" (T "repost") .Url ) (T "repost") -}}
{{- if hasPrefix .Url "http" -}}
{{ dict "Destination" .Url "Icon" $icon "Class" "icon-repost" "Title" $title | partial "plugin/link.html" -}}
{{- else -}}
<span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span>
{{- end -}}
{{- end -}}
{{- end -}}
<span>{{- .Title -}}</span>
</h1>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}<p class="single-subtitle animate__animated animate__fadeIn">{{ . }}</p>{{- end -}}