👷 Finish default base index page head attribute migrate.

This commit is contained in:
凡梦星尘 2022-05-22 19:40:41 +08:00
parent 277f500942
commit a4574e2085
8 changed files with 277 additions and 117 deletions

View File

@ -1,41 +1,39 @@
// CSS Style Guide: https://codeguide.co/#css // CSS Style Guide: https://codeguide.co/#css
// All variables from site's config content. // All variables from site's config content.
{{- $P := .Site.Params -}}
// Base // Base
$scheme: {{ $P.scheme }}; $scheme: {{ .P.scheme }};
$darkmode: {{ $P.darkmode }}; $darkmode: {{ .P.darkmode }};
$body_scrollbar_overlay: {{ $P.bodyScrollbar.overlay }}; $body_scrollbar_overlay: {{ .P.bodyScrollbar.overlay }};
$body_scrollbar_stable: {{ $P.bodyScrollbar.stable }}; $body_scrollbar_stable: {{ .P.bodyScrollbar.stable }};
$mermaid_enable: {{ $P.mermaid.enable }}; $mermaid_enable: {{ .P.mermaid.enable }};
$mobile_layout_economy: {{ $P.mobileLayoutEconomy }}; $mobile_layout_economy: {{ .P.mobileLayoutEconomy }};
$theme_color_dark: {{ $P.themeColor.dark }}; $theme_color_dark: {{ .P.themeColor.dark }};
$theme_color_light: {{ $P.themeColor.light }}; $theme_color_light: {{ .P.themeColor.light }};
// Header // Header
$bookmark_color: {{ $P.bookmark.color }}; $bookmark_color: {{ .P.bookmark.color }};
$bookmark_enable: {{ $P.bookmark.enable }}; $bookmark_enable: {{ .P.bookmark.enable }};
$github_banner_enable: {{ $P.githubBanner.enable }}; $github_banner_enable: {{ .P.githubBanner.enable }};
$menu_settings_badges: {{ $P.menuSets.badges }}; $menu_settings_badges: {{ .P.menuSets.badges }};
// Footer // Footer
$footer_icon_color: {{ $P.footer.icon.color }}; $footer_icon_color: {{ .P.footer.icon.color }};
$footer_icon_animated: {{ $P.footer.icon.animated }}; $footer_icon_animated: {{ .P.footer.icon.animated }};
$footer_beian_enable: {{ $P.footer.beian.enable }}; $footer_beian_enable: {{ .P.footer.beian.enable }};
// Counter // Counter
$busuanzi_enable: {{ $P.busuanzi.enable }}; $busuanzi_enable: {{ .P.busuanzi.enable }};
$busuanzi_visitors: {{ $P.busuanzi.visitors }}; $busuanzi_visitors: {{ .P.busuanzi.visitors }};
$busuanzi_views: {{ $P.busuanzi.views }}; $busuanzi_views: {{ .P.busuanzi.views }};
$busuanzi_post_views: {{ $P.busuanzi.postViews }}; $busuanzi_post_views: {{ .P.busuanzi.postViews }};
// Font // Font
$font_enable: {{ $P.font.enable }}; $font_enable: {{ .P.font.enable }};
$font_global_size: {{ default $P.font.global.size 1 }}; $font_global_size: {{ default .P.font.global.size 1 }};
$font_headings_size: {{ default $P.font.headings.size 1.625 }}; $font_headings_size: {{ default .P.font.headings.size 1.625 }};
$font_title_size: {{ default $P.font.title.size 1.375 }}; $font_title_size: {{ default .P.font.title.size 1.375 }};
// Code & Code blocks // Code & Code blocks
// TODO find the configure variable // TODO find the configure variable
@ -44,88 +42,88 @@ $highlight_dark_foreground: #222;
$highlight_light_background: #000; $highlight_light_background: #000;
$highlight_light_foreground: #222; $highlight_light_foreground: #222;
$codeblock_copy_btn_style: {{ $P.codeblock.copyBtn.style }}; $codeblock_copy_btn_style: {{ .P.codeblock.copyBtn.style }};
// Sidebar // Sidebar
$sidebar_offset: {{ $P.sidebar.offset }}; $sidebar_offset: {{ .P.sidebar.offset }};
$sidebar_padding: {{ $P.sidebar.padding }}; $sidebar_padding: {{ .P.sidebar.padding }};
$sidebar_position: {{ $P.sidebar.position }}; $sidebar_position: {{ .P.sidebar.position }};
$sidebar_width: {{ $P.sidebar.width }}; $sidebar_width: {{ .P.sidebar.width }};
$motion_enable: {{ $P.motion.enable }}; $motion_enable: {{ .P.motion.enable }};
$motion_transition_sidebar: {{ $P.motion.transition.sidebar }}; $motion_transition_sidebar: {{ .P.motion.transition.sidebar }};
$back2top_enable: {{ $P.backTop.enable }}; $back2top_enable: {{ .P.backTop.enable }};
$back2top_scrollpercent: {{ $P.backTop.scrollpercent }}; $back2top_scrollpercent: {{ .P.backTop.scrollpercent }};
$back2top_sidebar: {{ $P.backTop.sidebar }}; $back2top_sidebar: {{ .P.backTop.sidebar }};
$avatar_rotated: {{ $P.avatar.rotated }}; $avatar_rotated: {{ .P.avatar.rotated }};
$avatar_rounded: {{ $P.avatar.rounded }}; $avatar_rounded: {{ .P.avatar.rounded }};
$avatar_rounded: {{ $P.avatar.rounded }}; $avatar_rounded: {{ .P.avatar.rounded }};
$site_state: {{ $P.siteState }}; $site_state: {{ .P.siteState }};
$social_icons_only: {{ $P.socialIcons.iconsOnly }}; $social_icons_only: {{ .P.socialIcons.iconsOnly }};
$social_icons_transition: {{ $P.socialIcons.transition }}; $social_icons_transition: {{ .P.socialIcons.transition }};
$links_settings_layout: {{ $P.linksSets.layout }}; $links_settings_layout: {{ .P.linksSets.layout }};
$toc_enable: {{ $P.toc.enable }}; $toc_enable: {{ .P.toc.enable }};
$toc_expand_all: {{ $P.toc.expandAll }}; $toc_expand_all: {{ .P.toc.expandAll }};
$toc_wrap: {{ $P.toc.wrap }}; $toc_wrap: {{ .P.toc.wrap }};
// Posts // Posts
$creative_commons_post: {{ $P.creativeCommons.post }}; $creative_commons_post: {{ .P.creativeCommons.post }};
$follow_me: {{ isset $P "followMe" }}; $follow_me: {{ isset .P "followMe" }};
$motion_trans_coll_header: {{ $P.motion.transition.collHeader }}; $motion_trans_coll_header: {{ .P.motion.transition.collHeader }};
$motion_trans_post_block: {{ $P.motion.transition.postBlock }}; $motion_trans_post_block: {{ .P.motion.transition.postBlock }};
$motion_trans_post_body: {{ $P.motion.transition.postBody }}; $motion_trans_post_body: {{ .P.motion.transition.postBody }};
$motion_trans_post_header: {{ $P.motion.transition.postHeader }}; $motion_trans_post_header: {{ .P.motion.transition.postHeader }};
$post_edit_enable: {{ $P.postEdit.enable }}; $post_edit_enable: {{ .P.postEdit.enable }};
$post_meta_item_text: {{ $P.postMeta.itemText }}; $post_meta_item_text: {{ .P.postMeta.itemText }};
$reward_settings_animation: {{ $P.rewardSets.animation }}; $reward_settings_animation: {{ .P.rewardSets.animation }};
// TODO find the paramters // TODO find the paramters
$text_align_desktop: center; $text_align_desktop: center;
$text_align_mobile: center; $text_align_mobile: center;
// Note // Note
$note_icons: {{ $P.note.icons }}; $note_icons: {{ .P.note.icons }};
$note_light_bg_offset: {{ $P.note.lightBgOffset }}; $note_light_bg_offset: {{ .P.note.lightBgOffset }};
$note_style: {{ $P.note.style }}; $note_style: {{ .P.note.style }};
// Tabs // Tabs
$tabs_transition_labels: {{ $P.tabs.transition.labels }}; $tabs_transition_labels: {{ .P.tabs.transition.labels }};
$tabs_transition_tabs: {{ $P.tabs.transition.tabs }}; $tabs_transition_tabs: {{ .P.tabs.transition.tabs }};
// Reading progress bar // Reading progress bar
$reading_progress_start: {{ $P.readingProgress.start }}; $reading_progress_start: {{ .P.readingProgress.start }};
$reading_progress_color: {{ $P.readingProgress.color }}; $reading_progress_color: {{ .P.readingProgress.color }};
$reading_progress_enable: {{ $P.readingProgress.enable }}; $reading_progress_enable: {{ .P.readingProgress.enable }};
$reading_progress_height: {{ $P.readingProgress.height }}; $reading_progress_height: {{ .P.readingProgress.height }};
$reading_progress_position: {{ $P.readingProgress.position }}; $reading_progress_position: {{ .P.readingProgress.position }};
$reading_progress_reversed: {{ $P.readingProgress.reversed }}; $reading_progress_reversed: {{ .P.readingProgress.reversed }};
// Thirdparty // Thirdparty
$math_mathjax_enable: {{ $P.math.mathjax.enable }}; $math_mathjax_enable: {{ .P.math.mathjax.enable }};
$related_posts_enable: {{ $P.relatedPosts.enable }}; $related_posts_enable: {{ .P.relatedPosts.enable }};
$pdf_enable: {{ $P.pdf.enable }}; $pdf_enable: {{ .P.pdf.enable }};
$pdf_height: {{ $P.pdf.height }}; $pdf_height: {{ .P.pdf.height }};
// Search engine // Search engine
$algolia_search_enable: {{ $P.algoliaSearch.enable }}; $algolia_search_enable: {{ .P.algoliaSearch.enable }};
$local_search_enable: {{ $P.localSearch.enable }}; $local_search_enable: {{ .P.localSearch.enable }};
// Online IM // Online IM
$gitalk_enable: {{ $P.gitalk.enable }}; $gitalk_enable: {{ .P.gitalk.enable }};
$gitter_enable: {{ $P.gitter.enable }}; $gitter_enable: {{ .P.gitter.enable }};
// Comment // Comment
$disqusjs_enable: {{ $P.disqusjs.enable }}; $disqusjs_enable: {{ .P.disqusjs.enable }};
$utterances_enable: {{ $P.utterances.enable }}; $utterances_enable: {{ .P.utterances.enable }};
// //
// Variables Layer // Variables Layer
// -------------------------------------------------- // --------------------------------------------------
@import '_variables/base'; @import '_variables/base';
{{ printf "/* %s Scheme Style */" $P.scheme }} {{ printf "/* %s Scheme Style */" .P.scheme }}
{{ printf "@import '_variables/%s';" $P.scheme }} {{ printf "@import '_variables/%s';" .P.scheme }}
// TODO // TODO
//@import 'theme.injects.variable'; //@import 'theme.injects.variable';
@ -153,7 +151,7 @@ $utterances_enable: {{ $P.utterances.enable }};
// Schemes Layer // Schemes Layer
// -------------------------------------------------- // --------------------------------------------------
{{ printf "@import '_schemes/%s/';" $P.scheme }} {{ printf "@import '_schemes/%s/';" .P.scheme }}
// Custom Layer // Custom Layer
// TODO // TODO

View File

@ -8,6 +8,21 @@ baseURL: /
theme: hugo-theme-next 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: params:
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Theme Core Configuration Settings # Theme Core Configuration Settings
@ -15,15 +30,15 @@ params:
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Allow to cache content generation. # Allow to cache content generation.
cache: #cache:
enable: true # enable: true
# Remove unnecessary files after hexo generate. # Remove unnecessary files after hexo generate.
minify: false # minify: false
# Define custom file paths. # Define custom file paths.
# Create your custom files in site directory `source/_data` and uncomment needed files below. # Create your custom files in site directory `source/_data` and uncomment needed files below.
custom_file_path: customFilePath:
#head: source/_data/head.njk #head: source/_data/head.njk
#header: source/_data/header.njk #header: source/_data/header.njk
#sidebar: source/_data/sidebar.njk #sidebar: source/_data/sidebar.njk
@ -47,22 +62,27 @@ params:
scheme: Gemini scheme: Gemini
# Dark Mode # Dark Mode
darkmode: false darkmode: true
# --------------------------------------------------------------- # ---------------------------------------------------------------
# Site Information Settings # Site Information Settings
# --------------------------------------------------------------- # ---------------------------------------------------------------
author: NexT 主题
subtitle: 为 Hugo 打造的主题
description: 保持简单的易用性和强大的功能。
favicon: favicon:
small: /images/favicon-16x16-next.png icon: /imgs/icons/favicon.ico
medium: /images/favicon-32x32-next.png small: /imgs/icons/favicon_16x16_next.png
apple_touch_icon: /images/apple-touch-icon-next.png medium: /imgs/icons/favicon_32_32_next.png
safari_pinned_tab: /images/logo.svg appleTouchIcon: /imgs/icons/apple_touch_icon_next.png
#android_manifest: /manifest.json #android_manifest: /manifest.json
# Custom Logo (Warning: Do not support scheme Mist) # 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. # Creative Commons 4.0 International License.
# See: https://creativecommons.org/about/cclicenses/ # See: https://creativecommons.org/about/cclicenses/
@ -75,20 +95,21 @@ params:
post: false post: false
# You can set a language value if you prefer a translated version of CC license, e.g. deed.zh # 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 # 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 # Open graph settings
# See: https://hexo.io/docs/helpers#open-graph # See: https://hexo.io/docs/helpers#open-graph
open_graph: openGraph:
enable: true enable: true
options: # twitter:
#twitter_card: <twitter:card> # card: <twitter:card>
#twitter_id: <twitter:creator> # creator: <twitter:creator>
#twitter_site: <twitter:site> # image: <twitter:image>
#twitter_image: <twitter:image> # site: <twitter:site>
#google_plus: <g+:profile_link> # googlePlus: <g+:profile_link>
#fb_admins: <fb:admin_id> # facebook:
#fb_app_id: <fb:app_id> # admins: <fb:admin_id>
# app_id: <fb:app_id>
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -483,19 +504,19 @@ params:
# Google Webmaster tools verification. # Google Webmaster tools verification.
# See: https://developers.google.com/search # See: https://developers.google.com/search
google_site_verification: googleSiteVerification: 5AUIVYTbHIAuz-eQtxSfZbWW5eg9_EVZMSQycIuXrG0
# Bing Webmaster tools verification. # Bing Webmaster tools verification.
# See: https://www.bing.com/webmasters # See: https://www.bing.com/webmasters
bing_site_verification: bingSiteVerification:
# Yandex Webmaster tools verification. # Yandex Webmaster tools verification.
# See: https://webmaster.yandex.ru # See: https://webmaster.yandex.ru
yandex_site_verification: yandexSiteVerification:
# Baidu Webmaster tools verification. # Baidu Webmaster tools verification.
# See: https://ziyuan.baidu.com/site # See: https://ziyuan.baidu.com/site
baidu_site_verification: baiduSiteVerification:
# --------------------------------------------------------------- # ---------------------------------------------------------------
@ -845,7 +866,7 @@ params:
# Use Animate.css to animate everything. # Use Animate.css to animate everything.
# For more information: https://animate.style # For more information: https://animate.style
motion: motion:
enable: true enable: false
async: false async: false
transition: transition:
# All available transition variants: https://theme-next.js.org/animate/ # All available transition variants: https://theme-next.js.org/animate/

22
exampleSite/start.sh Normal file
View File

@ -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

View File

@ -1,11 +1,47 @@
{{- $P := .Site.Params -}}
{{- $lang := replaceRE "-([a-z]+)" (upper (substr .Site.Language -3)) .Site.Language -}}
{{- .Scratch.Set "lang" $lang -}}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="{{ $lang }}">
{{- partial "head.html" . -}}
<body> <head>
{{- partial "header.html" . -}} <meta charset="UTF-8">
<div id="content"> <meta name="viewport" content="width=device-width">
<meta name="generator" content="Hugo v{{ hugo.Version }}">
<link rel="shortcut icon" type="image/x-icon" href="{{ $P.favicon.icon }}">
<link rel="icon" type="image/x-icon" href="{{ $P.favicon.icon }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ $P.favicon.small }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ $P.favicon.medium }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ $P.favicon.appleTouchIcon }}">
{{- partial "head.html" (dict "P" $P "Page" .Page "Scratch" .Scratch) }}
<title>{{ .Title | default .Site.Title }}</title>
<noscript>
<link rel="stylesheet" href="/css/noscript.css">
</noscript>
</head>
<body itemscope itemtype="http://schema.org/WebPage" {{ if $P.motion.enable }} class="use-motion" {{ end }}>
<div class="headband"></div>
<main class="main">
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner">
{{- partial "header" . }}
</div>
<!-- Sidebar -->
{{- if ne $P.sidebar.display "remove" }}
{{- end }}
</header>
<!-- Widgets -->
<div class="main-inner">
<!-- Submenu,Content,Comment -->
{{- block "main" . }}{{- end }} {{- block "main" . }}{{- end }}
</div> </div>
{{- partial "footer.html" . -}} </main>
</body> <footer class="footer">
<div class="footer-inner">
{{- partial "footer" . }}
</div>
</footer>
</body>
</html> </html>

View File

@ -1,4 +1,2 @@
{{- $scss := resources.Get "css/main.scss" }} {{- partial "head/meta" . }}
{{- $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }} {{- partial "head/style" . }}
{{- $css := $scss | toCSS (dict "targetPath" "/css/main.css" "outputStyle" "expanded") }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">

View File

@ -0,0 +1,48 @@
{{- if .P.darkmode }}
<meta name="theme-color" content="{{ .P.themeColor.dark }}" media="(prefers-color-scheme: dark)">
{{- else }}
<meta name="theme-color" content="{{ .P.themeColor.light }}" media="(prefers-color-scheme: light)">
{{- end }}
{{- if .P.googleSiteVerification }}
<meta name="google-site-verification" content="{{ .P.googleSiteVerification }}">
{{- end }}
{{- with .P.bingSiteVerification }}
<meta name="msvalidate.01" content="{{ . }}">
{{- end }}
{{- with .P.yandexSiteVerification }}
<meta name="yandex-verification" content="{{ . }}">
{{- end }}
{{- with .P.baiduSiteVerification }}
<meta name="baidu-site-verification" content="{{ . }}">
{{- end }}
{{- $lang := .Scratch.Get "lang" }}
{{- $P := .P }}
{{- $Page := .Page }}
{{- with $P.openGraph }}
{{- if .enable }}
<meta property="og:type" content="website">
<meta property="og:title" content="{{ $Page.Title }}">
<meta property="og:description" content="{{ default $P.description $Page.Description }}">
<meta property="og:image" content="{{ $P.customLogo.url }}">
<meta property="og:url" content="{{ $Page.Permalink }}">
<meta property="og:site_name" content="{{ default $Page.Title $Page.Site.Title }}">
<meta property="og:locale" content="{{ $lang }}">
<meta property="article:author" content="{{ default $P.author $Page.Params.Author }}">
{{- with .twitter }}
{{- range $attr, $val := . }}
<meta name="twitter:{{ $attr }}" content="{{ $val }}">
{{- end }}
{{- end }}
{{- with .googlePlus }}
<link rel="publisher" href=" {{ . }}">
{{- end }}
{{- with .facebook }}
{{- range $attr, $val := . }}
<meta property="fb:{{ $attr }}" content="{{ $val }}">
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,7 @@
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css">
{{- $scss := resources.Get "css/main.scss" }}
{{- $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }}
{{- $css := $scss | toCSS (dict "targetPath" "/css/main.css" "outputStyle" "expanded") }}
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
<link rel="stylesheet" href="/css/hover.css">

30
static/css/noscript.css Normal file
View File

@ -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; }