Feat: add custom templates and parameter params.customFilePath support

This commit is contained in:
Cell
2022-11-04 15:15:39 +08:00
parent f3ce0fd165
commit c56b7d3d33
12 changed files with 29 additions and 6 deletions
+1
View File
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
- :sparkles: Feat: add feature post reward support ([#216](https://github.com/hugo-fixit/FixIt/issues/216), @Lruihao[#234](https://github.com/hugo-fixit/FixIt/pull/234))
- :sparkles: Feat: add reward shortcode support ([#216](https://github.com/hugo-fixit/FixIt/issues/216))
- :sparkles: Feat: add custom templates and parameter `params.customFilePath` support
- :sparkles: Feat: add feature end of post flag support ([#236](https://github.com/hugo-fixit/FixIt/issues/236))
- :sparkles: Feat: add params to close wordcount and readingTime in post ([#209](https://github.com/hugo-fixit/FixIt/issues/209))
- :truck: Feat: migrate parameter `params.autoBookmark` to `params.page.autoBookmark` ([#55](https://github.com/hugo-fixit/FixIt/issues/55))
+7 -2
View File
@@ -149,8 +149,6 @@
# Footer config
[params.footer]
enable = true
# FixIt 0.2.0 | NEW Custom content (HTML format is supported)
custom = ""
# FixIt 0.2.0 | NEW whether to show Hugo and theme info
hugo = true
# FixIt 0.2.0 | NEW whether to show copyright info
@@ -732,6 +730,13 @@
light = ""
dark = ""
height = "2px"
# FixIt 0.2.17 | NEW Define custom file paths
# Create your custom files in site directory `layouts/partials/custom` and uncomment needed files below
[params.customFilePath]
# aside = "custom/aside.html"
# profile = "custom/profile.html"
# footer = "custom/footer.html"
# FixIt 0.2.15 | NEW Developer options
[params.dev]
+1 -1
Submodule docs updated: eb874fa015...ebed6cbba2
+1 -1
View File
@@ -1 +1 @@
<!-- Custom aside html -->
{{- /* Custom aside html */ -}}
+1
View File
@@ -0,0 +1 @@
{{- /* Custom footer html */ -}}
+1
View File
@@ -0,0 +1 @@
{{- /* Custom profile html at home page */ -}}
+3 -1
View File
@@ -1,12 +1,14 @@
{{- if ne .Site.Params.footer.enable false -}}
<footer class="footer">
<div class="footer-container">
{{- /* Custom Content */ -}}
{{- /* TODO Custom Content deprecated */ -}}
{{- with .Site.Params.footer.custom -}}
<div class="footer-line custom">
{{- safeHTML . -}}
</div>
{{- end -}}
{{- /* Custom Content */ -}}
{{- partial (.Scratch.Get "customFilePath").footer . -}}
{{- /* Hugo and FixIt */ -}}
{{- if ne .Site.Params.footer.hugo false -}}
+3
View File
@@ -100,4 +100,7 @@
{{- . | safeHTML -}}
</h3>
{{- end -}}
{{- /* Custom Content */ -}}
{{- partial (.Scratch.Get "customFilePath").profile . -}}
</div>
@@ -10,6 +10,9 @@
{{- with .Site.Params.autoBookmark -}}
{{- $warnErrors = $warnErrors | append "The parameter `autoBookmark` is deprecated since v0.2.17, use `page.autoBookmark` instead." -}}
{{- end -}}
{{- with .Site.Params.footer.custom -}}
{{- $warnErrors = $warnErrors | append "The parameter `footer.custom` is deprecated since v0.2.17, use parameter `params.customFilePath.footer` instead." -}}
{{- end -}}
{{- if len $warnErrors -}}
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $warnErrors "\n - ") -}}
+6
View File
@@ -0,0 +1,6 @@
{{- /* Set customFilePath default value */ -}}
{{- $customFilePath := .Site.Params.customFilePath -}}
{{- $customFilePath = dict "aside" ($customFilePath.aside | default "custom/aside.html") | merge $customFilePath -}}
{{- $customFilePath = dict "profile" ($customFilePath.profile | default "custom/profile.html") | merge $customFilePath -}}
{{- $customFilePath = dict "footer" ($customFilePath.footer | default "custom/footer.html") | merge $customFilePath -}}
{{- .Scratch.Set "customFilePath" $customFilePath -}}
+1
View File
@@ -5,6 +5,7 @@
{{- partial "init/detection-env.html" . -}}
{{- partial "init/detection-version.html" . -}}
{{- partial "init/detection-deprecated.html" . -}}
{{- partial "init/global.html" . -}}
{{- partial "init/patch.html" . -}}
{{- partial "plugin/compatibility.html" . -}}
+1 -1
View File
@@ -18,7 +18,7 @@
<aside class="aside-custom">
<!-- put aside for later use -->
{{- partial "custom/aside.html" . -}}
{{- partial (.Scratch.Get "customFilePath").aside . -}}
</aside>
<article class="page single">