feature(config): add config for home profile/posts

This commit is contained in:
Dillon 2020-02-17 02:19:55 +08:00
parent d87af71176
commit 5a1e0b5d31
12 changed files with 319 additions and 288 deletions

View file

@ -1,14 +1,9 @@
@charset 'utf-8'; @charset 'utf-8';
{{- if eq .Site.Params.home_mode "post" -}} $home-profile: {{- if .Site.Params.home.profile.enable -}}true{{ else }}false{{ end }};
$home-profile: true; $home-posts: {{- if .Site.Params.home.posts.enable -}}true{{ else }}false{{ end }};
$home-posts: true;
{{- else -}}
$home-profile: true;
$home-posts: false;
{{- end -}}
{{- if eq .Site.Params.desktopHeaderMode "normal" -}} {{- if eq .Site.Params.header.desktopMode "normal" -}}
$header-position-desktop: static; $header-position-desktop: static;
$page-padding-top-desktop: 1rem; $page-padding-top-desktop: 1rem;
$post-toc-top: 7rem; $post-toc-top: 7rem;
@ -18,7 +13,7 @@
$post-toc-top: 12rem; $post-toc-top: 12rem;
{{- end -}} {{- end -}}
{{- if eq .Site.Params.mobileHeaderMode "normal" -}} {{- if eq .Site.Params.header.mobileMode "normal" -}}
$header-position-mobile: static; $header-position-mobile: static;
$page-padding-top-mobile: 1rem; $page-padding-top-mobile: 1rem;
{{- else -}} {{- else -}}

View file

@ -112,84 +112,45 @@ dateFormatToUse = "2006-01-02"
keywords = ["Theme", "Hugo"] keywords = ["Theme", "Hugo"]
# site default theme ("light", "dark", "auto") # site default theme ("light", "dark", "auto")
defaultTheme = "auto" defaultTheme = "auto"
# desktop header mode ("fixed", "normal", "auto")
desktopHeaderMode = "fixed"
# mobile header mode ("fixed", "normal", "auto")
mobileHeaderMode = "auto"
# Home Page Info
##home mode ("post", "other")
home_mode = "post"
## special amount of posts in each home post page
home_paginate = 6
## URL of avatar shown in home page
avatar = "images/avatar.png"
## subtitle shown in home page
subtitle = "A Clean, Elegant but Advanced Hugo Theme"
# whether to show social share links in post page
socialShare = true
# Footer CopyRight Info
## Site creation time
since = 2019
## ICP info only in China (HTML format is allowed)
icp = ""
## license info (HTML format is allowed)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# public git repo url to link lastmod git commit only then enableGitInfo is true # public git repo url to link lastmod git commit only then enableGitInfo is true
gitRepo = "" gitRepo = ""
# mathematical formulas (KaTeX) # Header info
[params.math] [params.header]
enable = true # desktop header mode ("fixed", "normal", "auto")
block_left_delimiter = "" desktopMode = "fixed"
block_right_delimiter = "" # mobile header mode ("fixed", "normal", "auto")
inline_left_delimiter = "$" mobileMode = "auto"
inline_right_delimiter = "$"
# KaTeX extension copy_tex
copy_tex = true
# KaTeX extension mhchem
mhchem = true
# whether to show link to Raw Markdown content of the post # Footer Copyright Info
linkToMarkdown = true [params.footer]
# Site creation time
since = 2019
# ICP info only in China (HTML format is allowed)
icp = ""
# license info (HTML format is allowed)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# site verification code for Google/Bing/Yandex/Pinterest/Baidu # Home Page Info
google_verification = "" [params.home]
bing_verification = "" # Home Page Profile
yandex_verification = "" [params.home.profile]
pinterest_verification = "" enable = true
baidu_verification = "" # Gravatar Email for preferred avatar in home page
gravatarEmail = ""
# CSS and JS Files CDN # URL of avatar shown in home page
[params.cdn] avatarURL = "images/avatar.png"
## for example '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.10.1/css/all.min.css" integrity="sha256-fdcFNFiBMrNfWL6OcAGQz6jDgNTRxnrLEd4vJYFWScE=" crossorigin="anonymous">' # subtitle shown in home page
fontawesome_free_css = '' subtitle = "A Clean, Elegant but Advanced Hugo Theme"
animate_css = '' # whether to use typeit animation for subtitle
gitalk_css = '' typeit = true
gitalk_js = '' # whether to show social links
valine_js = '' social = true
lazysizes_js = '' # Home Page Posts
smooth_scroll_js = '' [params.home.posts]
katex_css = '' enable = true
katex_js = '' # special amount of posts in each home posts page
katex_auto_render_js = '' paginate = 6
katex_copy_tex_css = ''
katex_copy_tex_js = ''
katex_mhchem_js = ''
mermaid_js = ''
echarts_js = ''
echarts_macarons_js = ''
typeit_js = ''
aplayer_css = ''
aplayer_js = ''
meting_js = ''
# Gravatar Info for preferred avatar in home page
[params.gravatar]
email = ""
# Social Info in home page # Social Info in home page
[params.social] [params.social]
@ -257,6 +218,13 @@ dateFormatToUse = "2006-01-02"
#XMPP = "xxxx" #XMPP = "xxxx"
#Matrix ="xxxx" #Matrix ="xxxx"
# Page config
[params.page]
# whether to show social share links in post page
socialShare = true
# whether to show link to Raw Markdown content of the post
linkToMarkdown = true
# Social Share Links in post page # Social Share Links in post page
[params.share] [params.share]
enable = true enable = true
@ -271,6 +239,50 @@ dateFormatToUse = "2006-01-02"
#VKontakte = true #VKontakte = true
#Weibo = true #Weibo = true
# mathematical formulas (KaTeX)
[params.math]
enable = true
block_left_delimiter = ""
block_right_delimiter = ""
inline_left_delimiter = "$"
inline_right_delimiter = "$"
# KaTeX extension copy_tex
copy_tex = true
# KaTeX extension mhchem
mhchem = true
# CSS and JS Files CDN
[params.cdn]
## for example '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.10.1/css/all.min.css" integrity="sha256-fdcFNFiBMrNfWL6OcAGQz6jDgNTRxnrLEd4vJYFWScE=" crossorigin="anonymous">'
fontawesome_free_css = ''
animate_css = ''
gitalk_css = ''
gitalk_js = ''
valine_js = ''
lazysizes_js = ''
smooth_scroll_js = ''
katex_css = ''
katex_js = ''
katex_auto_render_js = ''
katex_copy_tex_css = ''
katex_copy_tex_js = ''
katex_mhchem_js = ''
mermaid_js = ''
echarts_js = ''
echarts_macarons_js = ''
typeit_js = ''
aplayer_css = ''
aplayer_js = ''
meting_js = ''
# site verification code for Google/Bing/Yandex/Pinterest/Baidu
[params.verification]
google = ""
bing = ""
yandex = ""
pinterest = ""
baidu = ""
# Publisher Info just for SEO # Publisher Info just for SEO
[params.publisher] [params.publisher]
name = "xxxx" name = "xxxx"
@ -291,39 +303,43 @@ dateFormatToUse = "2006-01-02"
width = 800 width = 800
height = 600 height = 600
# Disqus Comment Config (https://disqus.com/) # Comment Config
[params.disqus] [params.comment]
# Disqus shortname to use Disqus in posts enable = true
shortname = "dillonzq"
# Gittalk Comment Config (https://github.com/gitalk/gitalk) # Disqus Comment Config (https://disqus.com/)
[params.gitalk] [params.comment.disqus]
owner = "" # Disqus shortname to use Disqus in posts
repo = "" shortname = "dillonzq"
clientId = ""
clientSecret = ""
# Valine Comment Config (https://github.com/xCss/Valine) # Gittalk Comment Config (https://github.com/gitalk/gitalk)
[params.valine] [params.comment.gitalk]
enable = false owner = ""
appId = "" repo = ""
appKey = "" clientId = ""
placeholder = "Your comment ..." clientSecret = ""
notify = false
verify = true
avatar = "mp"
#meta= ""
pageSize = 10
visitor = true
recordIP = true
# Facebook Comment Config (https://developers.facebook.com/docs/plugins/comments) # Valine Comment Config (https://github.com/xCss/Valine)
[params.facebook] [params.comment.valine]
enable = false enable = false
width = "100%" appId = ""
numPosts = 10 appKey = ""
appId = "" placeholder = "Your comment ..."
languageCode = "en_US" notify = false
verify = true
avatar = "mp"
#meta= ""
pageSize = 10
visitor = true
recordIP = true
# Facebook Comment Config (https://developers.facebook.com/docs/plugins/comments)
[params.comment.facebook]
enable = false
width = "100%"
numPosts = 10
appId = ""
languageCode = "en_US"
# Privacy Info (https://gohugo.io/about/hugo-and-gdpr/) # Privacy Info (https://gohugo.io/about/hugo-and-gdpr/)
[privacy] [privacy]

View file

@ -112,84 +112,45 @@ dateFormatToUse = "2006-01-02"
keywords = ["Theme", "Hugo"] keywords = ["Theme", "Hugo"]
# 网站默认主题 ("light", "dark", "auto") # 网站默认主题 ("light", "dark", "auto")
defaultTheme = "auto" defaultTheme = "auto"
# 桌面端导航栏模式 ("fixed", "normal", "auto")
desktopHeaderMode = "fixed"
# 移动端导航栏模式 ("fixed", "normal", "auto")
mobileHeaderMode = "auto"
# 主页信息设置
## 主页模式 ("post", "other")
home_mode = "post"
## 主页在 post 模式下每页 post 显示数量
home_paginate = 6
## 主页显示头像的 URL
avatar = "images/avatar.png"
## 主页显示的网站副标题
subtitle = "一个简洁、优雅且高效的 Hugo 主题"
# 在文章页面是否使用分享功能
socialShare = true
# 页面底部版权信息设置
## 网站创立年份
since = 2019
## ICP 备案信息,仅在中国使用 (允许使用 HTML 格式)
icp = ""
## 许可协议信息 (允许使用 HTML 格式)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# 用于生成文章上次修改时间的公共 git 仓库路径,仅在 enableGitInfo 设为 true 时有效 # 用于生成文章上次修改时间的公共 git 仓库路径,仅在 enableGitInfo 设为 true 时有效
gitRepo = "" gitRepo = ""
# 数学公式 (KaTeX https://katex.org/) # 页面头部导航栏信息
[params.math] [params.header]
enable = true # 桌面端导航栏模式 ("fixed", "normal", "auto")
block_left_delimiter = "" desktopMode = "fixed"
block_right_delimiter = "" # 移动端导航栏模式 ("fixed", "normal", "auto")
inline_left_delimiter = "$" mobileMode = "auto"
inline_right_delimiter = "$"
# KaTeX 插件 copy_tex
copy_tex = true
# KaTeX 插件 mhchem
mhchem = true
# 是否在文章页面显示原始 Markdown 文档链接 # 页面底部版权信息设置
linkToMarkdown = true [params.footer]
# 网站创立年份
since = 2019
# ICP 备案信息,仅在中国使用 (允许使用 HTML 格式)
icp = ""
# 许可协议信息 (允许使用 HTML 格式)
license= '<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a>'
# 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu # 主页信息设置
google_verification = "" [params.home]
bing_verification = "" # 主页个人信息
yandex_verification = "" [params.home.profile]
pinterest_verification = "" enable = true
baidu_verification = "" # Gravatar 邮箱,用于优先在主页显示的头像
gravatarEmail = ""
# CSS 和 JS 文件的 CDN 设置 # 主页显示头像的 URL
[params.cdn] avatarURL = "images/avatar.png"
## 例如 '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.10.1/css/all.min.css" integrity="sha256-fdcFNFiBMrNfWL6OcAGQz6jDgNTRxnrLEd4vJYFWScE=" crossorigin="anonymous">' # 主页显示的网站副标题
fontawesome_free_css = '' subtitle = "一个简洁、优雅且高效的 Hugo 主题"
animate_css = '' # 是否为副标题显示打字机动画
gitalk_css = '' typeit = true
gitalk_js = '' # 是否显示社交账号
valine_js = '' social = true
lazysizes_js = '' # 主页文章列表
smooth_scroll_js = '' [params.home.posts]
katex_css = '' enable = true
katex_js = '' # 主页每页显示文章数量
katex_auto_render_js = '' paginate = 6
katex_copy_tex_css = ''
katex_copy_tex_js = ''
katex_mhchem_js = ''
mermaid_js = ''
echarts_js = ''
echarts_macarons_js = ''
typeit_js = ''
aplayer_css = ''
aplayer_js = ''
meting_js = ''
# Gravatar 信息,用于优先在主页显示的头像
[params.gravatar]
email = ""
# 主页的社交信息设置 # 主页的社交信息设置
[params.social] [params.social]
@ -257,6 +218,13 @@ dateFormatToUse = "2006-01-02"
#XMPP = "xxxx" #XMPP = "xxxx"
#Matrix ="xxxx" #Matrix ="xxxx"
# 文章页面配置
[params.page]
# 在文章页面是否使用分享功能
socialShare = true
# 是否在文章页面显示原始 Markdown 文档链接
linkToMarkdown = true
# 文章页面的分享信息设置 # 文章页面的分享信息设置
[params.share] [params.share]
enable = true enable = true
@ -271,6 +239,50 @@ dateFormatToUse = "2006-01-02"
#VKontakte = true #VKontakte = true
#Weibo = true #Weibo = true
# 数学公式 (KaTeX https://katex.org/)
[params.math]
enable = true
block_left_delimiter = ""
block_right_delimiter = ""
inline_left_delimiter = "$"
inline_right_delimiter = "$"
# KaTeX 插件 copy_tex
copy_tex = true
# KaTeX 插件 mhchem
mhchem = true
# CSS 和 JS 文件的 CDN 设置
[params.cdn]
## 例如 '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.10.1/css/all.min.css" integrity="sha256-fdcFNFiBMrNfWL6OcAGQz6jDgNTRxnrLEd4vJYFWScE=" crossorigin="anonymous">'
fontawesome_free_css = ''
animate_css = ''
gitalk_css = ''
gitalk_js = ''
valine_js = ''
lazysizes_js = ''
smooth_scroll_js = ''
katex_css = ''
katex_js = ''
katex_auto_render_js = ''
katex_copy_tex_css = ''
katex_copy_tex_js = ''
katex_mhchem_js = ''
mermaid_js = ''
echarts_js = ''
echarts_macarons_js = ''
typeit_js = ''
aplayer_css = ''
aplayer_js = ''
meting_js = ''
# 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu
[params.verification]
google = ""
bing = ""
yandex = ""
pinterest = ""
baidu = ""
# 出版者信息,仅用于 SEO # 出版者信息,仅用于 SEO
[params.publisher] [params.publisher]
name = "xxxx" name = "xxxx"
@ -291,39 +303,43 @@ dateFormatToUse = "2006-01-02"
width = 800 width = 800
height = 600 height = 600
# Disqus 评论系统设置 (https://disqus.com/) # 评论系统设置
[params.disqus] [params.comment]
# Disqus 的用户名,用来在文章中启用 Disqus 评论系统 enable = true
shortname = "dillonzq"
# Gittalk 评论系统设置 (https://github.com/gitalk/gitalk) # Disqus 评论系统设置 (https://disqus.com/)
[params.gitalk] [params.comment.disqus]
owner = "" # Disqus 的用户名,用来在文章中启用 Disqus 评论系统
repo = "" shortname = "dillonzq"
clientId = ""
clientSecret = ""
# Valine 评论系统设置 (https://github.com/xCss/Valine) # Gittalk 评论系统设置 (https://github.com/gitalk/gitalk)
[params.valine] [params.comment.gitalk]
enable = false owner = ""
appId = "" repo = ""
appKey = "" clientId = ""
placeholder = "你的评论 ..." clientSecret = ""
notify = false
verify = true
avatar = "mp"
#meta= ""
pageSize = 10
visitor = true
recordIP = true
# Facebook 评论系统设置 (https://developers.facebook.com/docs/plugins/comments) # Valine 评论系统设置 (https://github.com/xCss/Valine)
[params.facebook] [params.comment.valine]
enable = false enable = false
width = "100%" appId = ""
numPosts = 10 appKey = ""
appId = "" placeholder = "你的评论 ..."
languageCode = "en_US" notify = false
verify = true
avatar = "mp"
#meta= ""
pageSize = 10
visitor = true
recordIP = true
# Facebook 评论系统设置 (https://developers.facebook.com/docs/plugins/comments)
[params.comment.facebook]
enable = false
width = "100%"
numPosts = 10
appId = ""
languageCode = "en_US"
# 隐私信息设置 (https://gohugo.io/about/hugo-and-gdpr/) # 隐私信息设置 (https://gohugo.io/about/hugo-and-gdpr/)
[privacy] [privacy]

View file

@ -1,14 +1,16 @@
{{- define "content" -}} {{- define "content" -}}
<div class="page home"> <div class="page home">
{{- /* Home mode [post] */ -}} {{- /* Profile */ -}}
{{- if eq .Site.Params.home_mode "post" -}} {{- if .Site.Params.home.profile.enable -}}
{{- /* Profile */ -}}
{{- partial "home/profile.html" . -}} {{- partial "home/profile.html" . -}}
{{- end -}}
{{- /* Posts */ -}}
{{- if .Site.Params.home.posts.enable -}}
{{- /* Paginate */ -}} {{- /* Paginate */ -}}
{{- $paginator := where .Site.RegularPages "Type" "posts" -}} {{- $paginator := where .Site.RegularPages "Type" "posts" -}}
{{- $paginator = where $paginator "Params.show_in_homepage" "!=" false -}} {{- $paginator = where $paginator "Params.show_in_homepage" "!=" false -}}
{{- with .Site.Params.home_paginate -}} {{- with .Site.Params.home.posts.paginate -}}
{{- $paginator = $.Paginate $paginator . -}} {{- $paginator = $.Paginate $paginator . -}}
{{- else -}} {{- else -}}
{{- $paginator = $.Paginate $paginator -}} {{- $paginator = $.Paginate $paginator -}}
@ -17,11 +19,6 @@
{{- .Render "summary" -}} {{- .Render "summary" -}}
{{- end -}} {{- end -}}
{{- partial "paginator.html" . -}} {{- partial "paginator.html" . -}}
{{- /* Home mode [other] */ -}}
{{- else -}}
{{- /* Profile */ -}}
{{- partial "home/profile.html" . -}}
{{- end -}} {{- end -}}
</div> </div>
{{- end -}} {{- end -}}

View file

@ -1,8 +1,8 @@
{{- if .Scratch.Get "production" | and .IsPage | and (ne .Params.comment false) -}} {{- if .Scratch.Get "production" | and .IsPage | and (ne .Site.Params.comment.enable false) | and (ne .Params.comment false) -}}
{{- $CDN := .Scratch.Get "CDN" -}} {{- $CDN := .Scratch.Get "CDN" -}}
{{- /* Disqus Comment System */ -}} {{- /* Disqus Comment System */ -}}
{{- with .Site.Params.disqus.shortname -}} {{- with .Site.Params.comment.disqus.shortname -}}
<div id="disqus_thread"></div> <div id="disqus_thread"></div>
{{- $script := printf `<script src="https://%s.disqus.com/embed.js"></script>` . -}} {{- $script := printf `<script src="https://%s.disqus.com/embed.js"></script>` . -}}
{{- slice $script | $.Scratch.Add "scriptCDN" -}} {{- slice $script | $.Scratch.Add "scriptCDN" -}}
@ -12,7 +12,8 @@
{{- end -}} {{- end -}}
{{- /* Gitalk Comment System */ -}} {{- /* Gitalk Comment System */ -}}
{{- if .Site.Params.gitalk.owner -}} {{- if .Site.Params.comment.gitalk.owner -}}
{{- $gitalk := .Site.Params.comment.gitalk -}}
<div id="gitalk"></div> <div id="gitalk"></div>
{{- with $CDN.gitalk_css -}} {{- with $CDN.gitalk_css -}}
{{- slice . | $.Scratch.Add "linkCDN" -}} {{- slice . | $.Scratch.Add "linkCDN" -}}
@ -29,11 +30,11 @@
var gitalk = new Gitalk({ var gitalk = new Gitalk({
id: '{{ .Date }}', id: '{{ .Date }}',
title: '{{ .Title }}', title: '{{ .Title }}',
clientID: '{{ .Site.Params.gitalk.clientId }}', clientID: '{{ $gitalk.clientId }}',
clientSecret: '{{ .Site.Params.gitalk.clientSecret }}', clientSecret: '{{ $gitalk.clientSecret }}',
repo: '{{ .Site.Params.gitalk.repo }}', repo: '{{ $gitalk.repo }}',
owner: '{{ .Site.Params.gitalk.owner }}', owner: '{{ $gitalk.owner }}',
admin: ['{{ .Site.Params.gitalk.owner }}'], admin: ['{{ $gitalk.owner }}'],
body: decodeURI(location.href), body: decodeURI(location.href),
}); });
gitalk.render('gitalk'); gitalk.render('gitalk');
@ -45,7 +46,8 @@
{{- end -}} {{- end -}}
{{- /* Valine Comment System */ -}} {{- /* Valine Comment System */ -}}
{{- if .Site.Params.valine.enable -}} {{- if .Site.Params.comment.valine.enable -}}
{{- $valine := .Site.Params.comment.valine -}}
<div id="valine"></div> <div id="valine"></div>
{{- slice "css/lib/valine/dark.scss" | .Scratch.Add "linkLocal" -}} {{- slice "css/lib/valine/dark.scss" | .Scratch.Add "linkLocal" -}}
{{- with $CDN.valine_js -}} {{- with $CDN.valine_js -}}
@ -57,31 +59,31 @@
document.addEventListener("DOMContentLoaded", function(event) { document.addEventListener("DOMContentLoaded", function(event) {
new Valine({ new Valine({
el: '#valine', el: '#valine',
appId: '{{ .Site.Params.valine.appId }}', appId: '{{ $valine.appId }}',
appKey: '{{ .Site.Params.valine.appKey }}', appKey: '{{ $valine.appKey }}',
{{- with .Site.Params.valine.placeholder -}} {{- with $valine.placeholder -}}
placeholder: '{{ . }}', placeholder: '{{ . }}',
{{- end -}} {{- end -}}
{{- if .Site.Params.valine.notify -}} {{- if $valine.notify -}}
notify: true, notify: true,
{{- end -}} {{- end -}}
{{- if .Site.Params.valine.verify -}} {{- if $valine.verify -}}
verify: true, verify: true,
{{- end -}} {{- end -}}
{{- with .Site.Params.valine.avatar -}} {{- with $valine.avatar -}}
avatar: '{{ . }}', avatar: '{{ . }}',
{{- end -}} {{- end -}}
{{- with .Site.Params.valine.meta -}} {{- with $valine.meta -}}
meta: {{ . | safeJS }}, meta: {{ . | safeJS }},
{{- end -}} {{- end -}}
{{- with .Site.Params.valine.pageSize -}} {{- with $valine.pageSize -}}
pageSize: {{ . | safeJS }}, pageSize: {{ . | safeJS }},
{{- end -}} {{- end -}}
lang: '{{ T "valineLang" }}', lang: '{{ T "valineLang" }}',
{{- if .Site.Params.valine.visitor -}} {{- if $valine.visitor -}}
visitor: true, visitor: true,
{{- end -}} {{- end -}}
{{- if .Site.Params.valine.recordIP -}} {{- if $valine.recordIP -}}
recordIP: true, recordIP: true,
{{- end -}} {{- end -}}
}); });
@ -93,16 +95,17 @@
{{- end -}} {{- end -}}
{{- /* Facebook Comment System */ -}} {{- /* Facebook Comment System */ -}}
{{- if .Site.Params.facebook.enable -}} {{- if .Site.Params.comment.facebook.enable -}}
{{- $facebook := .Site.Params.comment.facebook -}}
<div id="fb-root"></div> <div id="fb-root"></div>
<div <div
class="fb-comments" class="fb-comments"
data-href="{{ .Site.Params.baseURL }}{{ .Permalink | absURL }}" data-href="{{ .Site.Params.baseURL }}{{ .Permalink | absURL }}"
data-width="{{ .Site.Params.facebook.width }}" data-width="{{ $facebook.width }}"
data-numposts="{{ .Site.Params.facebook.numPosts }}" data-numposts="{{ $facebook.numPosts }}"
></div> ></div>
{{- $script := `<script src="https://connect.facebook.net/%s/sdk.js#xfbml=1&version=v5.0&appId=%s&autoLogAppEvents=1" crossorigin="anonymous"></script>` -}} {{- $script := `<script src="https://connect.facebook.net/%s/sdk.js#xfbml=1&version=v5.0&appId=%s&autoLogAppEvents=1" crossorigin="anonymous"></script>` -}}
{{- $script = printf $script .Site.Params.facebook.languageCode .Site.Params.facebook.appId -}} {{- $script = printf $script $facebook.languageCode $facebook.appId -}}
{{- slice $script | .Scratch.Add "scriptCDN" -}} {{- slice $script | .Scratch.Add "scriptCDN" -}}
<noscript> <noscript>
Please enable JavaScript to view the <a href="https://developers.facebook.com/docs/plugins/comments/">comments powered by Facebook.</a> Please enable JavaScript to view the <a href="https://developers.facebook.com/docs/plugins/comments/">comments powered by Facebook.</a>

View file

@ -8,7 +8,7 @@
<div class="copyright-line"> <div class="copyright-line">
{{- /* Copyright year */ -}} {{- /* Copyright year */ -}}
<i class="far fa-copyright fa-fw"></i> <i class="far fa-copyright fa-fw"></i>
{{- with .Site.Params.since -}} {{- with .Site.Params.footer.since -}}
<span itemprop="copyrightYear"> <span itemprop="copyrightYear">
{{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}} {{- if lt . now.Year }}{{ . }} - {{ end }}{{ now.Year -}}
</span> </span>
@ -22,12 +22,12 @@
{{- end -}} {{- end -}}
{{- /* License */ -}} {{- /* License */ -}}
{{- with .Site.Params.license -}} {{- with .Site.Params.footer.license -}}
&nbsp;|&nbsp;<span class="license">{{ . | safeHTML }}</span> &nbsp;|&nbsp;<span class="license">{{ . | safeHTML }}</span>
{{- end -}} {{- end -}}
{{- /* ICP */ -}} {{- /* ICP */ -}}
{{- with .Site.Params.icp -}} {{- with .Site.Params.footer.icp -}}
<span class="icp-splitter">&nbsp;|&nbsp;</span><br class="icp-br"/> <span class="icp-splitter">&nbsp;|&nbsp;</span><br class="icp-br"/>
<span class="icp">{{ . | safeHTML }}</span> <span class="icp">{{ . | safeHTML }}</span>
{{- end -}} {{- end -}}

View file

@ -1,19 +1,3 @@
{{- with .Site.Params.google_verification -}}
<meta name="google-site-verification" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.bing_verification -}}
<meta name="msvalidate.01" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.yandex_verification -}}
<meta name="yandex-verification" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.pinterest_verification -}}
<meta name="p:domain_verify" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.baidu_verification -}}
<meta name="baidu-site-verification" content="{{ . }}" />
{{- end -}}
{{- template "_internal/opengraph.html" . -}} {{- template "_internal/opengraph.html" . -}}
{{- template "_internal/twitter_cards.html" . -}} {{- template "_internal/twitter_cards.html" . -}}

View file

@ -1,3 +1,19 @@
{{- with .Site.Params.verification.google -}}
<meta name="google-site-verification" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.verification.bing -}}
<meta name="msvalidate.01" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.verification.yandex -}}
<meta name="yandex-verification" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.verification.pinterest -}}
<meta name="p:domain_verify" content="{{ . }}" />
{{- end -}}
{{- with .Site.Params.verification.baidu -}}
<meta name="baidu-site-verification" content="{{ . }}" />
{{- end -}}
{{- /* Home SEO */ -}} {{- /* Home SEO */ -}}
{{- if .IsHome -}} {{- if .IsHome -}}
<script type="application/ld+json"> <script type="application/ld+json">

View file

@ -44,6 +44,6 @@
</header> </header>
<script> <script>
window.desktopHeaderMode = {{ .Site.Params.desktopHeaderMode }}; window.desktopHeaderMode = {{ .Site.Params.header.desktopMode }};
window.mobileHeaderMode = {{ .Site.Params.mobileHeaderMode }}; window.mobileHeaderMode = {{ .Site.Params.header.mobileMode }};
</script> </script>

View file

@ -1,34 +1,38 @@
<div class="home-profile"> <div class="home-profile">
{{- $avatar := "" -}} {{- $avatar := .Site.Params.home.profile.avatarURL -}}
{{- if .Site.Params.gravatar.email -}} {{- with .Site.Params.home.profile.gravatarEmail -}}
{{- $avatar = (printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" (md5 .Site.Params.gravatar.email)) -}} {{- $avatar = md5 . | printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" -}}
{{- else if .Site.Params.avatar -}}
{{- $avatar = .Site.Params.avatar -}}
{{- end -}} {{- end -}}
{{- if $avatar -}} {{- with $avatar -}}
<div class="home-avatar"> <div class="home-avatar">
<a href="/posts"> <a href="/posts">
<img src={{ $avatar | relURL }} alt="avatar" title="{{ T "home" }}"> <img src={{ . | relURL }} alt="avatar" title="{{ T "home" }}">
</a> </a>
</div> </div>
{{- end -}} {{- end -}}
{{- with .Site.Params.subtitle -}} {{- with .Site.Params.home.profile.subtitle -}}
<h2 class="home-description"> <h2 class="home-description">
{{- $id := md5 . | printf "tp-%s" -}} {{- if $.Site.Params.home.profile.typeit -}}
<div id={{ printf "r%s" $id }} hidden=true> {{- $id := md5 . | printf "tp-%s" -}}
{{- . | safeHTML -}} <div id={{ printf "r%s" $id }} hidden=true>
</div> {{- . | safeHTML -}}
<div id={{ $id }} class="typeit"></div> </div>
{{- with $.Scratch.Get "typeitMap" -}} <div id={{ $id }} class="typeit"></div>
{{- $.Scratch.Set "typeitMap" (dict $id (slice $id) | merge .) -}} {{- with $.Scratch.Get "typeitMap" -}}
{{- $.Scratch.Set "typeitMap" (dict $id (slice $id) | merge .) -}}
{{- else -}}
{{- $.Scratch.Set "typeitMap" (dict $id (slice $id)) -}}
{{- end -}}
{{- else -}} {{- else -}}
{{- $.Scratch.Set "typeitMap" (dict $id (slice $id)) -}} {{- . | safeHTML -}}
{{- end -}} {{- end -}}
</h2> </h2>
{{- end -}} {{- end -}}
<div class="home-social-links"> <div class="home-social-links">
{{- partial "home/social.html" . -}} {{- if .Site.Params.home.profile.social -}}
{{- partial "home/social.html" . -}}
{{- end -}}
</div> </div>
</div> </div>

View file

@ -17,7 +17,7 @@
</div> </div>
<div class="post-info-line"> <div class="post-info-line">
<div class="post-info-md"> <div class="post-info-md">
{{- if .Site.Params.linkToMarkdown -}} {{- if .Site.Params.page.linkToMarkdown -}}
{{- with .OutputFormats.Get "markdown" -}} {{- with .OutputFormats.Get "markdown" -}}
<span> <span>
<a class="link-to-markdown" href="{{ .Permalink }}" target="_blank"> <a class="link-to-markdown" href="{{ .Permalink }}" target="_blank">
@ -28,7 +28,7 @@
{{- end -}} {{- end -}}
</div> </div>
<div class="post-info-share"> <div class="post-info-share">
{{- if and ( .Param "socialShare" ) (gt (len (.Param "share")) 0) -}} {{- if .Site.Params.page.socialShare -}}
<span> <span>
{{- partial "post/share.html" . -}} {{- partial "post/share.html" . -}}
</span> </span>