From a4574e20851a123d1f57a5f44786204906a1a0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Sun, 22 May 2022 19:40:41 +0800 Subject: [PATCH 01/36] :construction_worker: Finish default base index page head attribute migrate. --- assets/css/main.scss | 154 +++++++++++++++---------------- exampleSite/config.yaml | 71 +++++++++----- exampleSite/start.sh | 22 +++++ layouts/_default/baseof.html | 56 +++++++++-- layouts/partials/head.html | 6 +- layouts/partials/head/meta.html | 48 ++++++++++ layouts/partials/head/style.html | 7 ++ static/css/noscript.css | 30 ++++++ 8 files changed, 277 insertions(+), 117 deletions(-) create mode 100644 exampleSite/start.sh create mode 100644 layouts/partials/head/meta.html create mode 100644 layouts/partials/head/style.html create mode 100644 static/css/noscript.css diff --git a/assets/css/main.scss b/assets/css/main.scss index 454d880..1c4e1c4 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -1,41 +1,39 @@ // CSS Style Guide: https://codeguide.co/#css - // All variables from site's config content. -{{- $P := .Site.Params -}} // Base -$scheme: {{ $P.scheme }}; -$darkmode: {{ $P.darkmode }}; +$scheme: {{ .P.scheme }}; +$darkmode: {{ .P.darkmode }}; -$body_scrollbar_overlay: {{ $P.bodyScrollbar.overlay }}; -$body_scrollbar_stable: {{ $P.bodyScrollbar.stable }}; -$mermaid_enable: {{ $P.mermaid.enable }}; -$mobile_layout_economy: {{ $P.mobileLayoutEconomy }}; -$theme_color_dark: {{ $P.themeColor.dark }}; -$theme_color_light: {{ $P.themeColor.light }}; +$body_scrollbar_overlay: {{ .P.bodyScrollbar.overlay }}; +$body_scrollbar_stable: {{ .P.bodyScrollbar.stable }}; +$mermaid_enable: {{ .P.mermaid.enable }}; +$mobile_layout_economy: {{ .P.mobileLayoutEconomy }}; +$theme_color_dark: {{ .P.themeColor.dark }}; +$theme_color_light: {{ .P.themeColor.light }}; // Header -$bookmark_color: {{ $P.bookmark.color }}; -$bookmark_enable: {{ $P.bookmark.enable }}; -$github_banner_enable: {{ $P.githubBanner.enable }}; -$menu_settings_badges: {{ $P.menuSets.badges }}; +$bookmark_color: {{ .P.bookmark.color }}; +$bookmark_enable: {{ .P.bookmark.enable }}; +$github_banner_enable: {{ .P.githubBanner.enable }}; +$menu_settings_badges: {{ .P.menuSets.badges }}; // Footer -$footer_icon_color: {{ $P.footer.icon.color }}; -$footer_icon_animated: {{ $P.footer.icon.animated }}; -$footer_beian_enable: {{ $P.footer.beian.enable }}; +$footer_icon_color: {{ .P.footer.icon.color }}; +$footer_icon_animated: {{ .P.footer.icon.animated }}; +$footer_beian_enable: {{ .P.footer.beian.enable }}; // Counter -$busuanzi_enable: {{ $P.busuanzi.enable }}; -$busuanzi_visitors: {{ $P.busuanzi.visitors }}; -$busuanzi_views: {{ $P.busuanzi.views }}; -$busuanzi_post_views: {{ $P.busuanzi.postViews }}; +$busuanzi_enable: {{ .P.busuanzi.enable }}; +$busuanzi_visitors: {{ .P.busuanzi.visitors }}; +$busuanzi_views: {{ .P.busuanzi.views }}; +$busuanzi_post_views: {{ .P.busuanzi.postViews }}; // Font -$font_enable: {{ $P.font.enable }}; -$font_global_size: {{ default $P.font.global.size 1 }}; -$font_headings_size: {{ default $P.font.headings.size 1.625 }}; -$font_title_size: {{ default $P.font.title.size 1.375 }}; +$font_enable: {{ .P.font.enable }}; +$font_global_size: {{ default .P.font.global.size 1 }}; +$font_headings_size: {{ default .P.font.headings.size 1.625 }}; +$font_title_size: {{ default .P.font.title.size 1.375 }}; // Code & Code blocks // TODO find the configure variable @@ -44,88 +42,88 @@ $highlight_dark_foreground: #222; $highlight_light_background: #000; $highlight_light_foreground: #222; -$codeblock_copy_btn_style: {{ $P.codeblock.copyBtn.style }}; +$codeblock_copy_btn_style: {{ .P.codeblock.copyBtn.style }}; // Sidebar -$sidebar_offset: {{ $P.sidebar.offset }}; -$sidebar_padding: {{ $P.sidebar.padding }}; -$sidebar_position: {{ $P.sidebar.position }}; -$sidebar_width: {{ $P.sidebar.width }}; +$sidebar_offset: {{ .P.sidebar.offset }}; +$sidebar_padding: {{ .P.sidebar.padding }}; +$sidebar_position: {{ .P.sidebar.position }}; +$sidebar_width: {{ .P.sidebar.width }}; -$motion_enable: {{ $P.motion.enable }}; -$motion_transition_sidebar: {{ $P.motion.transition.sidebar }}; +$motion_enable: {{ .P.motion.enable }}; +$motion_transition_sidebar: {{ .P.motion.transition.sidebar }}; -$back2top_enable: {{ $P.backTop.enable }}; -$back2top_scrollpercent: {{ $P.backTop.scrollpercent }}; -$back2top_sidebar: {{ $P.backTop.sidebar }}; +$back2top_enable: {{ .P.backTop.enable }}; +$back2top_scrollpercent: {{ .P.backTop.scrollpercent }}; +$back2top_sidebar: {{ .P.backTop.sidebar }}; -$avatar_rotated: {{ $P.avatar.rotated }}; -$avatar_rounded: {{ $P.avatar.rounded }}; -$avatar_rounded: {{ $P.avatar.rounded }}; -$site_state: {{ $P.siteState }}; -$social_icons_only: {{ $P.socialIcons.iconsOnly }}; -$social_icons_transition: {{ $P.socialIcons.transition }}; -$links_settings_layout: {{ $P.linksSets.layout }}; -$toc_enable: {{ $P.toc.enable }}; -$toc_expand_all: {{ $P.toc.expandAll }}; -$toc_wrap: {{ $P.toc.wrap }}; +$avatar_rotated: {{ .P.avatar.rotated }}; +$avatar_rounded: {{ .P.avatar.rounded }}; +$avatar_rounded: {{ .P.avatar.rounded }}; +$site_state: {{ .P.siteState }}; +$social_icons_only: {{ .P.socialIcons.iconsOnly }}; +$social_icons_transition: {{ .P.socialIcons.transition }}; +$links_settings_layout: {{ .P.linksSets.layout }}; +$toc_enable: {{ .P.toc.enable }}; +$toc_expand_all: {{ .P.toc.expandAll }}; +$toc_wrap: {{ .P.toc.wrap }}; // Posts -$creative_commons_post: {{ $P.creativeCommons.post }}; -$follow_me: {{ isset $P "followMe" }}; -$motion_trans_coll_header: {{ $P.motion.transition.collHeader }}; -$motion_trans_post_block: {{ $P.motion.transition.postBlock }}; -$motion_trans_post_body: {{ $P.motion.transition.postBody }}; -$motion_trans_post_header: {{ $P.motion.transition.postHeader }}; -$post_edit_enable: {{ $P.postEdit.enable }}; -$post_meta_item_text: {{ $P.postMeta.itemText }}; -$reward_settings_animation: {{ $P.rewardSets.animation }}; +$creative_commons_post: {{ .P.creativeCommons.post }}; +$follow_me: {{ isset .P "followMe" }}; +$motion_trans_coll_header: {{ .P.motion.transition.collHeader }}; +$motion_trans_post_block: {{ .P.motion.transition.postBlock }}; +$motion_trans_post_body: {{ .P.motion.transition.postBody }}; +$motion_trans_post_header: {{ .P.motion.transition.postHeader }}; +$post_edit_enable: {{ .P.postEdit.enable }}; +$post_meta_item_text: {{ .P.postMeta.itemText }}; +$reward_settings_animation: {{ .P.rewardSets.animation }}; // TODO find the paramters $text_align_desktop: center; $text_align_mobile: center; // Note -$note_icons: {{ $P.note.icons }}; -$note_light_bg_offset: {{ $P.note.lightBgOffset }}; -$note_style: {{ $P.note.style }}; +$note_icons: {{ .P.note.icons }}; +$note_light_bg_offset: {{ .P.note.lightBgOffset }}; +$note_style: {{ .P.note.style }}; // Tabs -$tabs_transition_labels: {{ $P.tabs.transition.labels }}; -$tabs_transition_tabs: {{ $P.tabs.transition.tabs }}; +$tabs_transition_labels: {{ .P.tabs.transition.labels }}; +$tabs_transition_tabs: {{ .P.tabs.transition.tabs }}; // Reading progress bar -$reading_progress_start: {{ $P.readingProgress.start }}; -$reading_progress_color: {{ $P.readingProgress.color }}; -$reading_progress_enable: {{ $P.readingProgress.enable }}; -$reading_progress_height: {{ $P.readingProgress.height }}; -$reading_progress_position: {{ $P.readingProgress.position }}; -$reading_progress_reversed: {{ $P.readingProgress.reversed }}; +$reading_progress_start: {{ .P.readingProgress.start }}; +$reading_progress_color: {{ .P.readingProgress.color }}; +$reading_progress_enable: {{ .P.readingProgress.enable }}; +$reading_progress_height: {{ .P.readingProgress.height }}; +$reading_progress_position: {{ .P.readingProgress.position }}; +$reading_progress_reversed: {{ .P.readingProgress.reversed }}; // Thirdparty -$math_mathjax_enable: {{ $P.math.mathjax.enable }}; -$related_posts_enable: {{ $P.relatedPosts.enable }}; -$pdf_enable: {{ $P.pdf.enable }}; -$pdf_height: {{ $P.pdf.height }}; +$math_mathjax_enable: {{ .P.math.mathjax.enable }}; +$related_posts_enable: {{ .P.relatedPosts.enable }}; +$pdf_enable: {{ .P.pdf.enable }}; +$pdf_height: {{ .P.pdf.height }}; // Search engine -$algolia_search_enable: {{ $P.algoliaSearch.enable }}; -$local_search_enable: {{ $P.localSearch.enable }}; +$algolia_search_enable: {{ .P.algoliaSearch.enable }}; +$local_search_enable: {{ .P.localSearch.enable }}; // Online IM -$gitalk_enable: {{ $P.gitalk.enable }}; -$gitter_enable: {{ $P.gitter.enable }}; +$gitalk_enable: {{ .P.gitalk.enable }}; +$gitter_enable: {{ .P.gitter.enable }}; // Comment -$disqusjs_enable: {{ $P.disqusjs.enable }}; -$utterances_enable: {{ $P.utterances.enable }}; +$disqusjs_enable: {{ .P.disqusjs.enable }}; +$utterances_enable: {{ .P.utterances.enable }}; // // Variables Layer // -------------------------------------------------- @import '_variables/base'; -{{ printf "/* %s Scheme Style */" $P.scheme }} -{{ printf "@import '_variables/%s';" $P.scheme }} +{{ printf "/* %s Scheme Style */" .P.scheme }} +{{ printf "@import '_variables/%s';" .P.scheme }} // TODO //@import 'theme.injects.variable'; @@ -153,7 +151,7 @@ $utterances_enable: {{ $P.utterances.enable }}; // Schemes Layer // -------------------------------------------------- -{{ printf "@import '_schemes/%s/';" $P.scheme }} +{{ printf "@import '_schemes/%s/';" .P.scheme }} // Custom Layer // TODO diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index f4e2bd1..61afb54 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -8,6 +8,21 @@ baseURL: / theme: hugo-theme-next +defaultContentLanguage: zh-cn +languages: + zh-cn: + title: NexT + languageName: 中文 + weight: 1 + en-us: + title: NexT + languageName: English + weight: 2 + params: + author: Theme NexT + subtitle: Theme for Hugo + description: Stay easily & powerful. + params: # --------------------------------------------------------------- # Theme Core Configuration Settings @@ -15,15 +30,15 @@ params: # --------------------------------------------------------------- # Allow to cache content generation. - cache: - enable: true + #cache: + # enable: true # Remove unnecessary files after hexo generate. - minify: false + # minify: false # Define custom file paths. # Create your custom files in site directory `source/_data` and uncomment needed files below. - custom_file_path: + customFilePath: #head: source/_data/head.njk #header: source/_data/header.njk #sidebar: source/_data/sidebar.njk @@ -47,22 +62,27 @@ params: scheme: Gemini # Dark Mode - darkmode: false + darkmode: true # --------------------------------------------------------------- # Site Information Settings # --------------------------------------------------------------- + author: NexT 主题 + subtitle: 为 Hugo 打造的主题 + description: 保持简单的易用性和强大的功能。 favicon: - small: /images/favicon-16x16-next.png - medium: /images/favicon-32x32-next.png - apple_touch_icon: /images/apple-touch-icon-next.png - safari_pinned_tab: /images/logo.svg + icon: /imgs/icons/favicon.ico + small: /imgs/icons/favicon_16x16_next.png + medium: /imgs/icons/favicon_32_32_next.png + appleTouchIcon: /imgs/icons/apple_touch_icon_next.png #android_manifest: /manifest.json # Custom Logo (Warning: Do not support scheme Mist) - custom_logo: #/uploads/custom-logo.jpg + customLogo: + show: false + url: /imgs/hugo_next_logo.png # Creative Commons 4.0 International License. # See: https://creativecommons.org/about/cclicenses/ @@ -75,20 +95,21 @@ params: post: false # You can set a language value if you prefer a translated version of CC license, e.g. deed.zh # CC licenses are available in 39 languages, you can find the specific and correct abbreviation you need on https://creativecommons.org - language: + # language: # Open graph settings # See: https://hexo.io/docs/helpers#open-graph - open_graph: + openGraph: enable: true - options: - #twitter_card: - #twitter_id: - #twitter_site: - #twitter_image: - #google_plus: - #fb_admins: - #fb_app_id: + # twitter: + # card: + # creator: + # image: + # site: + # googlePlus: + # facebook: + # admins: + # app_id: # --------------------------------------------------------------- @@ -483,19 +504,19 @@ params: # Google Webmaster tools verification. # See: https://developers.google.com/search - google_site_verification: + googleSiteVerification: 5AUIVYTbHIAuz-eQtxSfZbWW5eg9_EVZMSQycIuXrG0 # Bing Webmaster tools verification. # See: https://www.bing.com/webmasters - bing_site_verification: + bingSiteVerification: # Yandex Webmaster tools verification. # See: https://webmaster.yandex.ru - yandex_site_verification: + yandexSiteVerification: # Baidu Webmaster tools verification. # See: https://ziyuan.baidu.com/site - baidu_site_verification: + baiduSiteVerification: # --------------------------------------------------------------- @@ -845,7 +866,7 @@ params: # Use Animate.css to animate everything. # For more information: https://animate.style motion: - enable: true + enable: false async: false transition: # All available transition variants: https://theme-next.js.org/animate/ diff --git a/exampleSite/start.sh b/exampleSite/start.sh new file mode 100644 index 0000000..cecf594 --- /dev/null +++ b/exampleSite/start.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# + +next() { + cat << EOT +======================================== + ███╗ ██╗███████╗██╗ ██╗████████╗ + ████╗ ██║██╔════╝╚██╗██╔╝╚══██╔══╝ + ██╔██╗ ██║█████╗ ╚███╔╝ ██║ + ██║╚██╗██║██╔══╝ ██╔██╗ ██║ + ██║ ╚████║███████╗██╔╝ ██╗ ██║ + ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝ +======================================== +NexT version $1 +Documentation: https://hugo-next.js.org +======================================== +EOT +} + +next V0.0.1 + +hugo server -D -t ../.. --port 1414 \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5f8e2ec..170bd74 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,11 +1,47 @@ +{{- $P := .Site.Params -}} +{{- $lang := replaceRE "-([a-z]+)" (upper (substr .Site.Language -3)) .Site.Language -}} +{{- .Scratch.Set "lang" $lang -}} - - {{- partial "head.html" . -}} - - {{- partial "header.html" . -}} -
- {{- block "main" . }}{{- end }} -
- {{- partial "footer.html" . -}} - - + + + + + + + + + + + + {{- partial "head.html" (dict "P" $P "Page" .Page "Scratch" .Scratch) }} + {{ .Title | default .Site.Title }} + + + + +
+
+
+
+ {{- partial "header" . }} +
+ + {{- if ne $P.sidebar.display "remove" }} + {{- end }} +
+ +
+ + {{- block "main" . }}{{- end }} +
+
+
+ +
+ + + \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 8aa3ce8..b359767 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,4 +1,2 @@ -{{- $scss := resources.Get "css/main.scss" }} -{{- $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }} -{{- $css := $scss | toCSS (dict "targetPath" "/css/main.css" "outputStyle" "expanded") }} - \ No newline at end of file +{{- partial "head/meta" . }} +{{- partial "head/style" . }} \ No newline at end of file diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html new file mode 100644 index 0000000..0bd0ce6 --- /dev/null +++ b/layouts/partials/head/meta.html @@ -0,0 +1,48 @@ +{{- if .P.darkmode }} + +{{- else }} + +{{- end }} +{{- if .P.googleSiteVerification }} + +{{- end }} +{{- with .P.bingSiteVerification }} + +{{- end }} +{{- with .P.yandexSiteVerification }} + +{{- end }} +{{- with .P.baiduSiteVerification }} + +{{- end }} +{{- $lang := .Scratch.Get "lang" }} +{{- $P := .P }} +{{- $Page := .Page }} +{{- with $P.openGraph }} +{{- if .enable }} + + + + + + + + +{{- with .twitter }} +{{- range $attr, $val := . }} + +{{- end }} +{{- end }} + +{{- with .googlePlus }} + +{{- end }} + +{{- with .facebook }} +{{- range $attr, $val := . }} + +{{- end }} +{{- end }} + +{{- end }} +{{- end }} diff --git a/layouts/partials/head/style.html b/layouts/partials/head/style.html new file mode 100644 index 0000000..d80bc48 --- /dev/null +++ b/layouts/partials/head/style.html @@ -0,0 +1,7 @@ + + +{{- $scss := resources.Get "css/main.scss" }} +{{- $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }} +{{- $css := $scss | toCSS (dict "targetPath" "/css/main.css" "outputStyle" "expanded") }} + + \ No newline at end of file diff --git a/static/css/noscript.css b/static/css/noscript.css new file mode 100644 index 0000000..4b8e8bd --- /dev/null +++ b/static/css/noscript.css @@ -0,0 +1,30 @@ +body { margin-top: 2rem; } + +.use-motion .menu-item, +.use-motion .sidebar, +.use-motion .post-block, +.use-motion .pagination, +.use-motion .comments, +.use-motion .post-header, +.use-motion .post-body, +.use-motion .collection-header { + visibility: visible; +} + +.use-motion header.header, +.use-motion .site-brand-container .toggle, +.use-motion .footer { opacity: initial; } + +.use-motion .site-title, +.use-motion .site-subtitle, +.use-motion .custom-logo-image { + opacity: initial; + top: initial; +} + +.use-motion .logo-line { + transform: scaleX(1); +} + +.search-pop-overlay, .sidebar-nav { display: none; } +.sidebar-panel { display: block; } \ No newline at end of file From 09ff24c8c681ac76db8185ad6e52522cf0248841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Tue, 24 May 2022 19:14:49 +0800 Subject: [PATCH 02/36] :art: Use YAML style replace of TOML style make more simple. --- i18n/en-us.toml | 49 ------------------------------------------------- i18n/en-us.yaml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ i18n/zh-cn.toml | 49 ------------------------------------------------- i18n/zh-cn.yaml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 98 deletions(-) delete mode 100644 i18n/en-us.toml create mode 100644 i18n/en-us.yaml delete mode 100644 i18n/zh-cn.toml create mode 100644 i18n/zh-cn.yaml diff --git a/i18n/en-us.toml b/i18n/en-us.toml deleted file mode 100644 index a162721..0000000 --- a/i18n/en-us.toml +++ /dev/null @@ -1,49 +0,0 @@ -#-------------------------------------- -# English Version -#-------------------------------------- - -[ColoneFlag] - other = ":" - -[SitePostsTitle] - other = "Posts" -[SiteCatesTitle] - other = "Categories" -[SiteTagsTitle] - other = "Tags" -[TableOfContents] - other = "TOC" -[SiteInfo] - other = "Site Info" -[RSSTitle] - other = "RSS Subscribe" -[CCLinkTitle] - other = "Creative Commons" - -[PostPublishDate] - other = "Publish" -[PostPublishTime] - other = "Create Time" -[PostLastModDate] - other = "Update" -[PostLastModTime] - other = "Modify Time" -[PostWords] - other = "Words" -[PostWordCount] - other = "{{- .WordCount -}}" -[PostReading] - other = "Read" -[PostReadTime] - other = "{{- .ReadingTime -}}min" -[PostVisitor] - other = "Views" -[PostCatg] - other = "Categories" -[PostTag] - other = "Tags" -[PostReadMore] - other = "Read More" - -[FooterPowerby] - other = "Power by %s" \ No newline at end of file diff --git a/i18n/en-us.yaml b/i18n/en-us.yaml new file mode 100644 index 0000000..a46d760 --- /dev/null +++ b/i18n/en-us.yaml @@ -0,0 +1,49 @@ +#-------------------------------------- +# English Version +#-------------------------------------- + +ColoneFlag: + other: ":" + +SitePostsTitle: + other: "Posts" +SiteCatesTitle: + other: "Categories" +SiteTagsTitle: + other: "Tags" +TableOfContents: + other: "TOC" +SiteInfo: + other: "Site Info" +RSSTitle: + other: "RSS Subscribe" +CCLinkTitle: + other: "Creative Commons" + +PostPublishDate: + other: "Publish" +PostPublishTime: + other: "Create Time" +PostLastModDate: + other: "Update" +PostLastModTime: + other: "Modify Time" +PostWords: + other: "Words" +PostWordCount: + other: "{{- .WordCount -}}" +PostReading: + other: "Read" +PostReadTime: + other: "{{- .ReadingTime -}}min" +PostVisitor: + other: "Views" +PostCatg: + other: "Categories" +PostTag: + other: "Tags" +PostReadMore: + other: "Read More" + +FooterPowerby: + other: "Power by %s" \ No newline at end of file diff --git a/i18n/zh-cn.toml b/i18n/zh-cn.toml deleted file mode 100644 index 63d0942..0000000 --- a/i18n/zh-cn.toml +++ /dev/null @@ -1,49 +0,0 @@ -#-------------------------------------- -# 中文版本 -#-------------------------------------- - -[ColoneFlag] - other = ":" - -[SitePostsTitle] - other = "日志" -[SiteCatesTitle] - other = "分类" -[SiteTagsTitle] - other = "标签" -[TableOfContents] - other = "文章目录" -[SiteInfo] - other = "站点概览" -[RSSTitle] - other = "RSS 订阅" -[CCLinkTitle] - other = "共享知识" - -[PostPublishDate] - other = "发表于" -[PostPublishTime] - other = "创建时间" -[PostLastModDate] - other = "更新于" -[PostLastModTime] - other = "修改时间" -[PostWords] - other = "字数" -[PostWordCount] - other = "{{- .WordCount -}}" -[PostReading] - other = "阅读" -[PostReadTime] - other = "{{- .ReadingTime -}}分钟" -[PostVisitor] - other = "浏览数" -[PostCatg] - other = "分类" -[PostTag] - other = "标签" -[PostReadMore] - other = "阅读全文" - -[FooterPowerby] - other = "由 %s 强力驱动" \ No newline at end of file diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml new file mode 100644 index 0000000..0a702e0 --- /dev/null +++ b/i18n/zh-cn.yaml @@ -0,0 +1,49 @@ +#-------------------------------------- +# 中文版本 +#-------------------------------------- + +ColoneFlag: + other: ":" + +SitePostsTitle: + other: "日志" +SiteCatesTitle: + other: "分类" +SiteTagsTitle: + other: "标签" +TableOfContents: + other: "文章目录" +SiteInfo: + other: "站点概览" +RSSTitle: + other: "RSS 订阅" +CCLinkTitle: + other: "共享知识" + +PostPublishDate: + other: "发表于" +PostPublishTime: + other: "创建时间" +PostLastModDate: + other: "更新于" +PostLastModTime: + other: "修改时间" +PostWords: + other: "字数" +PostWordCount: + other: "{{- .WordCount -}}" +PostReading: + other: "阅读" +PostReadTime: + other: "{{- .ReadingTime -}}分钟" +PostVisitor: + other: "浏览数" +PostCatg: + other: "分类" +PostTag: + other: "标签" +PostReadMore: + other: "阅读全文" + +FooterPowerby: + other: "由 %s 强力驱动" \ No newline at end of file From 71dfdb845df0517a8c26caad2ada54e67d51fd62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Tue, 24 May 2022 21:30:08 +0800 Subject: [PATCH 03/36] :construction_worker: Finish dynamic CSS CDN service with different vendor. --- data/resources.yaml | 27 +++++++++++++++++++++++++++ exampleSite/config.yaml | 2 +- layouts/partials/head/style.html | 22 ++++++++++++++++++++-- 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 data/resources.yaml diff --git a/data/resources.yaml b/data/resources.yaml new file mode 100644 index 0000000..4b5fb64 --- /dev/null +++ b/data/resources.yaml @@ -0,0 +1,27 @@ +# Public CDN vender list +# +vendors: { + "cdnjs": "//cdnjs.cloudflare.com/ajax/libs/${name}/${version}/${file}", + "unpkg": "//unpkg.com/${name}@${version}/${file}" +} + +# Javascript Resources +# +js: + - name: anime + version: 3.2.1 + file: lib/anime.min.js + - name: mathjax + version: 3.2.0 + file: es5/tex-mml-chtml.js + +# CSS Resources +# +css: + - name: '@fortawesome/fontawesome-free' + version: 6.1.1 + file: css/all.min.css + alias: font-awesome + - name: animate.css + version: 3.1.1 + file: animate.min.css \ No newline at end of file diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 61afb54..f67a226 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -911,7 +911,7 @@ params: # The default CDN provider of third-party plugins. # Available values: local | jsdelivr | unpkg | cdnjs | custom # Dependencies for `plugins: local`: https://github.com/next-theme/plugins - plugins: jsdelivr + plugins: unpkg # Custom CDN URL # For example: # custom_cdn_url: https://cdn.jsdelivr.net/npm/${npm_name}@${version}/${minified} diff --git a/layouts/partials/head/style.html b/layouts/partials/head/style.html index d80bc48..0f7466e 100644 --- a/layouts/partials/head/style.html +++ b/layouts/partials/head/style.html @@ -1,5 +1,23 @@ - - +{{- $vendors := .Page.Site.Data.resources.vendors }} +{{- $pluginVen := .P.vendors.plugins }} +{{- $pluginCDN := index $vendors $pluginVen }} + +{{- $cssRes := .Page.Site.Data.resources.css }} +{{- range $css := $cssRes }} + {{- $npm := $css.name }} + {{- $file := $css.file }} + {{- if eq $pluginVen "cndjs" }} + {{- $npm = $.css.alias }} + {{ $file }} + {{- $file = replaceRE "(dist|lib|source\\/js)\\/" "" $css.file }} + {{- end }} + {{- $pluginCSS := $pluginCDN }} + {{- $pluginCSS = replace $pluginCSS "${name}" $npm }} + {{- $pluginCSS = replace $pluginCSS "${version}" $css.version }} + {{- $pluginCSS = replace $pluginCSS "${file}" $file }} + +{{- end }} + {{- $scss := resources.Get "css/main.scss" }} {{- $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }} {{- $css := $scss | toCSS (dict "targetPath" "/css/main.css" "outputStyle" "expanded") }} From 8de51043c3b5d75ba648649fdd3381c8055827f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Tue, 24 May 2022 21:39:45 +0800 Subject: [PATCH 04/36] :art: Formatter use more friendly code and style. --- layouts/_default/baseof.html | 2 +- layouts/partials/head/meta.html | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 170bd74..68721f4 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -7,7 +7,7 @@ - + {{ hugo.Generator }} diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html index 0bd0ce6..d5d7ea9 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -3,8 +3,8 @@ {{- else }} {{- end }} -{{- if .P.googleSiteVerification }} - +{{- with .P.googleSiteVerification }} + {{- end }} {{- with .P.bingSiteVerification }} @@ -23,11 +23,19 @@ + + + + + {{- if not $Page.IsHome }} + + + {{- end }} {{- with .twitter }} {{- range $attr, $val := . }} From 65c3289491da36e779b7e9bdf6176280ed2d8ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Tue, 24 May 2022 23:14:02 +0800 Subject: [PATCH 05/36] :construction_worker: Finish the left header brand coding. --- assets/css/_variables/base.scss | 8 +++++-- exampleSite/config.yaml | 6 ++--- i18n/en-us.yaml | 3 +++ i18n/zh-cn.yaml | 3 +++ layouts/_default/baseof.html | 2 +- layouts/partials/head/meta.html | 2 +- layouts/partials/header.html | 1 + layouts/partials/header/brand.html | 36 ++++++++++++++++++++++++++++++ 8 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 layouts/partials/header/brand.html diff --git a/assets/css/_variables/base.scss b/assets/css/_variables/base.scss index 0fcd2b7..26c1802 100644 --- a/assets/css/_variables/base.scss +++ b/assets/css/_variables/base.scss @@ -68,8 +68,12 @@ $card-bg-color-dark : $black-light; $menu-item-bg-color : $whitesmoke; $menu-item-bg-color-dark : $black-light; -$theme-color : convert($theme_color_light); -$theme-color-dark : convert($theme_color_dark); +// TODO why there need convert +//$theme-color : convert($theme_color_light); +//$theme-color-dark : convert($theme_color_dark); + +$theme-color : $theme_color_light; +$theme-color-dark : $theme_color_dark; // Typography // Font, line-height, and elements colors. diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index f67a226..2bc5678 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -80,9 +80,7 @@ params: #android_manifest: /manifest.json # Custom Logo (Warning: Do not support scheme Mist) - customLogo: - show: false - url: /imgs/hugo_next_logo.png + customLogo: #/imgs/hugo_next_logo.png # Creative Commons 4.0 International License. # See: https://creativecommons.org/about/cclicenses/ @@ -149,7 +147,7 @@ params: # Manual define the sidebar width. If commented, will be default for: # Muse | Mist: 320 # Pisces | Gemini: 240 - width: 300 + width: 240 # Sidebar Display (only for Muse | Mist), available values: # - post expand on posts automatically. Default. diff --git a/i18n/en-us.yaml b/i18n/en-us.yaml index a46d760..b4ca595 100644 --- a/i18n/en-us.yaml +++ b/i18n/en-us.yaml @@ -2,6 +2,9 @@ # English Version #-------------------------------------- +NavToggleLabel: + other: Toggle navigation bar + ColoneFlag: other: ":" diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index 0a702e0..7451151 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -2,6 +2,9 @@ # 中文版本 #-------------------------------------- +NavToggleLabel: + other: 切换导航栏 + ColoneFlag: other: ":" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 68721f4..9f96ec6 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -25,7 +25,7 @@
- {{- partial "header" . }} + {{- partial "header" (dict "P" $P "Page" .Page) }}
{{- if ne $P.sidebar.display "remove" }} diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html index d5d7ea9..b2a378f 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -27,7 +27,7 @@ - + diff --git a/layouts/partials/header.html b/layouts/partials/header.html index e69de29..bf3bd31 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -0,0 +1 @@ +{{ partial "header/brand" . }} \ No newline at end of file diff --git a/layouts/partials/header/brand.html b/layouts/partials/header/brand.html new file mode 100644 index 0000000..41450d8 --- /dev/null +++ b/layouts/partials/header/brand.html @@ -0,0 +1,36 @@ +{{ $title := .Page.Site.Title }} +
+ + +
+ {{- if and .P.customLogo (eq .P.scheme "Muse") }} + {{ $title }} + {{- end }} + + + +

{{ $title }}

+ +
+ {{ if isset .P "subtitle" }} +

{{ .P.subtitle }}

+ {{- end }} + {{- if and .P.customLogo (or (eq .P.scheme "Gemini") (eq .P.scheme "Pisces"))}} + {{ $title }} + {{- end }} +
+ + +
\ No newline at end of file From fc52303ad158aecd955ad75616c58a0669a5af26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Wed, 25 May 2022 11:02:05 +0800 Subject: [PATCH 06/36] :construction_worker: Add CDN vendor automatic switch by config setting. --- data/resources.yaml | 4 ++-- exampleSite/config.yaml | 2 +- layouts/_default/baseof.html | 8 +++++++- layouts/partials/head/style.html | 16 ++++++++-------- layouts/partials/scripts.html | 19 +++++++++++++++++++ 5 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 layouts/partials/scripts.html diff --git a/data/resources.yaml b/data/resources.yaml index 4b5fb64..88179ba 100644 --- a/data/resources.yaml +++ b/data/resources.yaml @@ -1,4 +1,4 @@ -# Public CDN vender list +# Public CDN vendor list # vendors: { "cdnjs": "//cdnjs.cloudflare.com/ajax/libs/${name}/${version}/${file}", @@ -8,7 +8,7 @@ vendors: { # Javascript Resources # js: - - name: anime + - name: animejs version: 3.2.1 file: lib/anime.min.js - name: mathjax diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 2bc5678..303616d 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -909,7 +909,7 @@ params: # The default CDN provider of third-party plugins. # Available values: local | jsdelivr | unpkg | cdnjs | custom # Dependencies for `plugins: local`: https://github.com/next-theme/plugins - plugins: unpkg + plugins: cdnjs # Custom CDN URL # For example: # custom_cdn_url: https://cdn.jsdelivr.net/npm/${npm_name}@${version}/${minified} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 9f96ec6..4f23cac 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,6 +1,10 @@ {{- $P := .Site.Params -}} {{- $lang := replaceRE "-([a-z]+)" (upper (substr .Site.Language -3)) .Site.Language -}} {{- .Scratch.Set "lang" $lang -}} +{{- $vendors := .Site.Data.resources.vendors -}} +{{- $pluginVen := $P.vendors.plugins -}} +{{- $pluginCDN := index $vendors $pluginVen -}} +{{- .Scratch.Set "pluginCDN" $pluginCDN -}} @@ -25,7 +29,7 @@
- {{- partial "header" (dict "P" $P "Page" .Page) }} + {{- partial "header" (dict "P" $P "Page" .Page "Scratch" .Scratch) }}
{{- if ne $P.sidebar.display "remove" }} @@ -42,6 +46,8 @@ {{- partial "footer" . }} + + {{- partial "scripts" (dict "P" $P "Page" .Page "Scratch" .Scratch) }} \ No newline at end of file diff --git a/layouts/partials/head/style.html b/layouts/partials/head/style.html index 0f7466e..7191eb9 100644 --- a/layouts/partials/head/style.html +++ b/layouts/partials/head/style.html @@ -1,17 +1,17 @@ -{{- $vendors := .Page.Site.Data.resources.vendors }} -{{- $pluginVen := .P.vendors.plugins }} -{{- $pluginCDN := index $vendors $pluginVen }} {{- $cssRes := .Page.Site.Data.resources.css }} +{{- $vendor := .P.vendors.plugins }} +{{- $vendorCDN := .Scratch.Get "pluginCDN" }} {{- range $css := $cssRes }} + {{- $pluginCSS := $vendorCDN }} {{- $npm := $css.name }} {{- $file := $css.file }} - {{- if eq $pluginVen "cndjs" }} - {{- $npm = $.css.alias }} - {{ $file }} - {{- $file = replaceRE "(dist|lib|source\\/js)\\/" "" $css.file }} + {{- if eq $vendor "cdnjs" }} + {{- with $css.alias }} + {{- $npm = . }} + {{- end }} + {{- $file = replaceRE `(dist|lib|source\/js)\/` "" $css.file }} {{- end }} - {{- $pluginCSS := $pluginCDN }} {{- $pluginCSS = replace $pluginCSS "${name}" $npm }} {{- $pluginCSS = replace $pluginCSS "${version}" $css.version }} {{- $pluginCSS = replace $pluginCSS "${file}" $file }} diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html new file mode 100644 index 0000000..d2d49bf --- /dev/null +++ b/layouts/partials/scripts.html @@ -0,0 +1,19 @@ + +{{- $jsRes := .Page.Site.Data.resources.js }} +{{- $vendor := .P.vendors.plugins }} +{{- $vendorCDN := .Scratch.Get "pluginCDN" }} +{{- range $js := $jsRes }} + {{- $pluginJS := $vendorCDN }} + {{- $npm := $js.name }} + {{- $file := $js.file }} + {{- if eq $vendor "cdnjs" }} + {{- with $js.alias }} + {{- $npm = . }} + {{- end }} + {{- $file = replaceRE `(dist|lib|source\/js)\/` "" $js.file }} + {{- end }} + {{- $pluginJS = replace $pluginJS "${name}" $npm }} + {{- $pluginJS = replace $pluginJS "${version}" $js.version }} + {{- $pluginJS = replace $pluginJS "${file}" $file }} + +{{- end }} \ No newline at end of file From cdbb3f751a08b208353d3ed190618796a78563b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Wed, 25 May 2022 15:44:10 +0800 Subject: [PATCH 07/36] :construction_worker: Add sidebar menu items. --- exampleSite/config.yaml | 38 ++++++++++++++++++++++++++---- i18n/en-us.yaml | 3 +++ i18n/zh-cn.yaml | 3 +++ layouts/_default/baseof.html | 2 ++ layouts/partials/header.html | 3 ++- layouts/partials/header/menus.html | 27 +++++++++++++++++++++ 6 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 layouts/partials/header/menus.html diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 303616d..bbcfea2 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -23,6 +23,34 @@ languages: subtitle: Theme for Hugo description: Stay easily & powerful. +#-------------------------------------- +# Menus Settings +# Attribute pre is Font Awesome icon name without prefix "fa-". +# External url should start with http:// or https:// . +# ------------------------------------- +menus: + main: + - identifier: home + name: 首页 + url: / + pre: home + weight: 1 + - identifier: about + name: 关于 + url: /ablout.html + pre: user + weight: 2 + - identifier: archives + name: 归档 + url: /archives + pre: archive + weight: 3 + - identifier: commonweal + name: 公益 404 + url: /404.html + pre: heartbeat + weight: 4 + params: # --------------------------------------------------------------- # Theme Core Configuration Settings @@ -118,7 +146,7 @@ params: # Key is the name of menu item. If the translation for this item is available, the translated text will be loaded, otherwise the Key name will be used. Key is case-sensitive. # Value before `||` delimiter is the target link, value after `||` delimiter is the name of Font Awesome icon. # External url should start with http:// or https:// - menu: + #menu: #home: / || fa fa-home #about: /about/ || fa fa-user #tags: /tags/ || fa fa-tags @@ -131,7 +159,7 @@ params: # Enable / Disable menu icons / item badges. menuSets: icons: true - badges: false + badges: true # --------------------------------------------------------------- @@ -766,7 +794,7 @@ params: # Local Search # Dependencies: https://github.com/next-theme/hexo-generator-searchdb localSearch: - enable: false + enable: true # If auto, trigger search by changing input. # If manual, trigger search by pressing enter key or search button. trigger: auto @@ -909,7 +937,7 @@ params: # The default CDN provider of third-party plugins. # Available values: local | jsdelivr | unpkg | cdnjs | custom # Dependencies for `plugins: local`: https://github.com/next-theme/plugins - plugins: cdnjs + plugins: unpkg # Custom CDN URL # For example: # custom_cdn_url: https://cdn.jsdelivr.net/npm/${npm_name}@${version}/${minified} @@ -921,6 +949,6 @@ params: # The js option is only valid when vendors.internal is local. css: css js: js - images: images + images: imgs diff --git a/i18n/en-us.yaml b/i18n/en-us.yaml index b4ca595..2904657 100644 --- a/i18n/en-us.yaml +++ b/i18n/en-us.yaml @@ -5,6 +5,9 @@ NavToggleLabel: other: Toggle navigation bar +MSearchLabel: + other: Search + ColoneFlag: other: ":" diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index 7451151..49b2eb5 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -5,6 +5,9 @@ NavToggleLabel: other: 切换导航栏 +MSearchLabel: + other: 搜索 + ColoneFlag: other: ":" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 4f23cac..7bb5e52 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -5,6 +5,8 @@ {{- $pluginVen := $P.vendors.plugins -}} {{- $pluginCDN := index $vendors $pluginVen -}} {{- .Scratch.Set "pluginCDN" $pluginCDN -}} +{{ $posts := len .Site.RegularPages }} +{{- .Scratch.Set "posts" $posts -}} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index bf3bd31..cda1966 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1 +1,2 @@ -{{ partial "header/brand" . }} \ No newline at end of file +{{ partial "header/brand" . }} +{{ partial "header/menus" . }} \ No newline at end of file diff --git a/layouts/partials/header/menus.html b/layouts/partials/header/menus.html new file mode 100644 index 0000000..ba85a69 --- /dev/null +++ b/layouts/partials/header/menus.html @@ -0,0 +1,27 @@ +{{- $ms := .P.menuSets }} +{{- $curP := .Page }} +{{- $post := .Scratch.Get "posts" }} + \ No newline at end of file From f56f229bd78df7b7e297c1a8fee03db7aaf14899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Fri, 27 May 2022 16:25:56 +0800 Subject: [PATCH 08/36] :construction_worker: Add sidebar site overview content. --- assets/css/_common/outline/sidebar/index.scss | 3 + .../outline/sidebar/sidebar-author-links.scss | 2 +- .../_common/outline/sidebar/site-state.scss | 7 ++ assets/css/_schemes/Muse/_sidebar.scss | 2 +- assets/css/_schemes/Pisces/_sidebar.scss | 4 +- data/resources.yaml | 8 +- exampleSite/config.yaml | 39 +++++--- exampleSite/content/hello-world.md | 6 +- i18n/zh-cn.yaml | 12 ++- layouts/_default/baseof.html | 1 + layouts/partials/sidebar.html | 37 ++++++++ layouts/partials/sidebar/navtoc.html | 0 layouts/partials/sidebar/overview.html | 94 +++++++++++++++++++ 13 files changed, 184 insertions(+), 31 deletions(-) create mode 100644 layouts/partials/sidebar.html create mode 100644 layouts/partials/sidebar/navtoc.html create mode 100644 layouts/partials/sidebar/overview.html diff --git a/assets/css/_common/outline/sidebar/index.scss b/assets/css/_common/outline/sidebar/index.scss index d74ca3f..0fe80e5 100644 --- a/assets/css/_common/outline/sidebar/index.scss +++ b/assets/css/_common/outline/sidebar/index.scss @@ -13,6 +13,9 @@ } .cc-license { + + margin-top: 6px; + .cc-opacity { border-bottom: 0; opacity: .7; diff --git a/assets/css/_common/outline/sidebar/sidebar-author-links.scss b/assets/css/_common/outline/sidebar/sidebar-author-links.scss index 3479984..f065881 100644 --- a/assets/css/_common/outline/sidebar/sidebar-author-links.scss +++ b/assets/css/_common/outline/sidebar/sidebar-author-links.scss @@ -1,4 +1,4 @@ -.links-of-author { +.links-of-author, .links-of-social { a { font-size: $font-size-smaller; } diff --git a/assets/css/_common/outline/sidebar/site-state.scss b/assets/css/_common/outline/sidebar/site-state.scss index 08068e8..9958eb2 100644 --- a/assets/css/_common/outline/sidebar/site-state.scss +++ b/assets/css/_common/outline/sidebar/site-state.scss @@ -8,6 +8,11 @@ // Fix issue #103 // The click area of the link becomes smaller padding: 0 15px; + border-left: 1px solid #eee; + + &:first-child { + border-left: none; + } a { border-bottom: 0; @@ -15,6 +20,8 @@ } } + + .site-state-item-count { display: block; font-size: $site-state-item-count-font-size; diff --git a/assets/css/_schemes/Muse/_sidebar.scss b/assets/css/_schemes/Muse/_sidebar.scss index 27aff87..464a8c5 100644 --- a/assets/css/_schemes/Muse/_sidebar.scss +++ b/assets/css/_schemes/Muse/_sidebar.scss @@ -51,7 +51,7 @@ } } -.links-of-author { +.links-of-author, .links-of-social { &:not(:first-child) { margin-top: 15px; } diff --git a/assets/css/_schemes/Pisces/_sidebar.scss b/assets/css/_schemes/Pisces/_sidebar.scss index be53aa0..c8a5715 100644 --- a/assets/css/_schemes/Pisces/_sidebar.scss +++ b/assets/css/_schemes/Pisces/_sidebar.scss @@ -49,11 +49,11 @@ } } -.links-of-author { +.links-of-author, .links-of-social { @include flex-wrap(); } -.links-of-author-item { +.links-of-author-item, .links-of-social-item { @include sidebar-inline-links-item(); @if not $social_icons_only { diff --git a/data/resources.yaml b/data/resources.yaml index 88179ba..f7c4ac1 100644 --- a/data/resources.yaml +++ b/data/resources.yaml @@ -1,9 +1,9 @@ # Public CDN vendor list # -vendors: { - "cdnjs": "//cdnjs.cloudflare.com/ajax/libs/${name}/${version}/${file}", - "unpkg": "//unpkg.com/${name}@${version}/${file}" -} +vendors: + cdnjs: "//cdnjs.cloudflare.com/ajax/libs/${name}/${version}/${file}" + unpkg: "//unpkg.com/${name}@${version}/${file}" + # Javascript Resources # diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index bbcfea2..e0247c2 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -116,8 +116,8 @@ params: # Available values: by | by-nc | by-nc-nd | by-nc-sa | by-nd | by-sa | cc-zero license: by-nc-sa # Available values: big | small - size: small - sidebar: false + size: big + sidebar: true post: false # You can set a language value if you prefer a translated version of CC license, e.g. deed.zh # CC licenses are available in 39 languages, you can find the specific and correct abbreviation you need on https://creativecommons.org @@ -175,7 +175,7 @@ params: # Manual define the sidebar width. If commented, will be default for: # Muse | Mist: 320 # Pisces | Gemini: 240 - width: 240 + width: 256 # Sidebar Display (only for Muse | Mist), available values: # - post expand on posts automatically. Default. @@ -192,11 +192,11 @@ params: # Sidebar Avatar avatar: # Replace the default image and set the url here. - url: #/images/avatar.gif + url: /imgs/hugo_next_avatar.png # If true, the avatar will be displayed in circle. - rounded: false + rounded: true # If true, the avatar will be rotated with the cursor. - rotated: false + rotated: true # Posts / Categories / Tags in sidebar. siteState: true @@ -205,10 +205,18 @@ params: # Usage: `Key: permalink || icon` # Key is the link label showing to end users. # Value before `||` delimiter is the target permalink, value after `||` delimiter is the name of Font Awesome icon. - social: - #GitHub: https://github.com/yourname || fab fa-github - #E-Mail: mailto:yourname@gmail.com || fa fa-envelope - #Weibo: https://weibo.com/yourname || fab fa-weibo + socials: + # - name: GitHub + # icon: fab fa-github + # url: https://github.com/yourname + # weight: 1 + # - name: 微博 + # icon: fab fa-weibo + # url: https://weibo.com/yourname + # weight: 2 + social0: Github || https://github.com/elkan1788 || fab fa-github + #social1: E-Mail || mailto:yourname@gmail.com || fa fa-envelope + social2: 知乎 || https://www.zhihu.com/people/lisenhui || fa fa-book #Google: https://plus.google.com/yourname || fab fa-google #Twitter: https://twitter.com/yourname || fab fa-twitter #FB Page: https://www.facebook.com/yourname || fab fa-facebook @@ -220,17 +228,18 @@ params: socialIcons: enable: true iconsOnly: false - transition: false + transition: true # Blog rolls linksSets: icon: fa fa-globe - title: Links + title: 友情链接 # Available values: block | inline - layout: block + layout: inline - links: - #Title: https://example.com + links: + link0: Hugo-NexT || https://gitee.com/hugo-next/hugo-theme-next + link1: 凡梦星尘空间站 || https://lisenhui.cn # Table of Contents in the Sidebar # Front-matter variable (nonsupport wrap expand_all). diff --git a/exampleSite/content/hello-world.md b/exampleSite/content/hello-world.md index a34ef48..6597354 100644 --- a/exampleSite/content/hello-world.md +++ b/exampleSite/content/hello-world.md @@ -10,10 +10,10 @@ publishDate: '2022-05-21T17:06:24+08:00' weight: 1 categories: - - + - Blog tags: - - - - + - Hugo + - Startup toc: false draft: true diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index 49b2eb5..d2200f5 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -11,20 +11,22 @@ MSearchLabel: ColoneFlag: other: ":" -SitePostsTitle: +SbPostsLable: other: "日志" -SiteCatesTitle: +SbCatesTitle: other: "分类" -SiteTagsTitle: +SbTagsTitle: other: "标签" TableOfContents: other: "文章目录" -SiteInfo: +SiteOverview: other: "站点概览" -RSSTitle: +RSSLable: other: "RSS 订阅" CCLinkTitle: other: "共享知识" +BackTop: + other: "返回顶部" PostPublishDate: other: "发表于" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 7bb5e52..65af36d 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -35,6 +35,7 @@ {{- if ne $P.sidebar.display "remove" }} + {{- partial "sidebar" (dict "P" $P "Page" .Page "Scratch" .Scratch) }} {{- end }}
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html new file mode 100644 index 0000000..0b4818c --- /dev/null +++ b/layouts/partials/sidebar.html @@ -0,0 +1,37 @@ + + + \ No newline at end of file diff --git a/layouts/partials/sidebar/navtoc.html b/layouts/partials/sidebar/navtoc.html new file mode 100644 index 0000000..e69de29 diff --git a/layouts/partials/sidebar/overview.html b/layouts/partials/sidebar/overview.html new file mode 100644 index 0000000..954ab17 --- /dev/null +++ b/layouts/partials/sidebar/overview.html @@ -0,0 +1,94 @@ +{{- $author := .P.author }} +{{- $Site := .Page.Site }} + + +{{- if .P.siteState }} + +{{- end }} +{{- if and .P.chat.enable (or (or .P.chatra.enable .P.tidio.enable) .P.gitter.enable) }} + +{{- end }} + + +{{- $lang := .Scratch.Get "lang" }} +{{- with .P.creativeCommons }} +{{- if .sidebar }} + +{{- end }} +{{- end }} + +{{- if .P.links }} + +{{- end }} \ No newline at end of file From ce6daa22b82b5082f6c63815ff5e2d677ca8af36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Sat, 28 May 2022 12:53:13 +0800 Subject: [PATCH 09/36] :construction_worker: Add page footer content. --- exampleSite/config.yaml | 14 +++--- i18n/zh-cn.yaml | 5 ++ layouts/_default/baseof.html | 2 +- layouts/partials/footer.html | 91 ++++++++++++++++++++++++++++++++++++ 4 files changed, 104 insertions(+), 8 deletions(-) diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index e0247c2..24f8d44 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -265,14 +265,14 @@ params: footer: # Specify the year when the site was setup. If not defined, current year will be used. - #since: 2021 + since: 2010 # Icon between year and copyright info. icon: # Icon name in Font Awesome. See: https://fontawesome.com/icons name: fa fa-heart # If you want to animate the icon, set it to true. - animated: false + animated: true # Change the color of icon, using Hex Code. color: "#ff0000" @@ -285,13 +285,13 @@ params: # Beian ICP and gongan information for Chinese users. See: https://beian.miit.gov.cn, http://www.beian.gov.cn beian: enable: false - icp: + icp: 粤ICP备18047355-1号 # The digit in the num of gongan beian. - gongan_id: + #gongan_id: # The full num of gongan beian. - gongan_num: + gonganNum: 11010102001808 # The icon for gongan beian. See: http://www.beian.gov.cn/portal/download - gongan_icon_url: + #gongan_icon_url: # --------------------------------------------------------------- @@ -784,7 +784,7 @@ params: visitorsIcon: fa fa-user views: true viewsIcon: fa fa-eye - postViews: true + postViews: false postViewsIcon: far fa-eye diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index d2200f5..799ac3c 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -53,5 +53,10 @@ PostTag: PostReadMore: other: "阅读全文" +UserVistorsLabel: + other: 总访客量 +PageViewsLabel: + other: 总访问量 + FooterPowerby: other: "由 %s 强力驱动" \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 65af36d..ecd8a97 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -46,7 +46,7 @@
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index e69de29..2c5f04b 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -0,0 +1,91 @@ +{{- $ft := .P.footer }} +{{- if $ft.beian.enable }} +{{- with $ft.beian }} + +{{- end }} +{{- end }} + +{{/* + +*/}} +{{- if .P.busuanzi.enable }} +{{ with .P.busuanzi }} +
+ {{- if .visitors }} + + {{- end }} + {{- if .views }} + + {{- end }} +
+{{- end }} +{{- end }} +{{- if $ft.powered }} +
+ {{ $pb := printf "Hugo & NexT.%s" .P.scheme }} + {{- printf (T "FooterPowerby") $pb | safeHTML }} +
+{{- end }} \ No newline at end of file From 035c908b33defaba6dcca28799430cf1c09bed5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Sat, 28 May 2022 15:48:52 +0800 Subject: [PATCH 10/36] :construction_worker: :bug: Add widgets content. --- .../_common/components/reading-progress.scss | 4 +-- .../css/_common/outline/header/bookmark.scss | 19 +++++++++---- assets/css/_common/scaffolding/tags/pdf.scss | 2 +- assets/css/_mixins.scss | 4 +-- exampleSite/config.yaml | 8 +++--- i18n/zh-cn.yaml | 2 +- layouts/_default/baseof.html | 1 + layouts/partials/footer.html | 2 +- layouts/partials/widgets.html | 27 +++++++++++++++++++ 9 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 layouts/partials/widgets.html diff --git a/assets/css/_common/components/reading-progress.scss b/assets/css/_common/components/reading-progress.scss index 791dcc9..b85cdbf 100644 --- a/assets/css/_common/components/reading-progress.scss +++ b/assets/css/_common/components/reading-progress.scss @@ -1,8 +1,8 @@ @if $reading_progress_enable { .reading-progress-bar { --progress: 0; - background: convert($reading_progress_color); - height: convert($reading_progress_height); + background: $reading_progress_color; + height: $reading_progress_height; position: fixed; z-index: $zindex-5; diff --git a/assets/css/_common/outline/header/bookmark.scss b/assets/css/_common/outline/header/bookmark.scss index 28876ce..d40fedc 100644 --- a/assets/css/_common/outline/header/bookmark.scss +++ b/assets/css/_common/outline/header/bookmark.scss @@ -3,22 +3,31 @@ border-bottom: 0; position: fixed; top: -10px; + transition: top .3s; - @include sidebar-toggle-position(true); + -moz-transition:top .3s; + -webkit-transition:top .3s; + -o-transition:top .3s; + + @if not $github_banner_enable { + @include sidebar-toggle-position(true); + } @else { + left: 30px; + } @include tablet-mobile() { display: none; } &::before { - color: convert($bookmark_color); + color: $bookmark_color; font-size: 32px; line-height: 1; @include font-family-icons('\f02e'); } - } - .book-mark-link:hover, .book-mark-link-fixed { - top: -2px; + &:hover { + top: 0px; + } } } diff --git a/assets/css/_common/scaffolding/tags/pdf.scss b/assets/css/_common/scaffolding/tags/pdf.scss index e61cad9..b873a21 100644 --- a/assets/css/_common/scaffolding/tags/pdf.scss +++ b/assets/css/_common/scaffolding/tags/pdf.scss @@ -1,7 +1,7 @@ @if $pdf_enable { .pdfobject-container { iframe, embed { - height: convert($pdf_height); + height: $pdf_height; width: 100%; } } diff --git a/assets/css/_mixins.scss b/assets/css/_mixins.scss index 7685639..9e435a8 100644 --- a/assets/css/_mixins.scss +++ b/assets/css/_mixins.scss @@ -125,9 +125,7 @@ } @mixin sidebar-toggle-position($reverse) { - // TODO how use nth function. - //$alignment : list.nth(sidebar-toggle-alignment($reverse), 0); - $alignment : 0; + $alignment : nth(sidebar-toggle-alignment($reverse), 1); #{$alignment}: $b2t-position-right; @include tablet-mobile() { #{$alignment}: $b2t-position-right-mobile; diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 24f8d44..0e46b87 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -446,18 +446,18 @@ params: # Reading progress bar readingProgress: - enable: false + enable: true # Available values: left | right start: left # Available values: top | bottom - position: top + position: bottom reversed: false color: "#37c6c0" height: 3px # Bookmark Support bookmark: - enable: false + enable: true # Customize the color of the bookmark. color: "#222" # If auto, save the reading progress when closing the page or clicking the bookmark-icon. @@ -466,7 +466,7 @@ params: # `Follow me on GitHub` banner in the top-right corner. githubBanner: - enable: false + enable: true permalink: https://github.com/yourname title: Follow me on GitHub diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index 799ac3c..90a2e4d 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -25,7 +25,7 @@ RSSLable: other: "RSS 订阅" CCLinkTitle: other: "共享知识" -BackTop: +BackTopLabel: other: "返回顶部" PostPublishDate: diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index ecd8a97..162f3f3 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -39,6 +39,7 @@ {{- end }}
+ {{ partial "widgets" (dict "P" $P) }}
{{- block "main" . }}{{- end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 2c5f04b..c5ed929 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -27,7 +27,7 @@ {{ default $ft.copyright .P.author }}
-{{/* +{{/* TODO {{ partial "widgets" (dict "P" $P) }} -
+
- {{- block "main" . }}{{- end }} + {{- block "main" (dict "P" $P "Page" .Page "Paginate" (.Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections)) "Scratch" .Scratch) }}{{- end }}
diff --git a/layouts/index.html b/layouts/index.html index 02ce795..9ef13ac 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,2 +1,61 @@ {{- define "main" }} +{{ $P := .P }} +{{- $lang := .Scratch.Get "lang" }} +{{/* $paginator := .Paginate (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections) */}} +{{- range .Paginate.Pages }} +
+
+ + + + +
+

+ {{/*- with .Sticky }} + {{- if gt . 0 }} + + + + {{- end }} + {{- end */}} + {{/*- if not (eq .Link "") }} + {{ .Title }} + {{- else */}} + + {{/*- end */}} +

+ +
+ +
+ {{/*- if .Expand }} + {{ .Content }} + {{ else */}} + {{ .Summary }} + {{/*- end */}} +
+ +
+
+{{- end }} {{- end }} \ No newline at end of file From f2ff0a5299d992083bbdad007a00506fe19df969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Tue, 31 May 2022 21:50:35 +0800 Subject: [PATCH 13/36] :building_construction: Finish the head attributes redesign. --- assets/css/main.scss | 154 +++++++++++++------------- exampleSite/config.yaml | 19 ++-- layouts/_default/baseof.html | 2 +- layouts/partials/head.html | 13 +++ layouts/partials/head/facebook.html | 5 + layouts/partials/head/googleplus.html | 3 + layouts/partials/head/meta.html | 74 ++++--------- layouts/partials/head/opengraph.html | 15 +++ layouts/partials/head/style.html | 4 +- layouts/partials/head/twitter.html | 7 ++ layouts/partials/head/verify.html | 14 +++ 11 files changed, 167 insertions(+), 143 deletions(-) create mode 100644 layouts/partials/head/facebook.html create mode 100644 layouts/partials/head/googleplus.html create mode 100644 layouts/partials/head/opengraph.html create mode 100644 layouts/partials/head/twitter.html create mode 100644 layouts/partials/head/verify.html diff --git a/assets/css/main.scss b/assets/css/main.scss index 1c4e1c4..48a98ad 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -1,39 +1,39 @@ // CSS Style Guide: https://codeguide.co/#css // All variables from site's config content. - +{{- $P := .Site.Params }} // Base -$scheme: {{ .P.scheme }}; -$darkmode: {{ .P.darkmode }}; +$scheme: {{ $P.scheme }}; +$darkmode: {{ $P.darkmode }}; -$body_scrollbar_overlay: {{ .P.bodyScrollbar.overlay }}; -$body_scrollbar_stable: {{ .P.bodyScrollbar.stable }}; -$mermaid_enable: {{ .P.mermaid.enable }}; -$mobile_layout_economy: {{ .P.mobileLayoutEconomy }}; -$theme_color_dark: {{ .P.themeColor.dark }}; -$theme_color_light: {{ .P.themeColor.light }}; +$body_scrollbar_overlay: {{ $P.bodyScrollbar.overlay }}; +$body_scrollbar_stable: {{ $P.bodyScrollbar.stable }}; +$mermaid_enable: {{ $P.mermaid.enable }}; +$mobile_layout_economy: {{ $P.mobileLayoutEconomy }}; +$theme_color_dark: {{ $P.themeColor.dark }}; +$theme_color_light: {{ $P.themeColor.light }}; // Header -$bookmark_color: {{ .P.bookmark.color }}; -$bookmark_enable: {{ .P.bookmark.enable }}; -$github_banner_enable: {{ .P.githubBanner.enable }}; -$menu_settings_badges: {{ .P.menuSets.badges }}; +$bookmark_color: {{ $P.bookmark.color }}; +$bookmark_enable: {{ $P.bookmark.enable }}; +$github_banner_enable: {{ $P.githubBanner.enable }}; +$menu_settings_badges: {{ $P.menuSets.badges }}; // Footer -$footer_icon_color: {{ .P.footer.icon.color }}; -$footer_icon_animated: {{ .P.footer.icon.animated }}; -$footer_beian_enable: {{ .P.footer.beian.enable }}; +$footer_icon_color: {{ $P.footer.icon.color }}; +$footer_icon_animated: {{ $P.footer.icon.animated }}; +$footer_beian_enable: {{ $P.footer.beian.enable }}; // Counter -$busuanzi_enable: {{ .P.busuanzi.enable }}; -$busuanzi_visitors: {{ .P.busuanzi.visitors }}; -$busuanzi_views: {{ .P.busuanzi.views }}; -$busuanzi_post_views: {{ .P.busuanzi.postViews }}; +$busuanzi_enable: {{ $P.busuanzi.enable }}; +$busuanzi_visitors: {{ $P.busuanzi.visitors }}; +$busuanzi_views: {{ $P.busuanzi.views }}; +$busuanzi_post_views: {{ $P.busuanzi.postViews }}; // Font -$font_enable: {{ .P.font.enable }}; -$font_global_size: {{ default .P.font.global.size 1 }}; -$font_headings_size: {{ default .P.font.headings.size 1.625 }}; -$font_title_size: {{ default .P.font.title.size 1.375 }}; +$font_enable: {{ $P.font.enable }}; +$font_global_size: {{ default $P.font.global.size 1 }}; +$font_headings_size: {{ default $P.font.headings.size 1.625 }}; +$font_title_size: {{ default $P.font.title.size 1.375 }}; // Code & Code blocks // TODO find the configure variable @@ -42,88 +42,88 @@ $highlight_dark_foreground: #222; $highlight_light_background: #000; $highlight_light_foreground: #222; -$codeblock_copy_btn_style: {{ .P.codeblock.copyBtn.style }}; +$codeblock_copy_btn_style: {{ $P.codeblock.copyBtn.style }}; // Sidebar -$sidebar_offset: {{ .P.sidebar.offset }}; -$sidebar_padding: {{ .P.sidebar.padding }}; -$sidebar_position: {{ .P.sidebar.position }}; -$sidebar_width: {{ .P.sidebar.width }}; +$sidebar_offset: {{ $P.sidebar.offset }}; +$sidebar_padding: {{ $P.sidebar.padding }}; +$sidebar_position: {{ $P.sidebar.position }}; +$sidebar_width: {{ $P.sidebar.width }}; -$motion_enable: {{ .P.motion.enable }}; -$motion_transition_sidebar: {{ .P.motion.transition.sidebar }}; +$motion_enable: {{ $P.motion.enable }}; +$motion_transition_sidebar: {{ $P.motion.transition.sidebar }}; -$back2top_enable: {{ .P.backTop.enable }}; -$back2top_scrollpercent: {{ .P.backTop.scrollpercent }}; -$back2top_sidebar: {{ .P.backTop.sidebar }}; +$back2top_enable: {{ $P.backTop.enable }}; +$back2top_scrollpercent: {{ $P.backTop.scrollpercent }}; +$back2top_sidebar: {{ $P.backTop.sidebar }}; -$avatar_rotated: {{ .P.avatar.rotated }}; -$avatar_rounded: {{ .P.avatar.rounded }}; -$avatar_rounded: {{ .P.avatar.rounded }}; -$site_state: {{ .P.siteState }}; -$social_icons_only: {{ .P.socialIcons.iconsOnly }}; -$social_icons_transition: {{ .P.socialIcons.transition }}; -$links_settings_layout: {{ .P.linksSets.layout }}; -$toc_enable: {{ .P.toc.enable }}; -$toc_expand_all: {{ .P.toc.expandAll }}; -$toc_wrap: {{ .P.toc.wrap }}; +$avatar_rotated: {{ $P.avatar.rotated }}; +$avatar_rounded: {{ $P.avatar.rounded }}; +$avatar_rounded: {{ $P.avatar.rounded }}; +$site_state: {{ $P.siteState }}; +$social_icons_only: {{ $P.socialIcons.iconsOnly }}; +$social_icons_transition: {{ $P.socialIcons.transition }}; +$links_settings_layout: {{ $P.linksSets.layout }}; +$toc_enable: {{ $P.toc.enable }}; +$toc_expand_all: {{ $P.toc.expandAll }}; +$toc_wrap: {{ $P.toc.wrap }}; // Posts -$creative_commons_post: {{ .P.creativeCommons.post }}; -$follow_me: {{ isset .P "followMe" }}; -$motion_trans_coll_header: {{ .P.motion.transition.collHeader }}; -$motion_trans_post_block: {{ .P.motion.transition.postBlock }}; -$motion_trans_post_body: {{ .P.motion.transition.postBody }}; -$motion_trans_post_header: {{ .P.motion.transition.postHeader }}; -$post_edit_enable: {{ .P.postEdit.enable }}; -$post_meta_item_text: {{ .P.postMeta.itemText }}; -$reward_settings_animation: {{ .P.rewardSets.animation }}; +$creative_commons_post: {{ $P.creativeCommons.post }}; +$follow_me: {{ isset $P "followMe" }}; +$motion_trans_coll_header: {{ $P.motion.transition.collHeader }}; +$motion_trans_post_block: {{ $P.motion.transition.postBlock }}; +$motion_trans_post_body: {{ $P.motion.transition.postBody }}; +$motion_trans_post_header: {{ $P.motion.transition.postHeader }}; +$post_edit_enable: {{ $P.postEdit.enable }}; +$post_meta_item_text: {{ $P.postMeta.itemText }}; +$reward_settings_animation: {{ $P.rewardSets.animation }}; // TODO find the paramters $text_align_desktop: center; $text_align_mobile: center; // Note -$note_icons: {{ .P.note.icons }}; -$note_light_bg_offset: {{ .P.note.lightBgOffset }}; -$note_style: {{ .P.note.style }}; +$note_icons: {{ $P.note.icons }}; +$note_light_bg_offset: {{ $P.note.lightBgOffset }}; +$note_style: {{ $P.note.style }}; // Tabs -$tabs_transition_labels: {{ .P.tabs.transition.labels }}; -$tabs_transition_tabs: {{ .P.tabs.transition.tabs }}; +$tabs_transition_labels: {{ $P.tabs.transition.labels }}; +$tabs_transition_tabs: {{ $P.tabs.transition.tabs }}; // Reading progress bar -$reading_progress_start: {{ .P.readingProgress.start }}; -$reading_progress_color: {{ .P.readingProgress.color }}; -$reading_progress_enable: {{ .P.readingProgress.enable }}; -$reading_progress_height: {{ .P.readingProgress.height }}; -$reading_progress_position: {{ .P.readingProgress.position }}; -$reading_progress_reversed: {{ .P.readingProgress.reversed }}; +$reading_progress_start: {{ $P.readingProgress.start }}; +$reading_progress_color: {{ $P.readingProgress.color }}; +$reading_progress_enable: {{ $P.readingProgress.enable }}; +$reading_progress_height: {{ $P.readingProgress.height }}; +$reading_progress_position: {{ $P.readingProgress.position }}; +$reading_progress_reversed: {{ $P.readingProgress.reversed }}; // Thirdparty -$math_mathjax_enable: {{ .P.math.mathjax.enable }}; -$related_posts_enable: {{ .P.relatedPosts.enable }}; -$pdf_enable: {{ .P.pdf.enable }}; -$pdf_height: {{ .P.pdf.height }}; +$math_mathjax_enable: {{ $P.math.mathjax.enable }}; +$related_posts_enable: {{ $P.relatedPosts.enable }}; +$pdf_enable: {{ $P.pdf.enable }}; +$pdf_height: {{ $P.pdf.height }}; // Search engine -$algolia_search_enable: {{ .P.algoliaSearch.enable }}; -$local_search_enable: {{ .P.localSearch.enable }}; +$algolia_search_enable: {{ $P.algoliaSearch.enable }}; +$local_search_enable: {{ $P.localSearch.enable }}; // Online IM -$gitalk_enable: {{ .P.gitalk.enable }}; -$gitter_enable: {{ .P.gitter.enable }}; +$gitalk_enable: {{ $P.gitalk.enable }}; +$gitter_enable: {{ $P.gitter.enable }}; // Comment -$disqusjs_enable: {{ .P.disqusjs.enable }}; -$utterances_enable: {{ .P.utterances.enable }}; +$disqusjs_enable: {{ $P.disqusjs.enable }}; +$utterances_enable: {{ $P.utterances.enable }}; // // Variables Layer // -------------------------------------------------- @import '_variables/base'; -{{ printf "/* %s Scheme Style */" .P.scheme }} -{{ printf "@import '_variables/%s';" .P.scheme }} +{{ printf "/* %s Scheme Style */" $P.scheme }} +{{ printf "@import '_variables/%s';" $P.scheme }} // TODO //@import 'theme.injects.variable'; @@ -151,7 +151,7 @@ $utterances_enable: {{ .P.utterances.enable }}; // Schemes Layer // -------------------------------------------------- -{{ printf "@import '_schemes/%s/';" .P.scheme }} +{{ printf "@import '_schemes/%s/';" $P.scheme }} // Custom Layer // TODO diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 42c338c..370d9d7 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -24,6 +24,7 @@ languages: author: Theme NexT subtitle: Theme for Hugo description: Stay easily & powerful. + keywords: Hugo,Theme,easily,powerful #-------------------------------------- # Menus Settings @@ -101,6 +102,7 @@ params: author: NexT 主题 subtitle: 为 Hugo 打造的主题 description: 保持简单的易用性和强大的功能。 + keywords: Hugo,主题,简单,强大 favicon: icon: /imgs/icons/favicon.ico @@ -129,15 +131,14 @@ params: # See: https://hexo.io/docs/helpers#open-graph openGraph: enable: true - # twitter: - # card: - # creator: - # image: - # site: - # googlePlus: - # facebook: - # admins: - # app_id: + #twitter: + #creator: + #image: + #site: + #googlePlus: + #facebook: + # admins: + # app_id: # --------------------------------------------------------------- diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a819ae2..17c82f6 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -19,7 +19,7 @@ - {{- partial "head.html" (dict "P" $P "Page" .Page "Scratch" .Scratch) }} + {{- partial "head.html" . }} {{ .Title | default .Site.Title }}
- {{- partial "scripts" (dict "P" $P "Page" .Page "Scratch" .Scratch) }} + {{- partial "scripts" . }} \ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index a357aa5..a183e1d 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -25,7 +25,7 @@ - {{ default $ft.copyright .Site.Params.author }} + {{ $ft.copyright | default .Site.Params.author }} {{/* TODO -{{- $jsRes := .Page.Site.Data.resources.js }} -{{- $vendor := .P.vendors.plugins }} +{{- $jsRes := .Site.Data.resources.js }} +{{- $vendor := .Site.Params.vendors.plugins }} {{- $vendorCDN := .Scratch.Get "pluginCDN" }} {{- range $js := $jsRes }} {{- $pluginJS := $vendorCDN }} From bb77f9bfb69e64fde85c25d48bfaeca563f5a495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Wed, 1 Jun 2022 17:06:27 +0800 Subject: [PATCH 19/36] :building_construction: Finish the post meta attributes redesign. --- .../_common/components/post/post-header.scss | 2 +- assets/css/main.scss | 4 +-- exampleSite/config.yaml | 23 +++++++++------- exampleSite/content/post/hello-world.md | 13 +++++---- i18n/en-us.yaml | 8 +++--- i18n/zh-cn.yaml | 8 +++--- layouts/_default/baseof.html | 4 +-- layouts/index.html | 16 ++++++----- layouts/partials/post_meta/categories.html | 17 ++++++++++++ layouts/partials/post_meta/created_date.html | 12 +++++++++ layouts/partials/post_meta/readtime.html | 9 +++++++ layouts/partials/post_meta/update_date.html | 12 +++++++++ layouts/partials/post_meta/views.html | 27 +++++++++++++++++++ layouts/partials/post_meta/words.html | 9 +++++++ 14 files changed, 129 insertions(+), 35 deletions(-) create mode 100644 layouts/partials/post_meta/categories.html create mode 100644 layouts/partials/post_meta/created_date.html create mode 100644 layouts/partials/post_meta/readtime.html create mode 100644 layouts/partials/post_meta/update_date.html create mode 100644 layouts/partials/post_meta/views.html create mode 100644 layouts/partials/post_meta/words.html diff --git a/assets/css/_common/components/post/post-header.scss b/assets/css/_common/components/post/post-header.scss index 3c7eb44..25f9cab 100644 --- a/assets/css/_common/components/post/post-header.scss +++ b/assets/css/_common/components/post/post-header.scss @@ -1,6 +1,6 @@ .posts-expand .post-header { font-size: $font-size-large; - margin-bottom: 60px; + margin-bottom: 40px; text-align: center; } diff --git a/assets/css/main.scss b/assets/css/main.scss index 48a98ad..993a7c9 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -80,8 +80,8 @@ $post_meta_item_text: {{ $P.postMeta.itemText }}; $reward_settings_animation: {{ $P.rewardSets.animation }}; // TODO find the paramters -$text_align_desktop: center; -$text_align_mobile: center; +$text_align_desktop: justify; +$text_align_mobile: justify; // Note $note_icons: {{ $P.note.icons }}; diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 2073a3a..ddc40d6 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -8,8 +8,6 @@ baseURL: / theme: hugo-theme-next -mainSections: ["post"] - defaultContentLanguage: zh-cn languages: zh-cn: @@ -55,6 +53,9 @@ menus: weight: 4 params: + mainSections: ["post"] + dateFormat: "2006-01-02" + timeFormat: "2006-01-02T15:04:05-07:00" # --------------------------------------------------------------- # Theme Core Configuration Settings # See: https://theme-next.js.org/docs/theme-settings/ @@ -317,12 +318,14 @@ params: enable: true anotherDay: true categories: true + wordCount: true + readTime: true # Post wordcount display settings # Dependencies: https://github.com/next-theme/hexo-word-counter - symbols_count_time: - separated_meta: true - item_text_total: false + # symbols_count_time: + # separated_meta: true + # item_text_total: false # Use icon instead of the symbol # to indicate the tag at the bottom of the post tag_icon: false @@ -759,12 +762,12 @@ params: # Show number of visitors of each article. # You can visit https://www.leancloud.cn to get AppID and AppKey. - leancloud_visitors: + leancloudVisitors: enable: false - app_id: # - app_key: # + appId: # + appKey: # # Required for apps from CN region - server_url: # + serverUrl: # # Dependencies: https://github.com/theme-next/hexo-leancloud-counter-security # If you don't care about security in leancloud counter and just want to use it directly # (without hexo-leancloud-counter-security plugin), set `security` to `false`. @@ -787,7 +790,7 @@ params: visitorsIcon: fa fa-user views: true viewsIcon: fa fa-eye - postViews: false + postViews: true postViewsIcon: far fa-eye diff --git a/exampleSite/content/post/hello-world.md b/exampleSite/content/post/hello-world.md index 6597354..7645001 100644 --- a/exampleSite/content/post/hello-world.md +++ b/exampleSite/content/post/hello-world.md @@ -1,12 +1,12 @@ --- -title: 'Hugo blog Hello World' +title: Hello World description: 'Short description of the article.' keywords: 'Key words' -isCJKLanguage: true +isCJKLanguage: false author: 'Author of the article' lastmod: '2022-05-21T17:06:24+08:00' -publishDate: '2022-05-21T17:06:24+08:00' +publishDate: '2022-05-21T16:06:24+08:00' weight: 1 categories: @@ -16,12 +16,15 @@ tags: - Startup toc: false -draft: true -url: 'hello_world.html' +draft: false --- +The world’s fastest framework for building websites. + [Hugo](https://gohugo.io/) is one of the most popular open-source static site generators. With its amazing speed and flexibility, Hugo makes building websites fun again. + + ## Quick Start ### Create a new post diff --git a/i18n/en-us.yaml b/i18n/en-us.yaml index f620c28..5050f74 100644 --- a/i18n/en-us.yaml +++ b/i18n/en-us.yaml @@ -8,7 +8,7 @@ NavToggleLabel: MSearchLabel: other: Search -ColoneFlag: +SymbolColon: other: ":" SitePostsTitle: @@ -19,8 +19,8 @@ SiteTagsTitle: other: "Tags" TableOfContents: other: "TOC" -SiteInfo: - other: "Site Info" +SiteOverview: + other: "Overview" RSSTitle: other: "RSS Subscribe" CCLinkTitle: @@ -44,7 +44,7 @@ PostReading: other: "Read" PostReadTime: other: "{{- .ReadingTime -}}min" -PostVisitor: +PostViews: other: "Views" PostCatg: other: "Categories" diff --git a/i18n/zh-cn.yaml b/i18n/zh-cn.yaml index c0e501d..2936ff8 100644 --- a/i18n/zh-cn.yaml +++ b/i18n/zh-cn.yaml @@ -8,7 +8,7 @@ NavToggleLabel: MSearchLabel: other: 搜索 -ColoneFlag: +SymbolColon: other: ":" SbPostsLable: @@ -46,11 +46,11 @@ PostReading: other: 阅读 PostReadTime: other: "{{- .ReadingTime -}}分钟" -PostVisitor: +PostViews: other: 浏览数 -PostCatg: +PostCatgs: other: 分类 -PostTag: +PostTags: other: 标签 PostReadMore: other: 阅读全文 diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index bbf8305..b2c0679 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -40,9 +40,9 @@ {{ partial "widgets.html" . }} -
+
- {{- block "main" (dict "P" $P "Page" .Page "Paginate" (.Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections)) "Scratch" .Scratch) }}{{- end }} + {{- block "main" . }}{{- end }}