refactor: move default parameter values from template logic to params.toml (#1244)
This commit is contained in:
@@ -71,7 +71,9 @@ rssFullContent = true
|
|||||||
[comments.remark42]
|
[comments.remark42]
|
||||||
host = ""
|
host = ""
|
||||||
site = ""
|
site = ""
|
||||||
locale = ""
|
locale = "en"
|
||||||
|
max_shown_comments = 15
|
||||||
|
show_email_subscription = true
|
||||||
|
|
||||||
[comments.vssue]
|
[comments.vssue]
|
||||||
platform = ""
|
platform = ""
|
||||||
@@ -115,11 +117,15 @@ rssFullContent = true
|
|||||||
repoID = ""
|
repoID = ""
|
||||||
category = ""
|
category = ""
|
||||||
categoryID = ""
|
categoryID = ""
|
||||||
mapping = ""
|
mapping = "title"
|
||||||
lightTheme = ""
|
lightTheme = "light"
|
||||||
darkTheme = ""
|
darkTheme = "dark_dimmed"
|
||||||
reactionsEnabled = 1
|
reactionsEnabled = 1
|
||||||
emitMetadata = 0
|
emitMetadata = 0
|
||||||
|
inputPosition = "top"
|
||||||
|
lang = "en"
|
||||||
|
strict = 0
|
||||||
|
loading = "lazy"
|
||||||
|
|
||||||
[comments.gitalk]
|
[comments.gitalk]
|
||||||
owner = ""
|
owner = ""
|
||||||
@@ -130,5 +136,5 @@ rssFullContent = true
|
|||||||
proxy = ""
|
proxy = ""
|
||||||
|
|
||||||
[comments.cusdis]
|
[comments.cusdis]
|
||||||
host = ""
|
host = "https://cusdis.com"
|
||||||
id = ""
|
id = ""
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
{{- $Height = $image.Height -}}
|
{{- $Height = $image.Height -}}
|
||||||
{{- $galleryImage = true -}}
|
{{- $galleryImage = true -}}
|
||||||
|
|
||||||
{{- if (default true .Page.Site.Params.imageProcessing.content.enabled) -}}
|
{{- if .Page.Site.Params.imageProcessing.content.enabled -}}
|
||||||
{{- $small := $image.Resize `480x` -}}
|
{{- $small := $image.Resize `480x` -}}
|
||||||
{{- $big := $image.Resize `1024x` -}}
|
{{- $big := $image.Resize `1024x` -}}
|
||||||
{{- $Srcset = printf `%s 480w, %s 1024w` $small.RelPermalink $big.RelPermalink -}}
|
{{- $Srcset = printf `%s 480w, %s 1024w` $small.RelPermalink $big.RelPermalink -}}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
<div>
|
<div>
|
||||||
{{ partial "helper/icon" "date" }}
|
{{ partial "helper/icon" "date" }}
|
||||||
<time class="article-time--published" datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
|
<time class="article-time--published" datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
|
||||||
{{- .Date | time.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
|
{{- .Date | time.Format .Site.Params.dateFormat.published -}}
|
||||||
</time>
|
</time>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<section class="article-lastmod">
|
<section class="article-lastmod">
|
||||||
{{ partial "helper/icon" "clock" }}
|
{{ partial "helper/icon" "clock" }}
|
||||||
<span>
|
<span>
|
||||||
{{ T "article.lastUpdatedOn" }} {{ .Lastmod | time.Format ( or .Site.Params.dateFormat.lastUpdated "Jan 02, 2006 15:04 MST" ) }}
|
{{ T "article.lastUpdatedOn" }} {{ .Lastmod | time.Format .Site.Params.dateFormat.lastUpdated }}
|
||||||
</span>
|
</span>
|
||||||
</section>
|
</section>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{- $host := default "https://cusdis.com" .Site.Params.comments.cusdis.host -}}
|
{{- $host := .Site.Params.comments.cusdis.host -}}
|
||||||
<div id="cusdis_thread" data-host="{{ $host }}" data-app-id="{{ .Site.Params.comments.cusdis.id }}"
|
<div id="cusdis_thread" data-host="{{ $host }}" data-app-id="{{ .Site.Params.comments.cusdis.id }}"
|
||||||
data-page-id="{{ .File.UniqueID }}" data-page-url="{{ .Permalink }}" data-page-title="{{ .Title }}"></div>
|
data-page-id="{{ .File.UniqueID }}" data-page-url="{{ .Permalink }}" data-page-title="{{ .Title }}"></div>
|
||||||
<script async defer src="{{ $host }}/js/cusdis.es.js"></script>
|
<script async defer src="{{ $host }}/js/cusdis.es.js"></script>
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
data-repo-id="{{- .repoID -}}"
|
data-repo-id="{{- .repoID -}}"
|
||||||
data-category="{{- .category -}}"
|
data-category="{{- .category -}}"
|
||||||
data-category-id="{{- .categoryID -}}"
|
data-category-id="{{- .categoryID -}}"
|
||||||
data-mapping="{{- default `title` .mapping -}}"
|
data-mapping="{{- .mapping -}}"
|
||||||
data-strict="{{- default 0 .strict -}}"
|
data-strict="{{- .strict -}}"
|
||||||
data-reactions-enabled="{{- default 1 .reactionsEnabled -}}"
|
data-reactions-enabled="{{- .reactionsEnabled -}}"
|
||||||
data-emit-metadata="{{- default 0 .emitMetadata -}}"
|
data-emit-metadata="{{- .emitMetadata -}}"
|
||||||
data-input-position="{{- default `top` .inputPosition -}}"
|
data-input-position="{{- .inputPosition -}}"
|
||||||
data-theme="{{- default `light` .lightTheme -}}"
|
data-theme="{{- .lightTheme -}}"
|
||||||
data-lang="{{- default `en` .lang -}}"
|
data-lang="{{- .lang -}}"
|
||||||
data-loading="{{- .loading -}}"
|
data-loading="{{- .loading -}}"
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
async
|
async
|
||||||
@@ -42,9 +42,9 @@
|
|||||||
|
|
||||||
function handler() {
|
function handler() {
|
||||||
if (document.documentElement.dataset.scheme === "light") {
|
if (document.documentElement.dataset.scheme === "light") {
|
||||||
setGiscusTheme('{{- default "light" .lightTheme -}}');
|
setGiscusTheme('{{- .lightTheme -}}');
|
||||||
} else {
|
} else {
|
||||||
setGiscusTheme('{{- default "dark_dimmed" .darkTheme -}}');
|
setGiscusTheme('{{- .darkTheme -}}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
site_id: '{{ .site }}',
|
site_id: '{{ .site }}',
|
||||||
components: ['embed'],
|
components: ['embed'],
|
||||||
url: '{{ $.Permalink }}',
|
url: '{{ $.Permalink }}',
|
||||||
max_shown_comments: {{ default 15 .max_shown_comments }},
|
max_shown_comments: {{ .max_shown_comments }},
|
||||||
theme: document.documentElement.dataset.scheme,
|
theme: document.documentElement.dataset.scheme,
|
||||||
page_title: '{{ $.Title }}',
|
page_title: '{{ $.Title }}',
|
||||||
locale: '{{ default "en" .locale }}',
|
locale: '{{ .locale }}',
|
||||||
show_email_subscription: {{ default true .show_email_subscription }}
|
show_email_subscription: {{ .show_email_subscription }}
|
||||||
};
|
};
|
||||||
|
|
||||||
!function(e, n) {
|
!function(e, n) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
props: {
|
props: {
|
||||||
title: "{{ $.Title }}",
|
title: "{{ $.Title }}",
|
||||||
options: {
|
options: {
|
||||||
autoCreateIssue: {{ default false .autoCreateIssue }},
|
autoCreateIssue: {{ .autoCreateIssue }},
|
||||||
owner: "{{ .owner }}",
|
owner: "{{ .owner }}",
|
||||||
repo: "{{ .repo }}",
|
repo: "{{ .repo }}",
|
||||||
clientId: "{{ .clientId }}",
|
clientId: "{{ .clientId }}",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{{- $defaultColorScheme := default "auto" .Site.Params.colorScheme.default -}}
|
{{- $defaultColorScheme := .Site.Params.colorScheme.default -}}
|
||||||
{{- if not (default false .Site.Params.colorScheme.toggle) -}}
|
{{- if not .Site.Params.colorScheme.toggle -}}
|
||||||
{{/* If toggle is disabled, force default scheme */}}
|
{{/* If toggle is disabled, force default scheme */}}
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
@@ -11,6 +11,6 @@
|
|||||||
|
|
||||||
{{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources) -}}
|
{{- $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources) -}}
|
||||||
{{- if $image -}}
|
{{- if $image -}}
|
||||||
<meta name="twitter:card" content="{{ default `summary_large_image` .Site.Params.opengraph.twitter.card }}">
|
<meta name="twitter:card" content="{{ .Site.Params.opengraph.twitter.card }}">
|
||||||
<meta name="twitter:image" content='{{ absURL $image.permalink }}' />
|
<meta name="twitter:image" content='{{ absURL $image.permalink }}' />
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<header>
|
<header>
|
||||||
{{ with .Site.Params.sidebar.avatar }}
|
{{ with .Site.Params.sidebar.avatar }}
|
||||||
{{ if (default true .enabled) }}
|
{{ if .enabled }}
|
||||||
<figure class="site-avatar">
|
<figure class="site-avatar">
|
||||||
<a href="{{ .Site.BaseURL | relLangURL }}">
|
<a href="{{ .Site.BaseURL | relLangURL }}">
|
||||||
{{ if not .local }}
|
{{ if not .local }}
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if (default false .Site.Params.colorScheme.toggle) }}
|
{{ if .Site.Params.colorScheme.toggle }}
|
||||||
<li id="dark-mode-toggle">
|
<li id="dark-mode-toggle">
|
||||||
{{ partial "helper/icon" "toggle-left" }}
|
{{ partial "helper/icon" "toggle-left" }}
|
||||||
{{ partial "helper/icon" "toggle-right" }}
|
{{ partial "helper/icon" "toggle-right" }}
|
||||||
|
|||||||
Reference in New Issue
Block a user