diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..60c39710 --- /dev/null +++ b/.babelrc @@ -0,0 +1,11 @@ +{ + "presets": [ + [ + "@babel/preset-env", + { + "targets": "> 0.25%, not dead" + } + ], + "minify" + ] +} diff --git a/.gitignore b/.gitignore index 5675a014..4772d3fa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ # Hugo default output directory -public -/exampleSite/resources -/exampleSite/zh/resources +public/ +/exampleSite/resources/ +/exampleSite/zh/resources/ +node_modules/ ## OS Files # Windows diff --git a/archetypes/default.md b/archetypes/default.md index 51a441a0..4468df5e 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -1,25 +1,24 @@ --- -author: "" -author_link: "" title: "{{ replace .TranslationBaseName "-" " " | title }}" date: {{ .Date }} lastmod: {{ .Date }} draft: true +author: "" +authorLink: "" description: "" -show_in_homepage: true -description_as_summary: false license: "" tags: [] categories: [] +hiddenFromHomePage: false -featured_image: "" -featured_image_preview: "" +featuredImage: "" +featuredImagePreview: "" -comment: true toc: false -auto_collapse_toc: true +autoCollapseToc: true math: false +comment: true --- - \ No newline at end of file + diff --git a/assets/css/style.template.scss b/assets/css/style.template.scss index d0d8e9fe..4ee6466b 100644 --- a/assets/css/style.template.scss +++ b/assets/css/style.template.scss @@ -1,14 +1,9 @@ @charset 'utf-8'; -{{- if eq .Site.Params.home_mode "post" -}} - $home-profile: true; - $home-posts: true; -{{- else -}} - $home-profile: true; - $home-posts: false; -{{- end -}} +$home-profile: {{- if .Site.Params.home.profile.enable -}}true{{ else }}false{{ end }}; +$home-posts: {{- if .Site.Params.home.posts.enable -}}true{{ else }}false{{ end }}; -{{- if eq .Site.Params.desktopHeaderMode "normal" -}} +{{- if eq .Site.Params.header.desktopMode "normal" -}} $header-position-desktop: static; $page-padding-top-desktop: 1rem; $post-toc-top: 7rem; @@ -18,7 +13,7 @@ $post-toc-top: 12rem; {{- end -}} -{{- if eq .Site.Params.mobileHeaderMode "normal" -}} +{{- if eq .Site.Params.header.mobileMode "normal" -}} $header-position-mobile: static; $page-padding-top-mobile: 1rem; {{- else -}} diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 575d9b65..aa6ab22e 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -112,84 +112,47 @@ dateFormatToUse = "2006-01-02" keywords = ["Theme", "Hugo"] # site default theme ("light", "dark", "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= 'CC BY-NC 4.0' - # public git repo url to link lastmod git commit only then enableGitInfo is true gitRepo = "" - # 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 + # Header info + [params.header] + # desktop header mode ("fixed", "normal", "auto") + desktopMode = "fixed" + # mobile header mode ("fixed", "normal", "auto") + mobileMode = "auto" - # whether to show link to Raw Markdown content of the post - linkToMarkdown = true + # Footer Copyright Info + [params.footer] + # Site creation time + since = 2019 + # ICP info only in China (HTML format is allowed) + icp = "" + # license info (HTML format is allowed) + license= 'CC BY-NC 4.0' - # site verification code for Google/Bing/Yandex/Pinterest/Baidu - google_verification = "" - bing_verification = "" - yandex_verification = "" - pinterest_verification = "" - baidu_verification = "" - - # CSS and JS Files CDN - [params.cdn] - ## for example '' - 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 = '' - - # Gravatar Info for preferred avatar in home page - [params.gravatar] - email = "" + # Home Page Info + [params.home] + # Home Page Profile + [params.home.profile] + enable = true + # Gravatar Email for preferred avatar in home page + gravatarEmail = "" + # URL of avatar shown in home page + avatarURL = "images/avatar.png" + # subtitle shown in home page + subtitle = "A Clean, Elegant but Advanced Hugo Theme" + # whether to use typeit animation for subtitle + typeit = true + # whether to show social links + social = true + # Home Page Posts + [params.home.posts] + enable = true + # special amount of posts in each home posts page + paginate = 6 + # default behavior when you don't set "hiddenFromHomePage" in front matter + defaultHiddenFromHomePage = false # Social Info in home page [params.social] @@ -257,6 +220,13 @@ dateFormatToUse = "2006-01-02" #XMPP = "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 [params.share] enable = true @@ -271,6 +241,50 @@ dateFormatToUse = "2006-01-02" #VKontakte = true #Weibo = true + # mathematical formulas (KaTeX) + [params.math] + enable = true + blockLeftDelimiter = "" + blockRightDelimiter = "" + inlineLeftDelimiter = "$" + inlineRightDelimiter = "$" + # KaTeX extension copy_tex + copyTex = true + # KaTeX extension mhchem + mhchem = true + + # CSS and JS Files CDN + [params.cdn] + ## for example '' + fontawesomeFreeCSS = '' + animateCSS = '' + gitalkCSS = '' + gitalkJS = '' + valineJS = '' + lazysizesJS = '' + smoothScrollJS = '' + katexCSS = '' + katexJS = '' + katexAutoRenderJS = '' + katexCopyTexCSS = '' + katexCopyTexJS = '' + katexMhchemJS = '' + mermaidJS = '' + echartsJS = '' + echartsMacaronsJS = '' + typeitJS = '' + aplayerCSS = '' + aplayerJS = '' + metingJS = '' + + # site verification code for Google/Bing/Yandex/Pinterest/Baidu + [params.verification] + google = "" + bing = "" + yandex = "" + pinterest = "" + baidu = "" + # Publisher Info just for SEO [params.publisher] name = "xxxx" @@ -291,39 +305,43 @@ dateFormatToUse = "2006-01-02" width = 800 height = 600 - # Disqus Comment Config (https://disqus.com/) - [params.disqus] - # Disqus shortname to use Disqus in posts - shortname = "dillonzq" + # Comment Config + [params.comment] + enable = true - # Gittalk Comment Config (https://github.com/gitalk/gitalk) - [params.gitalk] - owner = "" - repo = "" - clientId = "" - clientSecret = "" + # Disqus Comment Config (https://disqus.com/) + [params.comment.disqus] + # Disqus shortname to use Disqus in posts + shortname = "dillonzq" - # Valine Comment Config (https://github.com/xCss/Valine) - [params.valine] - enable = false - appId = "" - appKey = "" - placeholder = "Your comment ..." - notify = false - verify = true - avatar = "mp" - #meta= "" - pageSize = 10 - visitor = true - recordIP = true + # Gittalk Comment Config (https://github.com/gitalk/gitalk) + [params.comment.gitalk] + owner = "" + repo = "" + clientId = "" + clientSecret = "" - # Facebook Comment Config (https://developers.facebook.com/docs/plugins/comments) - [params.facebook] - enable = false - width = "100%" - numPosts = 10 - appId = "" - languageCode = "en_US" + # Valine Comment Config (https://github.com/xCss/Valine) + [params.comment.valine] + enable = false + appId = "" + appKey = "" + placeholder = "Your comment ..." + 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] diff --git a/exampleSite/content/posts/emoji-support.md b/exampleSite/content/posts/emoji-support.md index eb1ecb58..2ca9c8ad 100644 --- a/exampleSite/content/posts/emoji-support.md +++ b/exampleSite/content/posts/emoji-support.md @@ -1,29 +1,24 @@ --- -author: "Hugo Authors" -author_link: "https://gohugo.io/" title: "Emoji Support" date: 2019-10-01T17:55:28+08:00 lastmod: 2019-10-01T17:55:28+08:00 draft: false +author: "Hugo Authors" +authorLink: "https://gohugo.io/" description: "Guide to emoji usage in Hugo" -show_in_homepage: true -description_as_summary: false license: "" -tags: [ - "emoji", -] -categories: [ - "theme", -] +tags: ["emoji"] +categories: ["theme"] +hiddenFromHomePage: false -featured_image: /images/emoji.jpg -featured_image_preview: "" +featuredImage: /images/emoji.jpg +featuredImagePreview: "" -comment: true toc: false -auto_collapse_toc: true +autoCollapseToc: true math: false +comment: true --- Emoji can be enabled in a Hugo project in a number of ways. diff --git a/exampleSite/content/posts/markdown-syntax.md b/exampleSite/content/posts/markdown-syntax.md index 59f53908..87549411 100644 --- a/exampleSite/content/posts/markdown-syntax.md +++ b/exampleSite/content/posts/markdown-syntax.md @@ -1,31 +1,24 @@ --- -author: "Hugo Authors" -author_link: "https://gohugo.io/" title: "Markdown Syntax Guide" date: 2019-12-01T21:57:40+08:00 lastmod: 2020-01-01T16:45:40+08:00 draft: false +author: "Hugo Authors" +authorLink: "https://gohugo.io/" description: "Sample article showcasing basic Markdown syntax and formatting for HTML elements." -show_in_homepage: true -description_as_summary: false license: "" -tags: [ - "markdown", - "css", - "html", -] -categories: [ - "theme", -] +tags: ["markdown", "css", "html"] +categories: ["theme"] +hiddenFromHomePage: false -featured_image: /images/markdown.png -featured_image_preview: "" +featuredImage: /images/markdown.png +featuredImagePreview: "" -comment: true toc: true -auto_collapse_toc: true +autoCollapseToc: true math: true +comment: true --- This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme. diff --git a/exampleSite/content/posts/placeholder-text.md b/exampleSite/content/posts/placeholder-text.md index 7fcc7905..559af7d9 100644 --- a/exampleSite/content/posts/placeholder-text.md +++ b/exampleSite/content/posts/placeholder-text.md @@ -1,30 +1,24 @@ --- -author: "Hugo Authors" -author_link: "https://gohugo.io/" title: "Placeholder Text" date: 2019-08-01T18:02:41+08:00 lastmod: 2019-08-01T18:02:41+08:00 draft: false +author: "Hugo Authors" +authorLink: "https://gohugo.io/" description: "Lorem Ipsum Dolor Si Amet" -show_in_homepage: true -description_as_summary: false license: "" -tags: [ - "markdown", - "text", -] -categories: [ - "theme", -] +tags: ["markdown", "text"] +categories: ["theme"] +hiddenFromHomePage: false -featured_image: "" -featured_image_preview: "" +featuredImage: "" +featuredImagePreview: "" -comment: true toc: false -auto_collapse_toc: true +autoCollapseToc: true math: false +comment: true --- Lorem est tota propiore conpellat pectoribus de diff --git a/exampleSite/content/posts/rich-content.md b/exampleSite/content/posts/rich-content.md index f26c862d..c6f069a1 100644 --- a/exampleSite/content/posts/rich-content.md +++ b/exampleSite/content/posts/rich-content.md @@ -1,30 +1,24 @@ --- -author: "Hugo Authors" -author_link: "https://gohugo.io/" title: "Rich Content" date: 2019-09-01T18:06:32+08:00 lastmod: 2019-09-01T18:06:32+08:00 draft: false +author: "Hugo Authors" +authorLink: "https://gohugo.io/" description: "A brief description of Hugo Shortcodes" -show_in_homepage: true -description_as_summary: false license: "" -tags: [ - "shortcodes", - "privacy", -] -categories: [ - "theme", -] +tags: ["shortcodes", "privacy"] +categories: ["theme"] +hiddenFromHomePage: false -featured_image: /images/hugo.png -featured_image_preview: "" +featuredImage: /images/hugo.png +featuredImagePreview: "" -comment: true toc: false -auto_collapse_toc: true +autoCollapseToc: true math: false +comment: true --- Hugo ships with several [Built-in Shortcodes](https://gohugo.io/content-management/shortcodes/#use-hugo-s-built-in-shortcodes) for rich content, along with a [Privacy Config](https://gohugo.io/about/hugo-and-gdpr/) and a set of Simple Shortcodes that enable static and no-JS versions of various social media embeds. diff --git a/exampleSite/zh/config.toml b/exampleSite/zh/config.toml index c4dee73e..432dab3f 100644 --- a/exampleSite/zh/config.toml +++ b/exampleSite/zh/config.toml @@ -112,84 +112,47 @@ dateFormatToUse = "2006-01-02" keywords = ["Theme", "Hugo"] # 网站默认主题 ("light", "dark", "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= 'CC BY-NC 4.0' - # 用于生成文章上次修改时间的公共 git 仓库路径,仅在 enableGitInfo 设为 true 时有效 gitRepo = "" - # 数学公式 (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 + # 页面头部导航栏信息 + [params.header] + # 桌面端导航栏模式 ("fixed", "normal", "auto") + desktopMode = "fixed" + # 移动端导航栏模式 ("fixed", "normal", "auto") + mobileMode = "auto" - # 是否在文章页面显示原始 Markdown 文档链接 - linkToMarkdown = true + # 页面底部版权信息设置 + [params.footer] + # 网站创立年份 + since = 2019 + # ICP 备案信息,仅在中国使用 (允许使用 HTML 格式) + icp = "" + # 许可协议信息 (允许使用 HTML 格式) + license= 'CC BY-NC 4.0' - # 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu - google_verification = "" - bing_verification = "" - yandex_verification = "" - pinterest_verification = "" - baidu_verification = "" - - # CSS 和 JS 文件的 CDN 设置 - [params.cdn] - ## 例如 '' - 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 = '' - - # Gravatar 信息,用于优先在主页显示的头像 - [params.gravatar] - email = "" + # 主页信息设置 + [params.home] + # 主页个人信息 + [params.home.profile] + enable = true + # Gravatar 邮箱,用于优先在主页显示的头像 + gravatarEmail = "" + # 主页显示头像的 URL + avatarURL = "images/avatar.png" + # 主页显示的网站副标题 + subtitle = "一个简洁、优雅且高效的 Hugo 主题" + # 是否为副标题显示打字机动画 + typeit = true + # 是否显示社交账号 + social = true + # 主页文章列表 + [params.home.posts] + enable = true + # 主页每页显示文章数量 + paginate = 6 + # 当你没有在文章前面设置 "hiddenFromHomePage" 时的默认行为 + defaultHiddenFromHomePage = false # 主页的社交信息设置 [params.social] @@ -257,6 +220,13 @@ dateFormatToUse = "2006-01-02" #XMPP = "xxxx" #Matrix ="xxxx" + # 文章页面配置 + [params.page] + # 在文章页面是否使用分享功能 + socialShare = true + # 是否在文章页面显示原始 Markdown 文档链接 + linkToMarkdown = true + # 文章页面的分享信息设置 [params.share] enable = true @@ -271,6 +241,50 @@ dateFormatToUse = "2006-01-02" #VKontakte = true #Weibo = true + # 数学公式 (KaTeX https://katex.org/) + [params.math] + enable = true + blockLeftDelimiter = "" + blockRightDelimiter = "" + inlineLeftDelimiter = "$" + inlineRightDelimiter = "$" + # KaTeX 插件 copy_tex + copyTex = true + # KaTeX 插件 mhchem + mhchem = true + + # CSS 和 JS 文件的 CDN 设置 + [params.cdn] + ## 例如 '' + fontawesomeFreeCSS = '' + animateCSS = '' + gitalkCSS = '' + gitalkJS = '' + valineJS = '' + lazysizesJS = '' + smoothScrollJS = '' + katexCSS = '' + katexJS = '' + katexAutoRenderJS = '' + katexCopyTexCSS = '' + katexCopyTexJS = '' + katexMhchemJS = '' + mermaidJS = '' + echartsJS = '' + echartsMacaronsJS = '' + typeitJS = '' + aplayerCSS = '' + aplayerJS = '' + metingJS = '' + + # 网站验证代码,用于 Google/Bing/Yandex/Pinterest/Baidu + [params.verification] + google = "" + bing = "" + yandex = "" + pinterest = "" + baidu = "" + # 出版者信息,仅用于 SEO [params.publisher] name = "xxxx" @@ -291,39 +305,43 @@ dateFormatToUse = "2006-01-02" width = 800 height = 600 - # Disqus 评论系统设置 (https://disqus.com/) - [params.disqus] - # Disqus 的用户名,用来在文章中启用 Disqus 评论系统 - shortname = "dillonzq" + # 评论系统设置 + [params.comment] + enable = true - # Gittalk 评论系统设置 (https://github.com/gitalk/gitalk) - [params.gitalk] - owner = "" - repo = "" - clientId = "" - clientSecret = "" + # Disqus 评论系统设置 (https://disqus.com/) + [params.comment.disqus] + # Disqus 的用户名,用来在文章中启用 Disqus 评论系统 + shortname = "dillonzq" - # Valine 评论系统设置 (https://github.com/xCss/Valine) - [params.valine] - enable = false - appId = "" - appKey = "" - placeholder = "你的评论 ..." - notify = false - verify = true - avatar = "mp" - #meta= "" - pageSize = 10 - visitor = true - recordIP = true + # Gittalk 评论系统设置 (https://github.com/gitalk/gitalk) + [params.comment.gitalk] + owner = "" + repo = "" + clientId = "" + clientSecret = "" - # Facebook 评论系统设置 (https://developers.facebook.com/docs/plugins/comments) - [params.facebook] - enable = false - width = "100%" - numPosts = 10 - appId = "" - languageCode = "en_US" + # Valine 评论系统设置 (https://github.com/xCss/Valine) + [params.comment.valine] + enable = false + appId = "" + appKey = "" + placeholder = "你的评论 ..." + 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/) [privacy] diff --git a/exampleSite/zh/content/posts/Basic-Markdown-Preview.md b/exampleSite/zh/content/posts/Basic-Markdown-Preview.md index 6da58b87..1f402292 100644 --- a/exampleSite/zh/content/posts/Basic-Markdown-Preview.md +++ b/exampleSite/zh/content/posts/Basic-Markdown-Preview.md @@ -1,30 +1,24 @@ --- -author: "" -author_link: "" title: "Markdown 基本语法预览" date: 2019-08-25T16:22:42+08:00 lastmod: 2019-08-25T16:22:42+08:00 draft: false +author: "" +authorLink: "" description: "这是一篇用于预览 Markdown 基本语法的文章。" -show_in_homepage: true -description_as_summary: false license: "" -tags: [ - "Hugo", - "主题", -] -categories: [ - "预览", -] +tags: ["Hugo", "主题"] +categories: ["预览"] -featured_image: "" -featured_image_preview: "" +featuredImage: "" +featuredImagePreview: "" +hiddenFromHomePage: false -comment: true toc: true -auto_collapse_toc: true +autoCollapseToc: true math: true +comment: true --- 这是一篇用于预览 :(fab fa-markdown): Markdown 基本语法的文章。 diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index cc11c2dd..eb1db715 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html @@ -1,8 +1,8 @@
{{- /* Featured image */ -}} - {{- with .Params.featured_image -}} + {{- with .Params.featuredImage -}} {{- end -}} @@ -15,8 +15,8 @@ {{- /* Meta */ -}}
{{- $author := .Params.author | default .Site.Author.name -}} - {{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}} - @@ -39,13 +39,7 @@ {{- /* Summary content */ -}}
- {{- if .Params.description_as_summary -}} -

- {{- .Params.description -}} -

- {{- else -}} - {{- partial "hook/content.html" .Summary | safeHTML -}} - {{- end -}} + {{- partial "hook/content.html" .Summary | safeHTML -}}
{{- /* Footer */ -}} diff --git a/layouts/index.html b/layouts/index.html index 6a60916e..0d3779e5 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,14 +1,20 @@ {{- define "content" -}}
- {{- /* Home mode [post] */ -}} - {{- if eq .Site.Params.home_mode "post" -}} - {{- /* Profile */ -}} + {{- /* Profile */ -}} + {{- if .Site.Params.home.profile.enable -}} {{- partial "home/profile.html" . -}} + {{- end -}} + {{- /* Posts */ -}} + {{- if .Site.Params.home.posts.enable -}} {{- /* Paginate */ -}} {{- $paginator := where .Site.RegularPages "Type" "posts" -}} - {{- $paginator = where $paginator "Params.show_in_homepage" "!=" false -}} - {{- with .Site.Params.home_paginate -}} + {{- if ne .Site.Params.home.posts.mode.defaultHiddenFromHomePage false -}} + {{- $paginator = where $paginator "Params.hiddenfromhomepage" "!=" true -}} + {{- else -}} + {{- $paginator = where $paginator "Params.hiddenfromhomepage" false -}} + {{- end -}} + {{- with .Site.Params.home.posts.paginate -}} {{- $paginator = $.Paginate $paginator . -}} {{- else -}} {{- $paginator = $.Paginate $paginator -}} @@ -17,11 +23,6 @@ {{- .Render "summary" -}} {{- end -}} {{- partial "paginator.html" . -}} - - {{- /* Home mode [other] */ -}} - {{- else -}} - {{- /* Profile */ -}} - {{- partial "home/profile.html" . -}} {{- end -}}
{{- end -}} diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html index d49d0407..330c5cfb 100644 --- a/layouts/partials/comment.html +++ b/layouts/partials/comment.html @@ -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" -}} {{- /* Disqus Comment System */ -}} - {{- with .Site.Params.disqus.shortname -}} + {{- with .Site.Params.comment.disqus.shortname -}}
{{- $script := printf `` . -}} {{- slice $script | $.Scratch.Add "scriptCDN" -}} @@ -12,14 +12,15 @@ {{- end -}} {{- /* Gitalk Comment System */ -}} - {{- if .Site.Params.gitalk.owner -}} + {{- if .Site.Params.comment.gitalk.owner -}} + {{- $gitalk := .Site.Params.comment.gitalk -}}
- {{- with $CDN.gitalk_css -}} + {{- with $CDN.gitalkCSS -}} {{- slice . | $.Scratch.Add "linkCDN" -}} {{- else -}} {{- slice "css/lib/gitalk/gitalk.css" | .Scratch.Add "linkLocal" -}} {{- end -}} - {{- with $CDN.gitalk_js -}} + {{- with $CDN.gitalkJS -}} {{- slice . | $.Scratch.Add "scriptCDN" -}} {{- else -}} {{- slice "css/lib/gitalk/gitalk.min.js" | .Scratch.Add "scriptLocal" -}} @@ -29,11 +30,11 @@ var gitalk = new Gitalk({ id: '{{ .Date }}', title: '{{ .Title }}', - clientID: '{{ .Site.Params.gitalk.clientId }}', - clientSecret: '{{ .Site.Params.gitalk.clientSecret }}', - repo: '{{ .Site.Params.gitalk.repo }}', - owner: '{{ .Site.Params.gitalk.owner }}', - admin: ['{{ .Site.Params.gitalk.owner }}'], + clientID: '{{ $gitalk.clientId }}', + clientSecret: '{{ $gitalk.clientSecret }}', + repo: '{{ $gitalk.repo }}', + owner: '{{ $gitalk.owner }}', + admin: ['{{ $gitalk.owner }}'], body: decodeURI(location.href), }); gitalk.render('gitalk'); @@ -45,10 +46,11 @@ {{- end -}} {{- /* Valine Comment System */ -}} - {{- if .Site.Params.valine.enable -}} + {{- if .Site.Params.comment.valine.enable -}} + {{- $valine := .Site.Params.comment.valine -}}
{{- slice "css/lib/valine/dark.scss" | .Scratch.Add "linkLocal" -}} - {{- with $CDN.valine_js -}} + {{- with $CDN.valineJS -}} {{- slice . | $.Scratch.Add "scriptCDN" -}} {{- else -}} {{- slice "js/lib/valine/Valine.min.js" | .Scratch.Add "scriptLocal" -}} @@ -57,31 +59,31 @@ document.addEventListener("DOMContentLoaded", function(event) { new Valine({ el: '#valine', - appId: '{{ .Site.Params.valine.appId }}', - appKey: '{{ .Site.Params.valine.appKey }}', - {{- with .Site.Params.valine.placeholder -}} + appId: '{{ $valine.appId }}', + appKey: '{{ $valine.appKey }}', + {{- with $valine.placeholder -}} placeholder: '{{ . }}', {{- end -}} - {{- if .Site.Params.valine.notify -}} + {{- if $valine.notify -}} notify: true, {{- end -}} - {{- if .Site.Params.valine.verify -}} + {{- if $valine.verify -}} verify: true, {{- end -}} - {{- with .Site.Params.valine.avatar -}} + {{- with $valine.avatar -}} avatar: '{{ . }}', {{- end -}} - {{- with .Site.Params.valine.meta -}} + {{- with $valine.meta -}} meta: {{ . | safeJS }}, {{- end -}} - {{- with .Site.Params.valine.pageSize -}} + {{- with $valine.pageSize -}} pageSize: {{ . | safeJS }}, {{- end -}} lang: '{{ T "valineLang" }}', - {{- if .Site.Params.valine.visitor -}} + {{- if $valine.visitor -}} visitor: true, {{- end -}} - {{- if .Site.Params.valine.recordIP -}} + {{- if $valine.recordIP -}} recordIP: true, {{- end -}} }); @@ -93,16 +95,17 @@ {{- end -}} {{- /* Facebook Comment System */ -}} - {{- if .Site.Params.facebook.enable -}} + {{- if .Site.Params.comment.facebook.enable -}} + {{- $facebook := .Site.Params.comment.facebook -}}
{{- $script := `` -}} - {{- $script = printf $script .Site.Params.facebook.languageCode .Site.Params.facebook.appId -}} + {{- $script = printf $script $facebook.languageCode $facebook.appId -}} {{- slice $script | .Scratch.Add "scriptCDN" -}}