Feat: add "Edit this page" button support (#103)

This commit is contained in:
Cell
2022-04-21 11:06:08 +08:00
parent 29f8b4fa26
commit b92ef741bf
9 changed files with 44 additions and 5 deletions
+2 -1
View File
@@ -15,9 +15,10 @@ All notable changes to this project will be documented in this file.
- Add download icon for downloadable links
- :sparkles: Feat: link shortcode add `external-icon` option ([#96](https://github.com/Lruihao/FixIt/issues/96))
- :sparkles: Feat: add GitHub Corners support ([#106](https://github.com/Lruihao/FixIt/issues/106))
- :sparkles: Feat: add "Edit this page" button support ([#103](https://github.com/Lruihao/FixIt/issues/103))
- :bug: Fix: invalid front matter `comment: true` ([#108](https://github.com/Lruihao/FixIt/issues/108))
- :bug: Fix: ibruce and watermark option negative value error ([#114](https://github.com/Lruihao/FixIt/issues/114))
- :sparkles: Style: add some common CSS styles Class ([#101](https://github.com/Lruihao/FixIt/issues/101))
- :lipstick: Style: add some common CSS styles Class ([#101](https://github.com/Lruihao/FixIt/issues/101))
- :lipstick: Style: add the gap between and icon and text at blending typesetting (@ctj12461, @Lruihao[#118](https://github.com/Lruihao/FixIt/pull/118))
- :lipstick: Style: modify blockquote CSS
- :memo: Docs: revised theme documentations
+7 -1
View File
@@ -37,9 +37,15 @@
.post-info-md {
font-size: 0.8rem;
width: 8rem;
width: fit-content;
@include link(false, false);
>span:not(:first-child)::before {
content: '|';
margin-left: 0.25rem;
margin-right: 0.25rem;
}
}
.post-info-share {
+6
View File
@@ -714,6 +714,12 @@ enableEmoji = true
# the maximum number of lines of displayed code by default
# 默认展开显示的代码行数
maxShownLines = 10
# Post edit since v0.2.14
# 文章编辑 since v0.2.14
[params.page.edit]
enable = true
# url = "https://github.com/user-name/repo-name/edit/branch-name/subdirectory-name" # Link for fork & edit
url = "https://github.com/Lruihao/FixIt/edit/master/exampleSite/content" # Link for fork & edit
# KaTeX mathematical formulas config (KaTeX https://katex.org/)
# KaTeX 数学公式配置 (KaTeX https://katex.org/)
[params.page.math]
@@ -495,6 +495,11 @@ Please open the code block below to view the complete sample configuration :(far
edit = true
# the maximum number of lines of displayed code by default
maxShownLines = 10
# {{< version 0.2.14 >}} Post edit
[params.page.edit]
enable = false
# url = "https://github.com/user-name/repo-name/edit/branch-name/subdirectory-name" # Link for fork & edit
url = "https://github.com/Lruihao/FixIt/edit/master/exampleSite/content" # Link for fork & edit
# {{< version 0.2.0 >}} {{< link "https://docs.mapbox.com/mapbox-gl-js" "Mapbox GL JS" >}} config (https://docs.mapbox.com/mapbox-gl-js)
[params.page.mapbox]
# access token of Mapbox GL JS
@@ -492,6 +492,11 @@ hugo
edit = true
# 默认展开显示的代码行数
maxShownLines = 10
# {{< version 0.2.14 >}} 文章编辑
[params.page.edit]
enable = false
# url = "https://github.com/user-name/repo-name/edit/branch-name/subdirectory-name" # Link for fork & edit
url = "https://github.com/Lruihao/FixIt/edit/master/exampleSite/content" # Link for fork & edit
# {{< version 0.2.0 changed >}} {{< link "https://katex.org/" KaTeX >}} 数学公式 (https://katex.org)
[params.page.math]
enable = true
+3
View File
@@ -153,6 +153,9 @@ other = "Updated on {{ .Date }}"
[readMarkdown]
other = "Read Markdown"
[editThisPage]
other = "Edit this page"
[back]
other = "Back"
+3
View File
@@ -158,6 +158,9 @@ other = "更新于 {{ .Date }}"
[readMarkdown]
other = "阅读原始文档"
[editThisPage]
other = "编辑此页"
[back]
other = "返回"
+3
View File
@@ -158,6 +158,9 @@ other = "更新於 {{ .Date }}"
[readMarkdown]
other = "閱讀原始文檔"
[editThisPage]
other = "編輯此頁"
[back]
other = "返回"
+10 -3
View File
@@ -30,9 +30,16 @@
{{- if $params.linktomarkdown -}}
{{- with .OutputFormats.Get "markdown" -}}
<span>
<a class="link-to-markdown" href="{{ .RelPermalink }}" target="_blank">
{{- T "readMarkdown" -}}
</a>
{{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "readMarkdown") "Content" (T "readMarkdown") "externalIcon" false -}}
{{- partial "plugin/link.html" $options -}}
</span>
{{- end -}}
{{- end -}}
{{- with $params.edit -}}
{{- if .Enable -}}
<span>
{{- $options := dict "Class" "link-to-edit" "Destination" (printf "%v/%v" .Url $.File.Path) "Title" (T "editThisPage") "Content" (T "editThisPage") "externalIcon" false -}}
{{- partial "plugin/link.html" $options -}}
</span>
{{- end -}}
{{- end -}}