Compare commits
62 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0db1dac57f | ||
|
|
c9d4a00120 | ||
|
|
9c102f9695 | ||
|
|
5fb6618bd3 | ||
|
|
3de3e1de4d | ||
|
|
51eea3acc0 | ||
|
|
be3bf4e1f2 | ||
|
|
cbc39591d2 | ||
|
|
3965c0c108 | ||
|
|
fc44e79ddd | ||
|
|
d3eb723e24 | ||
|
|
b739434f8d | ||
|
|
36b428f1d9 | ||
|
|
678b92c0a7 | ||
|
|
aa8a60d852 | ||
|
|
30d161b1e2 | ||
|
|
96ba605026 | ||
|
|
1677648167 | ||
|
|
6cf961d392 | ||
|
|
97799aaaa8 | ||
|
|
1f668be6fa | ||
|
|
bb70f5b6a5 | ||
|
|
fdd49ab3cb | ||
|
|
1917055634 | ||
|
|
7ed095d42c | ||
|
|
ac844e4e8c | ||
|
|
34faa6f6f3 | ||
|
|
c1e7e59646 | ||
|
|
9a4883832f | ||
|
|
6cbffe48b7 | ||
|
|
403a2e6f54 | ||
|
|
832953372a | ||
|
|
1171bcbfb3 | ||
|
|
6ffddb602f | ||
|
|
f430f0730b | ||
|
|
87301d1d83 | ||
|
|
e83dbabc3f | ||
|
|
af59e93d25 | ||
|
|
d42375820d | ||
|
|
31f6e21671 | ||
|
|
a9ff14d312 | ||
|
|
12fbc945bc | ||
|
|
ad271c1c20 | ||
|
|
81cff8a5c2 | ||
|
|
bf55ada93c | ||
|
|
1339ffe29b | ||
|
|
c12cdf7b48 | ||
|
|
3143ca9d52 | ||
|
|
775dec0314 | ||
|
|
ff9858975f | ||
|
|
ca709ba909 | ||
|
|
fb441cb39e | ||
|
|
98cbde4863 | ||
|
|
8aad5052df | ||
|
|
513f1c47a9 | ||
|
|
9fdf7ab087 | ||
|
|
c0b2403843 | ||
|
|
95667f5ca3 | ||
|
|
bc3372ad2a | ||
|
|
a061a4037c | ||
|
|
ff109afb02 | ||
|
|
3102990265 |
23
.gitignore
vendored
23
.gitignore
vendored
@@ -1,6 +1,25 @@
|
||||
# Ignore files in Hugo NexT theme
|
||||
|
||||
exampleSite/
|
||||
exampleSite/*
|
||||
|
||||
# Exclude special files in content folder
|
||||
exampleSite/content/**/
|
||||
!exampleSite/content
|
||||
!exmapleSite/content/about.md
|
||||
!exampleSite/content/archives
|
||||
!exampleSite/content/post
|
||||
|
||||
# Exclude special files in data folder
|
||||
!exampleSite/data
|
||||
|
||||
# Exclude special files in static folder
|
||||
!exampleSite/static
|
||||
|
||||
# Exclude special files
|
||||
!exampleSite/config.yaml
|
||||
!exampleSite/start.sh
|
||||
!exampleSite/config.yaml
|
||||
|
||||
data/*
|
||||
!data/config.yaml
|
||||
!data/resources.yaml
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
> All page designs & configuration compatibility with Hexo NexT, it's very easy migrate your site from Hexo to Hugo and enjoy yourself.
|
||||
|
||||
[](https://gitter.im/hugo-next/community) [](https://github.com/gohugoio/hugo/releases/latest) [](https://github.com/hugo-next/hugo-theme-next) [](https://github.com/hugo-next/hugo-theme-next/find/main) [](https://github.com/hugo-next/hugo-theme-next/blob/main/LICENSE)
|
||||
[](https://gitter.im/hugo-next/community) [](https://github.com/gohugoio/hugo/releases/latest) [](https://github.com/hugo-next/hugo-theme-next) [](https://github.com/hugo-next/hugo-theme-next/find/main) [](https://github.com/hugo-next/hugo-theme-next/blob/main/LICENSE)
|
||||
|
||||
## 4 Scheme
|
||||
|
||||
@@ -37,7 +37,7 @@ Before use `Hugo NexT` theme, please make sure installed `Git` & `Hugo Extened`
|
||||
$ hugo new site hugo-next-exmaple
|
||||
$ cd hugo-next-exmaple
|
||||
$ git init
|
||||
$ hugo submodule add https://github.com/hugo-next/hugo-theme-next.git themes/hugo-theme-next
|
||||
$ git submodule add https://github.com/hugo-next/hugo-theme-next.git themes/hugo-theme-next
|
||||
$ cp -r themes/hugo-theme-next/exampleSite/* .
|
||||
$ rm -rf config.toml
|
||||
$ hugo server
|
||||
@@ -60,7 +60,7 @@ There had ready a new post template for you, It is recommended to use the follo
|
||||
$ hugo new posts/hello-world.md
|
||||
```
|
||||
|
||||
Descript front matter in post as below:
|
||||
All front matter parameters's description in post as below:
|
||||
|
||||
|
||||
```yml
|
||||
@@ -114,7 +114,7 @@ All features development progress and new request in [Hugo NexT V4 Roadmap](http
|
||||
|
||||
[MIT License](LICENSE)
|
||||
|
||||
Copyright (c) 2022, hugo-next 团队
|
||||
Copyright (c) 2022, hugo-next teams.
|
||||
|
||||
## Thanks
|
||||
|
||||
|
||||
10
README.zh.md
10
README.zh.md
@@ -10,7 +10,7 @@
|
||||
|
||||
> 本主题的所有页面设计和配置项都与原来 `Hexo` 引擎的 `NexT` 主题保持了良好的兼容性,可以非常平滑的从 `Hexo` 迁移至 `Hugo` 引擎,欢迎大家使用并反馈。
|
||||
|
||||
[](https://gitter.im/hugo-next/community) [](https://github.com/gohugoio/hugo/releases/latest) [](https://github.com/hugo-next/hugo-theme-next) [](https://github.com/hugo-next/hugo-theme-next/find/main) [](https://github.com/hugo-next/hugo-theme-next/blob/main/LICENSE)
|
||||
[](https://gitter.im/hugo-next/community) [](https://github.com/gohugoio/hugo/releases/latest) [](https://github.com/hugo-next/hugo-theme-next) [](https://github.com/hugo-next/hugo-theme-next/find/main) [](https://github.com/hugo-next/hugo-theme-next/blob/main/LICENSE)
|
||||
|
||||
## 4 种页面模式
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
$ hugo new site hugo-next-exmaple
|
||||
$ cd hugo-next-exmaple
|
||||
$ git init
|
||||
$ hugo submodule add https://github.com/hugo-next/hugo-theme-next.git themes/hugo-theme-next
|
||||
$ git submodule add https://github.com/hugo-next/hugo-theme-next.git themes/hugo-theme-next
|
||||
$ cp -r themes/hugo-theme-next/exampleSite/* .
|
||||
$ rm -rf config.toml
|
||||
$ hugo server
|
||||
@@ -61,7 +61,7 @@ $ git submodule update --remote
|
||||
$ hugo new posts/hello-world.md
|
||||
```
|
||||
|
||||
关于文章头部的那些标记作用的说明参考如下:
|
||||
关于文章头部那些参数作用的说明参考如下:
|
||||
|
||||
|
||||
```yml
|
||||
@@ -122,7 +122,7 @@ tags:
|
||||
|
||||
[MIT License](LICENSE)
|
||||
|
||||
Copyright (c) 2022, hugo-next teams
|
||||
Copyright (c) 2022, hugo-next 团队
|
||||
|
||||
## 致谢
|
||||
|
||||
@@ -133,4 +133,4 @@ Copyright (c) 2022, hugo-next teams
|
||||
| 捐助时间 | 捐助者 | 捐助方式 | 捐助内容 | 留言 |
|
||||
| :-------: | ------ | ------ | ---- | ---- |
|
||||
| 2021.12.21 | z*y | 微信支付 | ¥18.88 | / |
|
||||
| 2022.05.08 | *泉 | 微信支付 | ¥6.60 | 祝开发next顺利 |
|
||||
| 2022.05.08 | *泉 | 微信支付 | ¥6.60 | 祝开发next顺利 |顺利 |
|
||||
@@ -7,7 +7,7 @@ date: {{ .Date }}
|
||||
lastmod: {{ .Date }}
|
||||
|
||||
categories:
|
||||
-
|
||||
-
|
||||
tags:
|
||||
-
|
||||
-
|
||||
@@ -30,7 +30,7 @@ tags:
|
||||
# 在当前页面开启或关闭评论功能
|
||||
# Switch to enabled or disabled comment plugins in this post
|
||||
#comment:
|
||||
# enable: false
|
||||
# enable: false
|
||||
# 开启文章目录功能
|
||||
# Enable table of content
|
||||
#toc: false
|
||||
|
||||
141
assets/css/_common/components/pages/flinks.scss
Normal file
141
assets/css/_common/components/pages/flinks.scss
Normal file
@@ -0,0 +1,141 @@
|
||||
.flinks-block {
|
||||
|
||||
.flinks-block-title {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.flinks-list-title {
|
||||
font-size: 1.25em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.flinks-lists > div:not(:first-child) {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.flinks-list-desc {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.flinks-list-items {
|
||||
overflow: auto;
|
||||
padding: 10px 10px 0;
|
||||
text-align: center;
|
||||
|
||||
|
||||
|
||||
.flinks-list-item {
|
||||
@include mobile() {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
position: relative;
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
margin: 15px 7px;
|
||||
width: calc(100% / 3 - 18px);
|
||||
height: 90px;
|
||||
border-radius: 8px;
|
||||
line-height: 17px;
|
||||
-webkit-transform: translateZ(0);
|
||||
border: groove 1px var(--highlight-foreground);
|
||||
box-shadow: .6rem .5rem 0.3rem var(--body-bg-color);
|
||||
|
||||
&:hover:before,
|
||||
&:focus:before,
|
||||
&:active:before {
|
||||
-webkit-transform:scale(1);
|
||||
-moz-transform:scale(1);
|
||||
-o-transform:scale(1);
|
||||
-ms-transform:scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
|
||||
&:hover .flinks-item-icon {
|
||||
margin-left:-10px;
|
||||
width:0;
|
||||
}
|
||||
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: -1;
|
||||
background: var(--body-bg-color);
|
||||
content: ' ';
|
||||
transition: transform .3s ease-out;
|
||||
transform: scale(0);
|
||||
}
|
||||
|
||||
a {
|
||||
//color: var(--font-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.flinks-item-icon {
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
margin: 15px 10px;
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 35px;
|
||||
border: solid 1px var(--body-bg-color);
|
||||
-webkit-transition: width .3s ease-out;
|
||||
-moz-transition: width .3s ease-out;
|
||||
-o-transition: width .3s ease-out;
|
||||
-ms-transition: width .3s ease-out;
|
||||
transition: width .3s ease-out;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
-webkit-transition: filter 375ms ease-in .2s,-webkit-transform .3s;
|
||||
-moz-transition: filter 375ms ease-in .2s,-moz-transform .3s;
|
||||
-o-transition: filter 375ms ease-in .2s,-o-transform .3s;
|
||||
-ms-transition: filter 375ms ease-in .2s,-ms-transform .3s;
|
||||
transition: filter 375ms ease-in .2s,transform .3s;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.flinks-item-name, .flinks-item-desc {
|
||||
overflow:hidden;
|
||||
-o-text-overflow:ellipsis;
|
||||
text-overflow:ellipsis;
|
||||
white-space:nowrap
|
||||
}
|
||||
|
||||
.flinks-item-name {
|
||||
padding: 20px 0 0 0;
|
||||
height: 20px;
|
||||
font-weight: 700;
|
||||
font-size: 1em;
|
||||
font-weight: bold;
|
||||
|
||||
@include mobile() {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.flinks-item-desc {
|
||||
padding: 10px 0;
|
||||
font-size: .92em;
|
||||
|
||||
@include mobile() {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.flinks-page-desc {
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
@@ -3,3 +3,4 @@
|
||||
@import 'schedule';
|
||||
@import 'breadcrumb';
|
||||
@import 'tag-cloud';
|
||||
@import 'flinks';
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
.use-motion {
|
||||
@if $motion_trans_post_block {
|
||||
.post-block, .pagination, .comments, .post-comments {
|
||||
.post-block, .flinks-block, .pagination, .comments, .post-comments {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,4 +76,8 @@
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
svg {
|
||||
max-width: 98%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Fix issue #16
|
||||
// To do: use `gap` instead of `margin`
|
||||
// See https://caniuse.com/flexbox-gap
|
||||
.post-footer {
|
||||
.post-footer, .flinks-list-footer {
|
||||
@include flex-column();
|
||||
|
||||
hr{
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
height: 0;
|
||||
}
|
||||
|
||||
@if $busuanzi_enable and $busuanzi_post_views {
|
||||
@if $busuanzi_post_views {
|
||||
#busuanzi_container_page_pv {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
@@ -106,6 +106,13 @@
|
||||
padding: 5px 0;
|
||||
}
|
||||
}
|
||||
|
||||
mark.search-keyword {
|
||||
background: transparent;
|
||||
border-bottom: 1px dashed $red;
|
||||
color: $red;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
@if $algolia_search_enable {
|
||||
@@ -169,11 +176,4 @@
|
||||
margin: auto;
|
||||
}
|
||||
}
|
||||
|
||||
mark.search-keyword {
|
||||
background: transparent;
|
||||
border-bottom: 1px dashed $red;
|
||||
color: $red;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,17 +98,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@if $busuanzi_enable {
|
||||
.busuanzi-count {
|
||||
@if $busuanzi_visitors {
|
||||
#busuanzi_container_site_uv {
|
||||
display: none;
|
||||
}
|
||||
.busuanzi-count {
|
||||
@if $busuanzi_visitors {
|
||||
#busuanzi_container_site_uv {
|
||||
display: none;
|
||||
}
|
||||
@if $busuanzi_views {
|
||||
#busuanzi_container_site_pv {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@if $busuanzi_views {
|
||||
#busuanzi_container_site_pv {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,29 @@
|
||||
.highlight {
|
||||
|
||||
background: var(--highlight-background);
|
||||
margin-bottom: 26px;
|
||||
|
||||
.table-container, pre {
|
||||
//TODO Need fixed the copy button show position.
|
||||
div:first-child {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
pre {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.table-container table tbody tr {
|
||||
background: none;
|
||||
table tbody tr {
|
||||
//TODO Fixed the too long code line over
|
||||
// layout background color.
|
||||
background: #272822;
|
||||
}
|
||||
|
||||
/* pre > code span {
|
||||
white-space: break-spaces;
|
||||
overflow: hidden;
|
||||
word-break: break-all;
|
||||
word-wrap: break-word;
|
||||
} */
|
||||
}
|
||||
|
||||
@if $codeblock_copy_btn_enable {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 10px;
|
||||
padding: 18px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//@use 'sass:map';
|
||||
|
||||
@if $note_style != 'disabled' {
|
||||
.post-body .note {
|
||||
.main .note {
|
||||
$note-icons : $note_icons;
|
||||
$note-style : $note_style;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
// ==================================================
|
||||
// Post blocks.
|
||||
.main-inner > {
|
||||
.sub-menu, .post-block, .tabs-comment, .comments, .post-comments, .pagination {
|
||||
.sub-menu, .post-block, .flinks-block, .tabs-comment, .comments, .post-comments, .pagination {
|
||||
background: var(--content-bg-color);
|
||||
border-radius: $border-radius-inner;
|
||||
box-shadow: $box-shadow-inner;
|
||||
@@ -47,7 +47,7 @@
|
||||
}
|
||||
|
||||
// Post & Comments blocks.
|
||||
.post-block, .comments, .post-comments {
|
||||
.post-block, .flinks-block, .comments, .post-comments {
|
||||
padding: $content-desktop-padding;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.post-block {
|
||||
.post-block, .flinks-block {
|
||||
// Inside posts blocks content padding (default 40px).
|
||||
padding: ($content-tablet-padding * 2);
|
||||
}
|
||||
@@ -119,7 +119,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.post-block {
|
||||
.post-block, .flinks-block {
|
||||
// Inside posts blocks content padding (default 40px).
|
||||
padding: $sidebar-offset;
|
||||
}
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
// All variables from site's config content.
|
||||
// In order not to conflict with the existing variables of SCSS and better identify,
|
||||
// add a cfg_ prefix before the variable name
|
||||
|
||||
{{- $P := .Site.Params -}}
|
||||
|
||||
// Base variables
|
||||
$scheme: {{ default $P.scheme "Gemini" }};
|
||||
$cfg_darkmode: {{ $P.darkmode }};
|
||||
|
||||
$cfg_thm_cor_light: {{ $P.themeColor.light }};
|
||||
$cfg_thm_cor_dark: {{ $P.themeColor.dark }};
|
||||
|
||||
$cfg_font_enable: {{ default $P.font.enable false }};
|
||||
$cfg_font_global_size: {{ default $P.font.global.size 1 }};
|
||||
$cfg_font_headings_size: {{ default $P.font.headings.size 1 }};
|
||||
$cfg_font_title_size: {{ default $P.font.title.size 1 }};
|
||||
$cfg_font_codes_size: {{ default $P.font.codes.size 1 }};
|
||||
$cfg_font_posts_size: {{ default $P.font.posts.size 1 }};
|
||||
|
||||
// TODO
|
||||
$cfg_hl_light_bg: #222;
|
||||
$cfg_hl_light_fg: #000;
|
||||
$cfg_hl_dark_bg: #000;
|
||||
$cfg_hl_dark_fg: #222;
|
||||
|
||||
$cfg_sidebar_width: {{ $P.sidebar.width }};
|
||||
$cfg_sidebar_position: {{ $P.sidebar.position }};
|
||||
$cfg_sidebar_padding: {{ default $P.sidebar.padding 18 }};
|
||||
$cfg_sidebar_offset: {{ default $P.sidebar.offset 12 }};
|
||||
|
||||
// TODO
|
||||
$cfg_note_light_bg_offset: 0;
|
||||
|
||||
// Scaffolding Variables
|
||||
$cfg_bd_scrollbar_overlay: {{ $P.bodyScrollbar.overlay }};
|
||||
$cfg_bd_scrollbar_stable: {{ $P.bodyScrollbar.stable }};
|
||||
|
||||
$cfg_codeblock_copy_btn_style: {{ $P.codeblock.copyBtn.style }};
|
||||
|
||||
$cfg_mermaid_enable: {{ $P.mermaid.enable }};
|
||||
|
||||
$cfg_note_style: {{ $P.note.style }};
|
||||
$cfg_note_icons: {{ $P.note.icons }};
|
||||
|
||||
$cfg_pdf_enable: {{ $P.pdf.enable }};
|
||||
$cfg_pdf_height: {{ $P.pdf.height }};
|
||||
|
||||
$cfg_tabs_trans_tabs: {{ $P.tabs.transition.tabs }};
|
||||
$cfg_tabs_trans_labels: {{ $P.tabs.transition.labels }};
|
||||
|
||||
// Outline Variables
|
||||
$cfg_footer_icon_color: {{ $P.footer.icon.color }};
|
||||
$cfg_footer_icon_animated: {{ $P.footer.icon.animated }};
|
||||
|
||||
$cfg_footer_beian_enable: {{ $P.footer.beian.enable }};
|
||||
|
||||
$cfg_busuanzi_enable: {{ $P.busuanzi.enable }};
|
||||
$cfg_busuanzi_visitors: {{ $P.busuanzi.visitors }};
|
||||
$cfg_busuanzi_views: {{ $P.busuanzi.views }};
|
||||
|
||||
$cfg_bookmark_enable: {{ $P.bookmark.enable }};
|
||||
$cfg_bookmark_color: {{ $P.bookmark.color }};
|
||||
|
||||
$cfg_github_banner_enable: {{ $P.githubBanner.enable }};
|
||||
|
||||
$cfg_local_search_enable: {{ $P.localSearch.enable }};
|
||||
$cfg_algolia_search_enable: {{ $P.algoliaSearch.enable }};
|
||||
|
||||
$cfg_mobile_layout_economy: {{ $P.mobileLayoutEconomy }};
|
||||
|
||||
$cfg_note_icons: {{ $P.note.icons }};
|
||||
|
||||
$cfg_social_icons_only: {{ $P.socialIcons.iconsOnly }};
|
||||
|
||||
$cfg_avatar_rounded: {{ $P.avatar.rounded }};
|
||||
$cfg_avatar_rotated: {{ $P.avatar.rotated }};
|
||||
|
||||
$cfg_toc_enable: {{ $P.toc.enable }};
|
||||
$cfg_toc_wrap: {{ $P.toc.wrap }};
|
||||
$cfg_toc_expand_all: {{ $P.toc.expandAll }};
|
||||
|
||||
$cfg_site_state: {{ $P.siteState }};
|
||||
|
||||
//
|
||||
$cfg_back2top_enable: {{ $P.backTop.enable }};
|
||||
$cfg_back2top_scrollpercent: {{ $P.backTop.scrollPercent }};
|
||||
$cfg_back2top_sidebar: {{ $P.backTop.sidebar }};
|
||||
|
||||
$cfg_reading_progress_enable: {{ $P.readingProgress.enable }};
|
||||
$cfg_reading_progress_color: {{ $P.readingProgress.color }};
|
||||
$cfg_reading_progress_height: {{ $P.readingProgress.height }};
|
||||
$cfg_reading_progress_reversed: {{ $P.readingProgress.reversed }};
|
||||
$cfg_reading_progress_start: {{ $P.readingProgress.start }};
|
||||
$cfg_reading_progress_position: {{ $P.readingProgress.position }};
|
||||
|
||||
@@ -34,7 +34,6 @@ $footer_vendors_enable : {{ isset $P.footer "vendors" }};
|
||||
{{ end }}
|
||||
|
||||
// Counter
|
||||
$busuanzi_enable : {{ $P.busuanzi.enable }};
|
||||
$busuanzi_visitors : {{ $P.busuanzi.visitors }};
|
||||
$busuanzi_views : {{ $P.busuanzi.views }};
|
||||
$busuanzi_post_views : {{ $P.busuanzi.postViews }};
|
||||
@@ -132,9 +131,9 @@ $gitter_enable : {{ $P.gitter.enable }};
|
||||
// Comment
|
||||
//$disqusjs_enable : {{ $P.disqusjs.enable }};
|
||||
$disqusjs_enable : false;
|
||||
$livere_enable : {{ isset $P.livere "uid" }};
|
||||
$utterances_enable : {{ isset $P.utterances "utterances" }};
|
||||
$waline_enable : {{ isset $P.waline "serverurl" }};
|
||||
$livere_enable : {{ isset $P "livere" }};
|
||||
$utterances_enable : {{ isset $P "utterances" }};
|
||||
$waline_enable : {{ isset $P "waline" }};
|
||||
{{- with .Site.Params.comments }}
|
||||
{{- $tce := and (isset . "nav") (and .storage (gt (len .nav) 1)) }}
|
||||
$two_comments_enable : {{ $tce }};
|
||||
|
||||
@@ -52,5 +52,5 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
document.addEventListener('pjax:success', scrollToMark);
|
||||
};
|
||||
|
||||
init(CONFIG.bookmark.save);
|
||||
init(NexT.CONFIG.bookmark.save);
|
||||
});
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
element.addEventListener('click', () => {
|
||||
commentButton.forEach(active => active.classList.toggle('active', active === element));
|
||||
document.querySelectorAll('.comment-position').forEach(active => active.classList.toggle('active', active.classList.contains(commentClass)));
|
||||
if (CONFIG.comments.storage) {
|
||||
if (NexT.CONFIG.comments.storage) {
|
||||
localStorage.setItem('comments_active', commentClass);
|
||||
}
|
||||
});
|
||||
});
|
||||
let { activeClass } = CONFIG.comments;
|
||||
if (CONFIG.comments.storage) {
|
||||
let { activeClass } = NexT.CONFIG.comments;
|
||||
if (NexT.CONFIG.comments.storage) {
|
||||
activeClass = localStorage.getItem('comments_active') || activeClass;
|
||||
}
|
||||
if (activeClass) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* global CONFIG */
|
||||
|
||||
window.addEventListener('tabs:register', () => {
|
||||
let { activeClass } = CONFIG.comments;
|
||||
if (CONFIG.comments.storage) {
|
||||
let { activeClass } = NexT.CONFIG.comments;
|
||||
if (NexT.CONFIG.comments.storage) {
|
||||
activeClass = localStorage.getItem('comments_active') || activeClass;
|
||||
}
|
||||
if (activeClass) {
|
||||
@@ -12,7 +12,7 @@ window.addEventListener('tabs:register', () => {
|
||||
}
|
||||
}
|
||||
});
|
||||
if (CONFIG.comments.storage) {
|
||||
if (NexT.CONFIG.comments.storage) {
|
||||
window.addEventListener('tabs:click', event => {
|
||||
if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
|
||||
const commentClass = event.target.classList[1];
|
||||
|
||||
@@ -1,51 +1,67 @@
|
||||
if (!window.NexT) window.NexT = {};
|
||||
|
||||
(function() {
|
||||
const className = 'next-config';
|
||||
|
||||
const siteConfig = {
|
||||
"hostname" : "{{ .Site.BaseURL }}",
|
||||
"root" : "/",
|
||||
"images" : "{{ .Site.Params.images }}",
|
||||
"scheme" : "{{ .Site.Params.scheme }}",
|
||||
"darkmode" : {{ .Site.Params.darkmode }},
|
||||
"version" : "{{ .Site.Data.config.version }}",
|
||||
"sidebar" : {{ .Site.Params.sidebar | jsonify }},
|
||||
"copybtn" : {{ .Site.Params.codeblock.copyBtn }},
|
||||
"bookmark" : {{ .Site.Params.bookmark | jsonify }},
|
||||
"comments" : {{ .Site.Params.comments | jsonify }},
|
||||
"lazyload" : {{ .Site.Params.lazyload }},
|
||||
"pangu" : {{ .Site.Params.pangu }},
|
||||
"stickytabs" : {{ .Site.Params.tabs.sticky }},
|
||||
"motion" : {{ .Site.Params.motion | jsonify }},
|
||||
// TODO Find prismjs
|
||||
//"prism" : "",
|
||||
"i18n" : {
|
||||
"placeholder" : "",
|
||||
"empty" : "${query}",
|
||||
"hits_time" : "'${hits}', '${time}'",
|
||||
"hits" : "${hits}"
|
||||
},
|
||||
{{- if .Site.Params.algoliaSearch.enable }}
|
||||
// TODO
|
||||
"algolia" : {
|
||||
"appID" : "",
|
||||
"apiKey" : "",
|
||||
"indexName" : "",
|
||||
"hits" : ""
|
||||
const staticConfig = {};
|
||||
let variableConfig = {};
|
||||
|
||||
const parse = text => JSON.parse(text || '{}');
|
||||
|
||||
const update = name => {
|
||||
const targetEle = document.querySelector(`.${className}[data-name="${name}"]`);
|
||||
if (!targetEle) return;
|
||||
const parsedConfig = parse(targetEle.text);
|
||||
if (name === 'main') {
|
||||
Object.assign(staticConfig, parsedConfig);
|
||||
} else {
|
||||
variableConfig[name] = parsedConfig;
|
||||
}
|
||||
{{- end }}
|
||||
{{- if .Site.Params.localSearch.enable }}
|
||||
// TODO
|
||||
"path" : "/search.json",
|
||||
"localsearch": {{ .Site.Params.localSearch | jsonify }},
|
||||
{{- end }}
|
||||
"lang" : "{{ .Site.LanguageCode }}",
|
||||
"permalink" : "{{ .Page.Permalink | absURL }}",
|
||||
"title" : "{{ .Page.Title }}",
|
||||
"isHome" : {{ .IsHome }},
|
||||
"isPage" : {{ .IsPage }}
|
||||
};
|
||||
|
||||
window.CONFIG = new Proxy(siteConfig, {});
|
||||
|
||||
update('main');
|
||||
|
||||
window.NexT.CONFIG = new Proxy({}, {
|
||||
get(overrideConfig, name) {
|
||||
let existing;
|
||||
if (name in staticConfig) {
|
||||
existing = staticConfig[name];
|
||||
} else {
|
||||
if (!(name in variableConfig)) update(name);
|
||||
existing = variableConfig[name];
|
||||
}
|
||||
|
||||
// For unset override and mixable existing
|
||||
if (!(name in overrideConfig) && typeof existing === 'object') {
|
||||
// Get ready to mix.
|
||||
overrideConfig[name] = {};
|
||||
}
|
||||
|
||||
if (name in overrideConfig) {
|
||||
const override = overrideConfig[name];
|
||||
|
||||
// When mixable
|
||||
if (typeof override === 'object' && typeof existing === 'object') {
|
||||
// Mix, proxy changes to the override.
|
||||
return new Proxy({ ...existing, ...override }, {
|
||||
set(target, prop, value) {
|
||||
target[prop] = value;
|
||||
override[prop] = value;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return override;
|
||||
}
|
||||
|
||||
// Only when not mixable and override hasn't been set.
|
||||
return existing;
|
||||
}
|
||||
});
|
||||
|
||||
// TODO
|
||||
// document.addEventListener('pjax:success', () => {
|
||||
// variableConfig = {};
|
||||
// });
|
||||
})();
|
||||
@@ -10,12 +10,12 @@ NexT.motion.integrator = {
|
||||
},
|
||||
add: function(fn) {
|
||||
const sequence = fn();
|
||||
if (CONFIG.motion.async) this.queue.push(sequence);
|
||||
if (NexT.CONFIG.motion.async) this.queue.push(sequence);
|
||||
else this.queue = this.queue.concat(sequence);
|
||||
return this;
|
||||
},
|
||||
bootstrap: function() {
|
||||
if (!CONFIG.motion.async) this.queue = [this.queue];
|
||||
if (!NexT.CONFIG.motion.async) this.queue = [this.queue];
|
||||
this.queue.forEach(sequence => {
|
||||
const timeline = window.anime.timeline({
|
||||
duration: 200,
|
||||
@@ -52,12 +52,12 @@ NexT.motion.middleWares = {
|
||||
}
|
||||
|
||||
pushToSequence('header.header');
|
||||
CONFIG.scheme === 'Mist' && getMistLineSettings('.logo-line');
|
||||
CONFIG.scheme === 'Muse' && pushToSequence('.custom-logo-image');
|
||||
NexT.CONFIG.scheme === 'Mist' && getMistLineSettings('.logo-line');
|
||||
NexT.CONFIG.scheme === 'Muse' && pushToSequence('.custom-logo-image');
|
||||
pushToSequence('.site-title');
|
||||
pushToSequence('.site-brand-container .toggle', true);
|
||||
pushToSequence('.site-subtitle');
|
||||
(CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') && pushToSequence('.custom-logo-image');
|
||||
(NexT.CONFIG.scheme === 'Pisces' || NexT.CONFIG.scheme === 'Gemini') && pushToSequence('.custom-logo-image');
|
||||
|
||||
document.querySelectorAll('.menu-item').forEach(targets => {
|
||||
sequence.push({
|
||||
@@ -82,7 +82,7 @@ NexT.motion.middleWares = {
|
||||
|
||||
postList: function() {
|
||||
const sequence = [];
|
||||
const { postblock, postheader, postbody, collheader } = CONFIG.motion.transition;
|
||||
const { postblock, postheader, postbody, collheader } = NexT.CONFIG.motion.transition;
|
||||
|
||||
function animate(animation, selector) {
|
||||
if (!animation) return;
|
||||
@@ -95,7 +95,7 @@ NexT.motion.middleWares = {
|
||||
});
|
||||
}
|
||||
|
||||
animate(postblock, '.post-block, .pagination, .post-comments');
|
||||
animate(postblock, '.post-block,.flinks-block, .pagination, .post-comments');
|
||||
animate(collheader, '.collection-header');
|
||||
animate(postheader, '.post-header');
|
||||
animate(postbody, '.post-body');
|
||||
@@ -105,9 +105,9 @@ NexT.motion.middleWares = {
|
||||
|
||||
sidebar: function() {
|
||||
const sidebar = document.querySelector('.sidebar');
|
||||
const sidebarTransition = CONFIG.motion.transition.sidebar;
|
||||
const sidebarTransition = NexT.CONFIG.motion.transition.sidebar;
|
||||
// Only for Pisces | Gemini.
|
||||
if (sidebarTransition && (CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini')) {
|
||||
if (sidebarTransition && (NexT.CONFIG.scheme === 'Pisces' || NexT.CONFIG.scheme === 'Gemini')) {
|
||||
return [{
|
||||
targets : sidebar,
|
||||
complete: () => sidebar.classList.add('animated', sidebarTransition)
|
||||
|
||||
@@ -5,7 +5,7 @@ NexT.boot = {};
|
||||
NexT.boot.registerEvents = function() {
|
||||
|
||||
NexT.utils.registerScrollPercent();
|
||||
NexT.utils.registerCanIUseTag();
|
||||
// NexT.utils.registerCanIUseTag();
|
||||
|
||||
// Mobile top menu bar.
|
||||
document.querySelector('.site-nav-toggle .toggle').addEventListener('click', event => {
|
||||
@@ -33,33 +33,41 @@ NexT.boot.registerEvents = function() {
|
||||
|
||||
NexT.boot.refresh = function() {
|
||||
|
||||
/**
|
||||
if (!NexT.CONFIG.page.isPage) return;
|
||||
|
||||
NexT.utils.registerSidebarTOC();
|
||||
NexT.utils.replacePostCRLink();
|
||||
NexT.utils.registerCopyCode();
|
||||
NexT.utils.registerPostReward();
|
||||
if(NexT.CONFIG.page.comments) {
|
||||
NexT.utils.initCommontesDispaly();
|
||||
NexT.utils.registerCommonSwitch();
|
||||
} else {
|
||||
NexT.utils.hideCommontes();
|
||||
}
|
||||
|
||||
//TODO
|
||||
/**
|
||||
* Register JS handlers by condition option.
|
||||
* Need to add config option in Front-End at 'scripts/helpers/next-config.js' file.
|
||||
*/
|
||||
//CONFIG.prism && window.Prism.highlightAll();
|
||||
/*CONFIG.mediumzoom && window.mediumZoom('.post-body :not(a) > img, .post-body > img', {
|
||||
//NexT.CONFIG.prism && window.Prism.highlightAll();
|
||||
/*NexT.CONFIG.mediumzoom && window.mediumZoom('.post-body :not(a) > img, .post-body > img', {
|
||||
background: 'var(--content-bg-color)'
|
||||
});*/
|
||||
CONFIG.lazyload && window.lozad('.post-body img').observe();
|
||||
CONFIG.pangu && window.pangu.spacingPage();
|
||||
|
||||
CONFIG.isPage && NexT.utils.replacePostCRLink();
|
||||
CONFIG.isPage && CONFIG.copybtn && NexT.utils.registerCopyCode();
|
||||
NexT.utils.registerTabsTag();
|
||||
/*NexT.utils.registerActiveMenuItem();
|
||||
// NexT.CONFIG.lazyload && window.lozad('.post-body img').observe();
|
||||
// NexT.CONFIG.pangu && window.pangu.spacingPage();
|
||||
/*NexT.utils.registerTabsTag();
|
||||
NexT.utils.registerActiveMenuItem();
|
||||
NexT.utils.registerLangSelect();*/
|
||||
CONFIG.isPage && NexT.utils.registerSidebarTOC();
|
||||
CONFIG.isPage && NexT.utils.registerPostReward();
|
||||
CONFIG.isPage && NexT.utils.initCommontesDispaly();
|
||||
CONFIG.isPage && NexT.utils.registerCommonSwitch();
|
||||
NexT.utils.wrapTableWithBox();
|
||||
NexT.utils.registerVideoIframe();
|
||||
/*NexT.utils.wrapTableWithBox();
|
||||
NexT.utils.registerVideoIframe();*/
|
||||
|
||||
};
|
||||
|
||||
NexT.boot.motion = function() {
|
||||
// Define Motion Sequence & Bootstrap Motion.
|
||||
if (CONFIG.motion.enable) {
|
||||
if (NexT.CONFIG.motion.enable) {
|
||||
NexT.motion.integrator
|
||||
.add(NexT.motion.middleWares.header)
|
||||
.add(NexT.motion.middleWares.postList)
|
||||
@@ -72,6 +80,6 @@ NexT.boot.motion = function() {
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
NexT.boot.registerEvents();
|
||||
NexT.boot.refresh();
|
||||
NexT.boot.motion();
|
||||
NexT.boot.refresh();
|
||||
});
|
||||
|
||||
@@ -11,21 +11,21 @@ const pjax = new Pjax({
|
||||
],
|
||||
analytics: false,
|
||||
cacheBust: false,
|
||||
scrollTo : !CONFIG.bookmark.enable
|
||||
scrollTo : !NexT.CONFIG.bookmark.enable
|
||||
});
|
||||
|
||||
document.addEventListener('pjax:success', () => {
|
||||
pjax.executeScripts(document.querySelectorAll('script[data-pjax]'));
|
||||
NexT.boot.refresh();
|
||||
// Define Motion Sequence & Bootstrap Motion.
|
||||
if (CONFIG.motion.enable) {
|
||||
if (NexT.CONFIG.motion.enable) {
|
||||
NexT.motion.integrator
|
||||
.init()
|
||||
.add(NexT.motion.middleWares.subMenu)
|
||||
.add(NexT.motion.middleWares.postList)
|
||||
.bootstrap();
|
||||
}
|
||||
if (CONFIG.sidebar.display !== 'remove') {
|
||||
if (NexT.CONFIG.sidebar.display !== 'remove') {
|
||||
const hasTOC = document.querySelector('.post-toc');
|
||||
document.querySelector('.sidebar-inner').classList.toggle('sidebar-nav-active', hasTOC);
|
||||
NexT.utils.activateSidebarPanel(hasTOC ? 0 : 1);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
const isRight = CONFIG.sidebar.position === 'right';
|
||||
const isRight = NexT.CONFIG.sidebar.position === 'right';
|
||||
|
||||
const sidebarToggleMotion = {
|
||||
mouse: {},
|
||||
@@ -46,7 +46,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
document.body.classList.remove('sidebar-active');
|
||||
}
|
||||
};
|
||||
if (CONFIG.sidebar.display !== 'remove') sidebarToggleMotion.init();
|
||||
if (NexT.CONFIG.sidebar.display !== 'remove') sidebarToggleMotion.init();
|
||||
|
||||
function updateFooterPosition() {
|
||||
const footer = document.querySelector('.footer');
|
||||
|
||||
36
assets/js/third-party/comments/artalk.js
vendored
Normal file
36
assets/js/third-party/comments/artalk.js
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
const element = '.artalk-container';
|
||||
if (!NexT.CONFIG.page.comments
|
||||
|| !NexT.CONFIG.artalk
|
||||
|| !NexT.utils.checkDOMExist(element)) return;
|
||||
|
||||
const artalk_css = NexT.utils.getCDNResource(NexT.CONFIG.artalk.css);
|
||||
NexT.utils.getStyle(artalk_css, null);
|
||||
|
||||
const artalk_js = NexT.utils.getCDNResource(NexT.CONFIG.artalk.js);
|
||||
const {
|
||||
site,
|
||||
placeholder,
|
||||
server,
|
||||
} = NexT.CONFIG.artalk.cfg;
|
||||
|
||||
NexT.utils.loadComments(element)
|
||||
.then(() => NexT.utils.getScript(artalk_js, {
|
||||
}))
|
||||
.then(() => {
|
||||
|
||||
new Artalk({
|
||||
el : element,
|
||||
pageKey : NexT.CONFIG.permalink,
|
||||
pageTitle : NexT.CONFIG.title,
|
||||
server : server,
|
||||
site : site,
|
||||
locale : NexT.CONFIG.lang,
|
||||
placeholder : placeholder,
|
||||
darkMode : 'auto'
|
||||
});
|
||||
|
||||
NexT.utils.hiddeLodingCmp(element);
|
||||
});
|
||||
});
|
||||
39
assets/js/third-party/comments/changyan.js
vendored
39
assets/js/third-party/comments/changyan.js
vendored
@@ -1,39 +0,0 @@
|
||||
/* global NexT, CONFIG */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
const { appid, appkey } = CONFIG.changyan;
|
||||
const mainJs = 'https://cy-cdn.kuaizhan.com/upload/changyan.js';
|
||||
const countJs = `https://cy-cdn.kuaizhan.com/upload/plugins/plugins.list.count.js?clientId=${appid}`;
|
||||
|
||||
// Get the number of comments
|
||||
setTimeout(() => {
|
||||
return NexT.utils.getScript(countJs, {
|
||||
attributes: {
|
||||
async: true,
|
||||
id : 'cy_cmt_num'
|
||||
}
|
||||
});
|
||||
}, 0);
|
||||
|
||||
// When scroll to comment section
|
||||
if (CONFIG.page.comments && !CONFIG.page.isHome) {
|
||||
NexT.utils.loadComments('#SOHUCS')
|
||||
.then(() => {
|
||||
return NexT.utils.getScript(mainJs, {
|
||||
attributes: {
|
||||
async: true
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
window.changyan.api.config({
|
||||
appid,
|
||||
conf: appkey
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Failed to load Changyan', error);
|
||||
});
|
||||
}
|
||||
});
|
||||
41
assets/js/third-party/comments/disqus.js
vendored
41
assets/js/third-party/comments/disqus.js
vendored
@@ -1,41 +0,0 @@
|
||||
/* global NexT, CONFIG, DISQUS */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
|
||||
if (CONFIG.disqus.count) {
|
||||
const loadCount = () => {
|
||||
NexT.utils.getScript(`https://${CONFIG.disqus.shortname}.disqus.com/count.js`, {
|
||||
attributes: { id: 'dsq-count-scr' }
|
||||
});
|
||||
};
|
||||
|
||||
// defer loading until the whole page loading is completed
|
||||
window.addEventListener('load', loadCount, false);
|
||||
}
|
||||
|
||||
if (CONFIG.page.comments) {
|
||||
// `disqus_config` should be a global variable
|
||||
// See https://help.disqus.com/en/articles/1717084-javascript-configuration-variables
|
||||
window.disqus_config = function() {
|
||||
this.page.url = CONFIG.page.permalink;
|
||||
this.page.identifier = CONFIG.page.path;
|
||||
this.page.title = CONFIG.page.title;
|
||||
if (CONFIG.disqus.i18n.disqus !== 'disqus') {
|
||||
this.language = CONFIG.disqus.i18n.disqus;
|
||||
}
|
||||
};
|
||||
NexT.utils.loadComments('#disqus_thread').then(() => {
|
||||
if (window.DISQUS) {
|
||||
DISQUS.reset({
|
||||
reload: true,
|
||||
config: window.disqus_config
|
||||
});
|
||||
} else {
|
||||
NexT.utils.getScript(`https://${CONFIG.disqus.shortname}.disqus.com/embed.js`, {
|
||||
attributes: { dataset: { timestamp: '' + +new Date() } }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
18
assets/js/third-party/comments/disqusjs.js
vendored
18
assets/js/third-party/comments/disqusjs.js
vendored
@@ -1,18 +0,0 @@
|
||||
/* global NexT, CONFIG, DisqusJS */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
if (!CONFIG.page.comments) return;
|
||||
|
||||
NexT.utils.loadComments('#disqus_thread')
|
||||
.then(() => NexT.utils.getScript(CONFIG.disqusjs.js, { condition: window.DisqusJS }))
|
||||
.then(() => {
|
||||
window.dsqjs = new DisqusJS({
|
||||
api : CONFIG.disqusjs.api || 'https://disqus.com/api/',
|
||||
apikey : CONFIG.disqusjs.apikey,
|
||||
shortname : CONFIG.disqusjs.shortname,
|
||||
url : CONFIG.page.permalink,
|
||||
identifier: CONFIG.page.path,
|
||||
title : CONFIG.page.title
|
||||
});
|
||||
});
|
||||
});
|
||||
41
assets/js/third-party/comments/giscus.js
vendored
Normal file
41
assets/js/third-party/comments/giscus.js
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
const element = '.giscus-container';
|
||||
if (!NexT.CONFIG.page.comments
|
||||
|| !NexT.CONFIG.giscus
|
||||
|| !NexT.utils.checkDOMExist(element)) return;
|
||||
|
||||
const {
|
||||
category,
|
||||
categoryid,
|
||||
emit,
|
||||
inputposition,
|
||||
mapping,
|
||||
reactions,
|
||||
repo,
|
||||
repoid,
|
||||
theme } = NexT.CONFIG.giscus.cfg;
|
||||
|
||||
|
||||
NexT.utils.loadComments(element)
|
||||
.then(() => NexT.utils.getScript(NexT.CONFIG.giscus.js, {
|
||||
attributes: {
|
||||
'async' : true,
|
||||
'crossorigin' : 'anonymous',
|
||||
'data-repo' : repo,
|
||||
'data-repo-id' : repoid,
|
||||
'data-category' : category,
|
||||
'data-category-id' : categoryid,
|
||||
'data-mapping' : mapping,
|
||||
'data-reactions-enabled' : reactions ? 1:0,
|
||||
'data-emit-metadata' : emit ? 1:0,
|
||||
'data-input-position' : inputposition,
|
||||
'data-theme' : theme,
|
||||
'data-lang' : NexT.CONFIG.lang,
|
||||
'data-loading' : 'lazy'
|
||||
},
|
||||
parentNode: document.querySelector(element)
|
||||
}));
|
||||
|
||||
NexT.utils.hiddeLodingCmp(element);
|
||||
});
|
||||
24
assets/js/third-party/comments/gitalk.js
vendored
24
assets/js/third-party/comments/gitalk.js
vendored
@@ -1,24 +0,0 @@
|
||||
/* global NexT, CONFIG, Gitalk */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
if (!CONFIG.page.comments) return;
|
||||
|
||||
NexT.utils.loadComments('.gitalk-container')
|
||||
.then(() => NexT.utils.getScript(CONFIG.gitalk.js, {
|
||||
condition: window.Gitalk
|
||||
}))
|
||||
.then(() => {
|
||||
const gitalk = new Gitalk({
|
||||
clientID : CONFIG.gitalk.client_id,
|
||||
clientSecret : CONFIG.gitalk.client_secret,
|
||||
repo : CONFIG.gitalk.repo,
|
||||
owner : CONFIG.gitalk.github_id,
|
||||
admin : [CONFIG.gitalk.admin_user],
|
||||
id : CONFIG.gitalk.path_md5,
|
||||
proxy : CONFIG.gitalk.proxy,
|
||||
language : CONFIG.gitalk.language || window.navigator.language,
|
||||
distractionFreeMode: CONFIG.gitalk.distraction_free_mode
|
||||
});
|
||||
gitalk.render(document.querySelector('.gitalk-container'));
|
||||
});
|
||||
});
|
||||
15
assets/js/third-party/comments/isso.js
vendored
15
assets/js/third-party/comments/isso.js
vendored
@@ -1,15 +0,0 @@
|
||||
/* global NexT, CONFIG */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
if (!CONFIG.page.comments) return;
|
||||
|
||||
NexT.utils.loadComments('#isso-thread')
|
||||
.then(() => NexT.utils.getScript(`${CONFIG.isso}js/embed.min.js`, {
|
||||
attributes: {
|
||||
dataset: {
|
||||
isso: `${CONFIG.isso}`
|
||||
}
|
||||
},
|
||||
parentNode: document.querySelector('#isso-thread')
|
||||
}));
|
||||
});
|
||||
23
assets/js/third-party/comments/livere.js
vendored
23
assets/js/third-party/comments/livere.js
vendored
@@ -1,19 +1,18 @@
|
||||
/* global NexT, CONFIG, LivereTower */
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
if (!CONFIG.page.comments) return;
|
||||
const element = '#lv-container';
|
||||
if (!NexT.CONFIG.page.comments
|
||||
|| !NexT.CONFIG.livere
|
||||
|| !NexT.utils.checkDOMExist(element)) return;
|
||||
|
||||
NexT.utils.loadComments('#lv-container').then(() => {
|
||||
window.livereOptions = {
|
||||
refer: CONFIG.page.path.replace(/index\.html$/, '')
|
||||
};
|
||||
|
||||
if (typeof LivereTower === 'function') return;
|
||||
|
||||
NexT.utils.getScript('https://cdn-city.livere.com/js/embed.dist.js', {
|
||||
NexT.utils.loadComments(element).then(() => {
|
||||
NexT.utils.getScript(NexT.CONFIG.livere.js, {
|
||||
attributes: {
|
||||
async: true
|
||||
}
|
||||
},
|
||||
parentNode: document.querySelector(element)
|
||||
});
|
||||
|
||||
NexT.utils.hiddeLodingCmp(element);
|
||||
});
|
||||
});
|
||||
|
||||
32
assets/js/third-party/comments/utterances.js
vendored
32
assets/js/third-party/comments/utterances.js
vendored
@@ -1,17 +1,27 @@
|
||||
/* global NexT, CONFIG */
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
if (!CONFIG.page.comments) return;
|
||||
const element = '.utterances-container';
|
||||
if (!NexT.CONFIG.page.comments
|
||||
|| !NexT.CONFIG.utterances
|
||||
|| !NexT.utils.checkDOMExist(element)) return;
|
||||
|
||||
NexT.utils.loadComments('.utterances-container')
|
||||
.then(() => NexT.utils.getScript('https://utteranc.es/client.js', {
|
||||
const {
|
||||
repo,
|
||||
issueterm,
|
||||
label,
|
||||
theme } = NexT.CONFIG.utterances.cfg;
|
||||
|
||||
NexT.utils.loadComments(element)
|
||||
.then(() => NexT.utils.getScript(NexT.CONFIG.utterances.js, {
|
||||
attributes: {
|
||||
async : true,
|
||||
crossOrigin : 'anonymous',
|
||||
'repo' : CONFIG.utterances.repo,
|
||||
'issue-term': CONFIG.utterances.issue_term,
|
||||
'theme' : CONFIG.utterances.theme
|
||||
'async' : true,
|
||||
'crossorigin' : 'anonymous',
|
||||
'repo' : repo,
|
||||
'issue-term' : issueterm,
|
||||
'theme' : theme
|
||||
},
|
||||
parentNode: document.querySelector('.utterances-container')
|
||||
parentNode: document.querySelector(element)
|
||||
}));
|
||||
|
||||
NexT.utils.hiddeLodingCmp(element);
|
||||
});
|
||||
|
||||
48
assets/js/third-party/comments/waline.js
vendored
Normal file
48
assets/js/third-party/comments/waline.js
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
const element = '.waline-container';
|
||||
if (!NexT.CONFIG.page.comments
|
||||
|| !NexT.CONFIG.waline
|
||||
|| !NexT.utils.checkDOMExist(element)) return;
|
||||
|
||||
const {
|
||||
emoji,
|
||||
imguploader,
|
||||
pageview,
|
||||
placeholder,
|
||||
requiredmeta,
|
||||
serverurl,
|
||||
wordlimit
|
||||
} = NexT.CONFIG.waline.cfg;
|
||||
|
||||
|
||||
const waline_css = NexT.utils.getCDNResource(NexT.CONFIG.waline.css);
|
||||
NexT.utils.getStyle(waline_css, null);
|
||||
|
||||
const waline_js = NexT.utils.getCDNResource(NexT.CONFIG.waline.js);
|
||||
|
||||
const locale = {
|
||||
placeholder: placeholder
|
||||
};
|
||||
|
||||
NexT.utils.loadComments(element)
|
||||
.then(() => NexT.utils.getScript(waline_js, {
|
||||
}))
|
||||
.then(() => {
|
||||
|
||||
Waline.init({
|
||||
locale,
|
||||
el : element,
|
||||
pageview : pageview,
|
||||
emoji : emoji,
|
||||
imageUploader : imguploader,
|
||||
wordLimit : wordlimit,
|
||||
requiredMeta : requiredmeta,
|
||||
serverURL : serverurl,
|
||||
lang : NexT.CONFIG.lang,
|
||||
dark : "auto"
|
||||
});
|
||||
|
||||
NexT.utils.hiddeLodingCmp(element);
|
||||
});
|
||||
});
|
||||
130
assets/js/third-party/search/algolia-search.js
vendored
130
assets/js/third-party/search/algolia-search.js
vendored
@@ -1,130 +0,0 @@
|
||||
/* global instantsearch, algoliasearch, CONFIG, pjax */
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const { indexName, appID, apiKey, hits } = CONFIG.algolia;
|
||||
|
||||
const search = instantsearch({
|
||||
indexName,
|
||||
searchClient : algoliasearch(appID, apiKey),
|
||||
searchFunction: helper => {
|
||||
if (document.querySelector('.search-input').value) {
|
||||
helper.search();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (typeof pjax === 'object') {
|
||||
search.on('render', () => {
|
||||
pjax.refresh(document.querySelector('.algolia-hits'));
|
||||
});
|
||||
}
|
||||
|
||||
// Registering Widgets
|
||||
search.addWidgets([
|
||||
instantsearch.widgets.configure({
|
||||
hitsPerPage: hits.per_page || 10
|
||||
}),
|
||||
|
||||
instantsearch.widgets.searchBox({
|
||||
container : '.search-input-container',
|
||||
placeholder : CONFIG.i18n.placeholder,
|
||||
// Hide default icons of algolia search
|
||||
showReset : false,
|
||||
showSubmit : false,
|
||||
showLoadingIndicator: false,
|
||||
cssClasses : {
|
||||
input: 'search-input'
|
||||
}
|
||||
}),
|
||||
|
||||
instantsearch.widgets.stats({
|
||||
container: '.algolia-stats',
|
||||
templates: {
|
||||
text: data => {
|
||||
const stats = CONFIG.i18n.hits_time
|
||||
.replace('${hits}', data.nbHits)
|
||||
.replace('${time}', data.processingTimeMS);
|
||||
return `<span>${stats}</span>
|
||||
<img src="${CONFIG.images}/logo-algolia-nebula-blue-full.svg" alt="Algolia">`;
|
||||
}
|
||||
},
|
||||
cssClasses: {
|
||||
text: 'search-stats'
|
||||
}
|
||||
}),
|
||||
|
||||
instantsearch.widgets.hits({
|
||||
container : '.algolia-hits',
|
||||
escapeHTML: false,
|
||||
templates : {
|
||||
item: data => {
|
||||
const { title, excerpt, excerptStrip, contentStripTruncate } = data._highlightResult;
|
||||
let result = `<a href="${data.permalink}" class="search-result-title">${title.value}</a>`;
|
||||
const content = excerpt || excerptStrip || contentStripTruncate;
|
||||
if (content && content.value) {
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = content.value;
|
||||
result += `<a href="${data.permalink}"><p class="search-result">${div.textContent.substring(0, 100)}...</p></a>`;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
empty: data => {
|
||||
return `<div class="algolia-hits-empty">
|
||||
${CONFIG.i18n.empty.replace('${query}', data.query)}
|
||||
</div>`;
|
||||
}
|
||||
},
|
||||
cssClasses: {
|
||||
list: 'search-result-list'
|
||||
}
|
||||
}),
|
||||
|
||||
instantsearch.widgets.pagination({
|
||||
container: '.algolia-pagination',
|
||||
scrollTo : false,
|
||||
showFirst: false,
|
||||
showLast : false,
|
||||
templates: {
|
||||
first : '<i class="fa fa-angle-double-left"></i>',
|
||||
last : '<i class="fa fa-angle-double-right"></i>',
|
||||
previous: '<i class="fa fa-angle-left"></i>',
|
||||
next : '<i class="fa fa-angle-right"></i>'
|
||||
},
|
||||
cssClasses: {
|
||||
list : ['pagination', 'algolia-pagination'],
|
||||
item : 'pagination-item',
|
||||
link : 'page-number',
|
||||
selectedItem: 'current',
|
||||
disabledItem: 'disabled-item'
|
||||
}
|
||||
})
|
||||
]);
|
||||
|
||||
search.start();
|
||||
|
||||
// Handle and trigger popup window
|
||||
document.querySelectorAll('.popup-trigger').forEach(element => {
|
||||
element.addEventListener('click', () => {
|
||||
document.body.classList.add('search-active');
|
||||
setTimeout(() => document.querySelector('.search-input').focus(), 500);
|
||||
});
|
||||
});
|
||||
|
||||
// Monitor main search box
|
||||
const onPopupClose = () => {
|
||||
document.body.classList.remove('search-active');
|
||||
};
|
||||
|
||||
document.querySelector('.search-pop-overlay').addEventListener('click', event => {
|
||||
if (event.target === document.querySelector('.search-pop-overlay')) {
|
||||
onPopupClose();
|
||||
}
|
||||
});
|
||||
document.querySelector('.popup-btn-close').addEventListener('click', onPopupClose);
|
||||
document.addEventListener('pjax:success', onPopupClose);
|
||||
window.addEventListener('keyup', event => {
|
||||
if (event.key === 'Escape') {
|
||||
onPopupClose();
|
||||
}
|
||||
});
|
||||
});
|
||||
144
assets/js/third-party/search/algolia.js
vendored
Normal file
144
assets/js/third-party/search/algolia.js
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
/* global instantsearch, algoliasearch, CONFIG, pjax */
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
const algoiajs = NexT.utils.getCDNResource(NexT.CONFIG.algolia.js);
|
||||
const instantschjs = NexT.utils.getCDNResource(NexT.CONFIG.algolia.instantjs);
|
||||
|
||||
NexT.utils.getScript(algoiajs, {});
|
||||
NexT.utils.getScript(instantschjs, {}).then(() => {
|
||||
|
||||
const { indexname, appid, apikey, hits } = NexT.CONFIG.algolia.cfg;
|
||||
const indexName = indexname;
|
||||
|
||||
const search = instantsearch({
|
||||
indexName,
|
||||
searchClient: algoliasearch(appid, apikey),
|
||||
searchFunction: helper => {
|
||||
if (document.querySelector('.search-input').value) {
|
||||
helper.search();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const markKeyWords = function(content) {
|
||||
return content.replaceAll("<mark>", '<mark class="search-keyword">');
|
||||
};
|
||||
|
||||
if (typeof pjax === 'object') {
|
||||
search.on('render', () => {
|
||||
pjax.refresh(document.querySelector('.algolia-hits'));
|
||||
});
|
||||
}
|
||||
|
||||
// Registering Widgets
|
||||
search.addWidgets([
|
||||
instantsearch.widgets.configure({
|
||||
hitsPerPage: hits.perpage || 10
|
||||
}),
|
||||
|
||||
instantsearch.widgets.searchBox({
|
||||
container: '.search-input-container',
|
||||
placeholder: NexT.CONFIG.i18n.placeholder,
|
||||
// Hide default icons of algolia search
|
||||
showReset: false,
|
||||
showSubmit: false,
|
||||
showLoadingIndicator: true,
|
||||
cssClasses: {
|
||||
input: 'search-input'
|
||||
}
|
||||
}),
|
||||
|
||||
instantsearch.widgets.stats({
|
||||
container: '.algolia-stats',
|
||||
templates: {
|
||||
text: data => {
|
||||
const stats = NexT.CONFIG.i18n.hits_time
|
||||
.replace('${hits}', data.nbHits)
|
||||
.replace('${time}', data.processingTimeMS);
|
||||
return `<span>${stats}</span><img src="/imgs/algolia-logo.svg" alt="Algolia">`;
|
||||
}
|
||||
},
|
||||
cssClasses: {
|
||||
text: 'search-stats'
|
||||
}
|
||||
}),
|
||||
|
||||
instantsearch.widgets.hits({
|
||||
container: '.algolia-hits',
|
||||
escapeHTML: true,
|
||||
templates: {
|
||||
item: data => {
|
||||
const { title, content } = data._highlightResult;
|
||||
let result = `<a href="${data.permalink}" class="search-result-title">${markKeyWords(title.value)}</a>`;
|
||||
//const content = excerpt || excerptStrip || content;
|
||||
if (content && content.value) {
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = markKeyWords(content.value);
|
||||
result += `<a href="${data.permalink}"><p class="search-result">${div.innerHTML.substring(0, 200)}...</p></a>`;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
empty: data => {
|
||||
return `<div class="algolia-hits-empty">
|
||||
${NexT.CONFIG.i18n.empty.replace('${query}', data.query)}
|
||||
</div>`;
|
||||
}
|
||||
},
|
||||
cssClasses: {
|
||||
list: 'search-result-list'
|
||||
}
|
||||
}),
|
||||
|
||||
instantsearch.widgets.pagination({
|
||||
container: '.algolia-pagination',
|
||||
scrollTo: false,
|
||||
showFirst: true,
|
||||
showLast: true,
|
||||
templates: {
|
||||
first: '<i class="fa fa-angle-double-left"></i>',
|
||||
last: '<i class="fa fa-angle-double-right"></i>',
|
||||
previous: '<i class="fa fa-angle-left"></i>',
|
||||
next: '<i class="fa fa-angle-right"></i>'
|
||||
},
|
||||
cssClasses: {
|
||||
list: ['pagination', 'algolia-pagination'],
|
||||
item: 'pagination-item',
|
||||
link: 'page-number',
|
||||
selectedItem: 'current',
|
||||
disabledItem: 'disabled-item'
|
||||
}
|
||||
})
|
||||
]);
|
||||
|
||||
search.start();
|
||||
|
||||
// Handle and trigger popup window
|
||||
document.querySelectorAll('.popup-trigger').forEach(element => {
|
||||
element.addEventListener('click', () => {
|
||||
document.body.classList.add('search-active');
|
||||
setTimeout(() => document.querySelector('.search-input').focus(), 500);
|
||||
});
|
||||
});
|
||||
|
||||
// Monitor main search box
|
||||
const onPopupClose = () => {
|
||||
document.body.classList.remove('search-active');
|
||||
};
|
||||
|
||||
document.querySelector('.search-pop-overlay').addEventListener('click', event => {
|
||||
if (event.target === document.querySelector('.search-pop-overlay')) {
|
||||
onPopupClose();
|
||||
}
|
||||
});
|
||||
document.querySelector('.popup-btn-close').addEventListener('click', onPopupClose);
|
||||
document.addEventListener('pjax:success', onPopupClose);
|
||||
window.addEventListener('keyup', event => {
|
||||
if (event.key === 'Escape') {
|
||||
onPopupClose();
|
||||
}
|
||||
});
|
||||
});;
|
||||
|
||||
|
||||
});
|
||||
99
assets/js/third-party/search/local-search.js
vendored
99
assets/js/third-party/search/local-search.js
vendored
@@ -1,99 +0,0 @@
|
||||
/* global CONFIG, pjax, LocalSearch */
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
if (!CONFIG.path) {
|
||||
// Search DB path
|
||||
console.warn('`hexo-generator-searchdb` plugin is not installed!');
|
||||
return;
|
||||
}
|
||||
const localSearch = new LocalSearch({
|
||||
path : CONFIG.path,
|
||||
top_n_per_article: CONFIG.localsearch.top_n_per_article,
|
||||
unescape : CONFIG.localsearch.unescape
|
||||
});
|
||||
|
||||
const input = document.querySelector('.search-input');
|
||||
|
||||
const inputEventFunction = () => {
|
||||
if (!localSearch.isfetched) return;
|
||||
const searchText = input.value.trim().toLowerCase();
|
||||
const keywords = searchText.split(/[-\s]+/);
|
||||
const container = document.querySelector('.search-result-container');
|
||||
let resultItems = [];
|
||||
if (searchText.length > 0) {
|
||||
// Perform local searching
|
||||
resultItems = localSearch.getResultItems(keywords);
|
||||
}
|
||||
if (keywords.length === 1 && keywords[0] === '') {
|
||||
container.classList.add('no-result');
|
||||
container.innerHTML = '<div class="search-result-icon"><i class="fa fa-search fa-5x"></i></div>';
|
||||
} else if (resultItems.length === 0) {
|
||||
container.classList.add('no-result');
|
||||
container.innerHTML = '<div class="search-result-icon"><i class="far fa-frown fa-5x"></i></div>';
|
||||
} else {
|
||||
resultItems.sort((left, right) => {
|
||||
if (left.includedCount !== right.includedCount) {
|
||||
return right.includedCount - left.includedCount;
|
||||
} else if (left.hitCount !== right.hitCount) {
|
||||
return right.hitCount - left.hitCount;
|
||||
}
|
||||
return right.id - left.id;
|
||||
});
|
||||
const stats = CONFIG.i18n.hits.replace('${hits}', resultItems.length);
|
||||
|
||||
container.classList.remove('no-result');
|
||||
container.innerHTML = `<div class="search-stats">${stats}</div>
|
||||
<hr>
|
||||
<ul class="search-result-list">${resultItems.map(result => result.item).join('')}</ul>`;
|
||||
if (typeof pjax === 'object') pjax.refresh(container);
|
||||
}
|
||||
};
|
||||
|
||||
localSearch.highlightSearchWords(document.querySelector('.post-body'));
|
||||
if (CONFIG.localsearch.preload) {
|
||||
localSearch.fetchData();
|
||||
}
|
||||
|
||||
if (CONFIG.localsearch.trigger === 'auto') {
|
||||
input.addEventListener('input', inputEventFunction);
|
||||
} else {
|
||||
document.querySelector('.search-icon').addEventListener('click', inputEventFunction);
|
||||
input.addEventListener('keypress', event => {
|
||||
if (event.key === 'Enter') {
|
||||
inputEventFunction();
|
||||
}
|
||||
});
|
||||
}
|
||||
window.addEventListener('search:loaded', inputEventFunction);
|
||||
|
||||
// Handle and trigger popup window
|
||||
document.querySelectorAll('.popup-trigger').forEach(element => {
|
||||
element.addEventListener('click', () => {
|
||||
document.body.classList.add('search-active');
|
||||
// Wait for search-popup animation to complete
|
||||
setTimeout(() => input.focus(), 500);
|
||||
if (!localSearch.isfetched) localSearch.fetchData();
|
||||
});
|
||||
});
|
||||
|
||||
// Monitor main search box
|
||||
const onPopupClose = () => {
|
||||
document.body.classList.remove('search-active');
|
||||
};
|
||||
|
||||
document.querySelector('.search-pop-overlay').addEventListener('click', event => {
|
||||
if (event.target === document.querySelector('.search-pop-overlay')) {
|
||||
onPopupClose();
|
||||
}
|
||||
});
|
||||
document.querySelector('.popup-btn-close').addEventListener('click', onPopupClose);
|
||||
document.addEventListener('pjax:success', () => {
|
||||
localSearch.highlightSearchWords(document.querySelector('.post-body'));
|
||||
onPopupClose();
|
||||
});
|
||||
window.addEventListener('keyup', event => {
|
||||
if (event.key === 'Escape') {
|
||||
onPopupClose();
|
||||
}
|
||||
});
|
||||
});
|
||||
326
assets/js/third-party/search/local.js
vendored
Normal file
326
assets/js/third-party/search/local.js
vendored
Normal file
@@ -0,0 +1,326 @@
|
||||
/* global CONFIG, pjax, LocalSearch */
|
||||
class LocalSearch {
|
||||
constructor({
|
||||
path = '',
|
||||
unescape = false,
|
||||
top_n_per_article = 1
|
||||
}) {
|
||||
this.path = path;
|
||||
this.unescape = unescape;
|
||||
this.top_n_per_article = top_n_per_article;
|
||||
this.isfetched = false;
|
||||
this.datas = null;
|
||||
}
|
||||
|
||||
getIndexByWord(words, text, caseSensitive = false) {
|
||||
const index = [];
|
||||
const included = new Set();
|
||||
|
||||
if (!caseSensitive) {
|
||||
text = text.toLowerCase();
|
||||
}
|
||||
words.forEach(word => {
|
||||
if (this.unescape) {
|
||||
const div = document.createElement('div');
|
||||
div.innerText = word;
|
||||
word = div.innerHTML;
|
||||
}
|
||||
const wordLen = word.length;
|
||||
if (wordLen === 0) return;
|
||||
let startPosition = 0;
|
||||
let position = -1;
|
||||
if (!caseSensitive) {
|
||||
word = word.toLowerCase();
|
||||
}
|
||||
while ((position = text.indexOf(word, startPosition)) > -1) {
|
||||
index.push({ position, word });
|
||||
included.add(word);
|
||||
startPosition = position + wordLen;
|
||||
}
|
||||
});
|
||||
// Sort index by position of keyword
|
||||
index.sort((left, right) => {
|
||||
if (left.position !== right.position) {
|
||||
return left.position - right.position;
|
||||
}
|
||||
return right.word.length - left.word.length;
|
||||
});
|
||||
return [index, included];
|
||||
}
|
||||
|
||||
// Merge hits into slices
|
||||
mergeIntoSlice(start, end, index) {
|
||||
let item = index[0];
|
||||
let { position, word } = item;
|
||||
const hits = [];
|
||||
const count = new Set();
|
||||
while (position + word.length <= end && index.length !== 0) {
|
||||
count.add(word);
|
||||
hits.push({
|
||||
position,
|
||||
length: word.length
|
||||
});
|
||||
const wordEnd = position + word.length;
|
||||
|
||||
// Move to next position of hit
|
||||
index.shift();
|
||||
while (index.length !== 0) {
|
||||
item = index[0];
|
||||
position = item.position;
|
||||
word = item.word;
|
||||
if (wordEnd > position) {
|
||||
index.shift();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
hits,
|
||||
start,
|
||||
end,
|
||||
count: count.size
|
||||
};
|
||||
}
|
||||
|
||||
// Highlight title and content
|
||||
highlightKeyword(val, slice) {
|
||||
let result = '';
|
||||
let index = slice.start;
|
||||
for (const { position, length } of slice.hits) {
|
||||
result += val.substring(index, position);
|
||||
index = position + length;
|
||||
result += `<mark class="search-keyword">${val.substr(position, length)}</mark>`;
|
||||
}
|
||||
result += val.substring(index, slice.end);
|
||||
return result;
|
||||
}
|
||||
|
||||
getResultItems(keywords) {
|
||||
const resultItems = [];
|
||||
this.datas.forEach(({ title, content, url }) => {
|
||||
// The number of different keywords included in the article.
|
||||
const [indexOfTitle, keysOfTitle] = this.getIndexByWord(keywords, title);
|
||||
const [indexOfContent, keysOfContent] = this.getIndexByWord(keywords, content);
|
||||
const includedCount = new Set([...keysOfTitle, ...keysOfContent]).size;
|
||||
|
||||
// Show search results
|
||||
const hitCount = indexOfTitle.length + indexOfContent.length;
|
||||
if (hitCount === 0) return;
|
||||
|
||||
const slicesOfTitle = [];
|
||||
if (indexOfTitle.length !== 0) {
|
||||
slicesOfTitle.push(this.mergeIntoSlice(0, title.length, indexOfTitle));
|
||||
}
|
||||
|
||||
let slicesOfContent = [];
|
||||
while (indexOfContent.length !== 0) {
|
||||
const item = indexOfContent[0];
|
||||
const { position } = item;
|
||||
// Cut out 100 characters. The maxlength of .search-input is 80.
|
||||
const start = Math.max(0, position - 20);
|
||||
const end = Math.min(content.length, position + 80);
|
||||
slicesOfContent.push(this.mergeIntoSlice(start, end, indexOfContent));
|
||||
}
|
||||
|
||||
// Sort slices in content by included keywords' count and hits' count
|
||||
slicesOfContent.sort((left, right) => {
|
||||
if (left.count !== right.count) {
|
||||
return right.count - left.count;
|
||||
} else if (left.hits.length !== right.hits.length) {
|
||||
return right.hits.length - left.hits.length;
|
||||
}
|
||||
return left.start - right.start;
|
||||
});
|
||||
|
||||
// Select top N slices in content
|
||||
const upperBound = parseInt(this.top_n_per_article, 10);
|
||||
if (upperBound >= 0) {
|
||||
slicesOfContent = slicesOfContent.slice(0, upperBound);
|
||||
}
|
||||
|
||||
let resultItem = '';
|
||||
|
||||
url = new URL(url, location.origin);
|
||||
url.searchParams.append('highlight', keywords.join(' '));
|
||||
|
||||
if (slicesOfTitle.length !== 0) {
|
||||
resultItem += `<li><a href="${url.href}" class="search-result-title">${this.highlightKeyword(title, slicesOfTitle[0])}</a>`;
|
||||
} else {
|
||||
resultItem += `<li><a href="${url.href}" class="search-result-title">${title}</a>`;
|
||||
}
|
||||
|
||||
slicesOfContent.forEach(slice => {
|
||||
resultItem += `<a href="${url.href}"><p class="search-result">${this.highlightKeyword(content, slice)}...</p></a>`;
|
||||
});
|
||||
|
||||
resultItem += '</li>';
|
||||
resultItems.push({
|
||||
item: resultItem,
|
||||
id : resultItems.length,
|
||||
hitCount,
|
||||
includedCount
|
||||
});
|
||||
});
|
||||
return resultItems;
|
||||
}
|
||||
|
||||
fetchData() {
|
||||
const isXml = !this.path.endsWith('json');
|
||||
fetch(this.path)
|
||||
.then(response => response.text())
|
||||
.then(res => {
|
||||
// Get the contents from search data
|
||||
this.isfetched = true;
|
||||
this.datas = isXml ? [...new DOMParser().parseFromString(res, 'text/xml').querySelectorAll('entry')].map(element => ({
|
||||
title : element.querySelector('title').textContent,
|
||||
content: element.querySelector('content').textContent,
|
||||
url : element.querySelector('url').textContent
|
||||
})) : JSON.parse(res);
|
||||
// Only match articles with non-empty titles
|
||||
this.datas = this.datas.filter(data => data.title).map(data => {
|
||||
data.title = data.title.trim();
|
||||
data.content = data.content ? data.content.trim().replace(/<[^>]+>/g, '') : '';
|
||||
data.url = decodeURIComponent(data.url).replace(/\/{2,}/g, '/');
|
||||
return data;
|
||||
});
|
||||
// Remove loading animation
|
||||
window.dispatchEvent(new Event('search:loaded'));
|
||||
});
|
||||
}
|
||||
|
||||
// Highlight by wrapping node in mark elements with the given class name
|
||||
highlightText(node, slice, className) {
|
||||
const val = node.nodeValue;
|
||||
let index = slice.start;
|
||||
const children = [];
|
||||
for (const { position, length } of slice.hits) {
|
||||
const text = document.createTextNode(val.substring(index, position));
|
||||
index = position + length;
|
||||
const mark = document.createElement('mark');
|
||||
mark.className = className;
|
||||
mark.appendChild(document.createTextNode(val.substr(position, length)));
|
||||
children.push(text, mark);
|
||||
}
|
||||
node.nodeValue = val.substring(index, slice.end);
|
||||
children.forEach(element => {
|
||||
node.parentNode.insertBefore(element, node);
|
||||
});
|
||||
}
|
||||
|
||||
// Highlight the search words provided in the url in the text
|
||||
highlightSearchWords(body) {
|
||||
const params = new URL(location.href).searchParams.get('highlight');
|
||||
const keywords = params ? params.split(' ') : [];
|
||||
if (!keywords.length || !body) return;
|
||||
const walk = document.createTreeWalker(body, NodeFilter.SHOW_TEXT, null);
|
||||
const allNodes = [];
|
||||
while (walk.nextNode()) {
|
||||
if (!walk.currentNode.parentNode.matches('button, select, textarea')) allNodes.push(walk.currentNode);
|
||||
}
|
||||
allNodes.forEach(node => {
|
||||
const [indexOfNode] = this.getIndexByWord(keywords, node.nodeValue);
|
||||
if (!indexOfNode.length) return;
|
||||
const slice = this.mergeIntoSlice(0, node.nodeValue.length, indexOfNode);
|
||||
this.highlightText(node, slice, 'search-keyword');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
if (! NexT.CONFIG.localSearch.path) {
|
||||
// Search DB path
|
||||
console.warn('`search indexes file` is not configurate!');
|
||||
return;
|
||||
}
|
||||
const localSearch = new LocalSearch({
|
||||
path : NexT.CONFIG.localSearch.path,
|
||||
top_n_per_article: NexT.CONFIG.localSearch.topnperarticle,
|
||||
unescape : NexT.CONFIG.localSearch.unescape
|
||||
});
|
||||
|
||||
const input = document.querySelector('.search-input');
|
||||
|
||||
const inputEventFunction = () => {
|
||||
if (!localSearch.isfetched) return;
|
||||
const searchText = input.value.trim().toLowerCase();
|
||||
const keywords = searchText.split(/[-\s]+/);
|
||||
const container = document.querySelector('.search-result-container');
|
||||
let resultItems = [];
|
||||
if (searchText.length > 0) {
|
||||
// Perform local searching
|
||||
resultItems = localSearch.getResultItems(keywords);
|
||||
}
|
||||
if (keywords.length === 1 && keywords[0] === '') {
|
||||
container.classList.add('no-result');
|
||||
container.innerHTML = '<div class="search-result-icon"><i class="fa fa-search fa-5x"></i></div>';
|
||||
} else if (resultItems.length === 0) {
|
||||
container.classList.add('no-result');
|
||||
container.innerHTML = '<div class="search-result-icon"><i class="far fa-frown fa-5x"></i></div>';
|
||||
} else {
|
||||
resultItems.sort((left, right) => {
|
||||
if (left.includedCount !== right.includedCount) {
|
||||
return right.includedCount - left.includedCount;
|
||||
} else if (left.hitCount !== right.hitCount) {
|
||||
return right.hitCount - left.hitCount;
|
||||
}
|
||||
return right.id - left.id;
|
||||
});
|
||||
const stats = NexT.CONFIG.i18n.hits.replace('${hits}', resultItems.length);
|
||||
|
||||
container.classList.remove('no-result');
|
||||
container.innerHTML = `<div class="search-stats">${stats}</div>
|
||||
<hr>
|
||||
<ul class="search-result-list">${resultItems.map(result => result.item).join('')}</ul>`;
|
||||
if (typeof pjax === 'object') pjax.refresh(container);
|
||||
}
|
||||
};
|
||||
|
||||
localSearch.highlightSearchWords(document.querySelector('.post-body'));
|
||||
if (NexT.CONFIG.localSearch.preload) {
|
||||
localSearch.fetchData();
|
||||
}
|
||||
|
||||
if (NexT.CONFIG.localSearch.trigger === 'auto') {
|
||||
input.addEventListener('input', inputEventFunction);
|
||||
} else {
|
||||
document.querySelector('.search-icon').addEventListener('click', inputEventFunction);
|
||||
input.addEventListener('keypress', event => {
|
||||
if (event.key === 'Enter') {
|
||||
inputEventFunction();
|
||||
}
|
||||
});
|
||||
}
|
||||
window.addEventListener('search:loaded', inputEventFunction);
|
||||
|
||||
// Handle and trigger popup window
|
||||
document.querySelectorAll('.popup-trigger').forEach(element => {
|
||||
element.addEventListener('click', () => {
|
||||
document.body.classList.add('search-active');
|
||||
// Wait for search-popup animation to complete
|
||||
setTimeout(() => input.focus(), 500);
|
||||
if (!localSearch.isfetched) localSearch.fetchData();
|
||||
});
|
||||
});
|
||||
|
||||
// Monitor main search box
|
||||
const onPopupClose = () => {
|
||||
document.body.classList.remove('search-active');
|
||||
};
|
||||
|
||||
document.querySelector('.search-pop-overlay').addEventListener('click', event => {
|
||||
if (event.target === document.querySelector('.search-pop-overlay')) {
|
||||
onPopupClose();
|
||||
}
|
||||
});
|
||||
document.querySelector('.popup-btn-close').addEventListener('click', onPopupClose);
|
||||
document.addEventListener('pjax:success', () => {
|
||||
localSearch.highlightSearchWords(document.querySelector('.post-body'));
|
||||
onPopupClose();
|
||||
});
|
||||
window.addEventListener('keyup', event => {
|
||||
if (event.key === 'Escape') {
|
||||
onPopupClose();
|
||||
}
|
||||
});
|
||||
});
|
||||
16
assets/js/third-party/share/addthis.js
vendored
Normal file
16
assets/js/third-party/share/addthis.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
const element = '.addthis_inline_share_toolbox';
|
||||
if (!NexT.CONFIG.addthis || !NexT.utils.checkDOMExist(element)) return;
|
||||
|
||||
const addthis_js = NexT.CONFIG.addthis.js + '?pubid=' + NexT.CONFIG.addthis.cfg.pubid;
|
||||
|
||||
NexT.utils.loadComments(element).then(() => {
|
||||
NexT.utils.getScript(addthis_js, {
|
||||
attributes: {
|
||||
async: true
|
||||
},
|
||||
parentNode: document.querySelector(element)
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -23,8 +23,31 @@ HTMLElement.prototype.wrap = function(wrapper) {
|
||||
|
||||
NexT.utils = {
|
||||
|
||||
checkDOMExist: function(selector) {
|
||||
return document.querySelector(selector) != null;
|
||||
},
|
||||
|
||||
getCDNResource: function(res) {
|
||||
let { plugins, router } = NexT.CONFIG.vendor;
|
||||
let { name, version, file, alias } = res;
|
||||
|
||||
let npm_name = name;
|
||||
let res_src = '';
|
||||
switch(plugins) {
|
||||
case 'cdnjs':
|
||||
let cdnjs_name = alias || name;
|
||||
let cdnjs_file = file.replace(/\.js$/, '.min.js').replace(/^(dist|lib|source\/js|)\/(browser\/|)/, '');
|
||||
res_src = `${router}/${cdnjs_name}/${version}/${cdnjs_file}`
|
||||
break;
|
||||
default:
|
||||
res_src = `${router}/${npm_name}@${version}/${file}`
|
||||
}
|
||||
|
||||
return res_src;
|
||||
},
|
||||
|
||||
replacePostCRLink: function() {
|
||||
if (CONFIG.hostname.startsWith('http')) return;
|
||||
if (NexT.CONFIG.hostname.startsWith('http')) return;
|
||||
// Try to support mutli domain without base URL sets.
|
||||
let href = window.location.href;
|
||||
if (href.indexOf('#')>-1){
|
||||
@@ -40,8 +63,10 @@ NexT.utils = {
|
||||
* One-click copy code support.
|
||||
*/
|
||||
registerCopyCode: function() {
|
||||
if (!NexT.CONFIG.copybtn) return;
|
||||
|
||||
let figure = document.querySelectorAll('.highlight pre');
|
||||
if (figure.length === 0 || !CONFIG.copybtn) return;
|
||||
if (figure.length === 0 || !NexT.CONFIG.copybtn) return;
|
||||
figure.forEach(element => {
|
||||
let cn = element.querySelector('code').className;
|
||||
// TODO seems hard code need find other ways fixed it.
|
||||
@@ -170,13 +195,14 @@ NexT.utils = {
|
||||
// https://stackoverflow.com/questions/20306204/using-queryselector-with-ids-that-are-numbers
|
||||
const tActive = document.getElementById(element.querySelector('a').getAttribute('href').replace('#', ''));
|
||||
[...tActive.parentNode.children].forEach(target => {
|
||||
// Array.prototype.slice.call(tActive.parentNode.children).forEach(target => {
|
||||
target.classList.toggle('active', target === tActive);
|
||||
});
|
||||
// Trigger event
|
||||
tActive.dispatchEvent(new Event('tabs:click', {
|
||||
bubbles: true
|
||||
}));
|
||||
if (!CONFIG.stickytabs) return;
|
||||
if (!NexT.CONFIG.stickytabs) return;
|
||||
const offset = nav.parentNode.getBoundingClientRect().top + window.scrollY + 10;
|
||||
window.anime({
|
||||
targets : document.scrollingElement,
|
||||
@@ -204,7 +230,7 @@ NexT.utils = {
|
||||
/*registerActiveMenuItem: function() {
|
||||
document.querySelectorAll('.menu-item a[href]').forEach(target => {
|
||||
const isSamePath = target.pathname === location.pathname || target.pathname === location.pathname.replace('index.html', '');
|
||||
const isSubPath = !CONFIG.root.startsWith(target.pathname) && location.pathname.startsWith(target.pathname);
|
||||
const isSubPath = !NexT.CONFIG.root.startsWith(target.pathname) && location.pathname.startsWith(target.pathname);
|
||||
target.classList.toggle('menu-item-active', target.hostname === location.hostname && (isSamePath || isSubPath));
|
||||
});
|
||||
},
|
||||
@@ -212,7 +238,7 @@ NexT.utils = {
|
||||
registerLangSelect: function() {
|
||||
const selects = document.querySelectorAll('.lang-select');
|
||||
selects.forEach(sel => {
|
||||
sel.value = CONFIG.page.lang;
|
||||
sel.value = NexT.CONFIG.page.lang;
|
||||
sel.addEventListener('change', () => {
|
||||
const target = sel.options[sel.selectedIndex];
|
||||
document.querySelectorAll('.lang-select-label span').forEach(span => {
|
||||
@@ -253,7 +279,7 @@ NexT.utils = {
|
||||
});
|
||||
},
|
||||
|
||||
initCommontesDispaly: function(){
|
||||
initCommontesDispaly: function(){
|
||||
const comms = document.querySelectorAll('.comment-wrap > div');
|
||||
if (comms.length<=1) return;
|
||||
comms.forEach(function(item){
|
||||
@@ -278,6 +304,15 @@ NexT.utils = {
|
||||
});
|
||||
},
|
||||
|
||||
hideCommontes:function() {
|
||||
document.querySelector('.post-comments').style.display = 'none';
|
||||
},
|
||||
|
||||
hiddeLodingCmp: function(selector) {
|
||||
const loadding = document.querySelector(selector).previousElementSibling;
|
||||
loadding.style.display = 'none';
|
||||
},
|
||||
|
||||
activateNavByIndex: function(index) {
|
||||
const target = document.querySelectorAll('.post-toc li a.nav-link')[index];
|
||||
if (!target || target.classList.contains('active-current')) return;
|
||||
@@ -303,13 +338,13 @@ NexT.utils = {
|
||||
},
|
||||
|
||||
updateSidebarPosition: function() {
|
||||
if (window.innerWidth < 992 || CONFIG.scheme === 'Pisces' || CONFIG.scheme === 'Gemini') return;
|
||||
if (window.innerWidth < 992 || NexT.CONFIG.scheme === 'Pisces' || NexT.CONFIG.scheme === 'Gemini') return;
|
||||
// Expand sidebar on post detail page by default, when post has a toc.
|
||||
const hasTOC = document.querySelector('.post-toc');
|
||||
let display = CONFIG.sidebar;
|
||||
let display = NexT.CONFIG.sidebar;
|
||||
if (typeof display !== 'boolean') {
|
||||
// There's no definition sidebar in the page front-matter.
|
||||
display = CONFIG.sidebar.display === 'always' || (CONFIG.sidebar.display === 'post' && hasTOC);
|
||||
display = NexT.CONFIG.sidebar.display === 'always' || (NexT.CONFIG.sidebar.display === 'post' && hasTOC);
|
||||
}
|
||||
if (display) {
|
||||
window.dispatchEvent(new Event('sidebar:show'));
|
||||
@@ -344,6 +379,15 @@ NexT.utils = {
|
||||
});
|
||||
},
|
||||
|
||||
getStyle: function(src, parent) {
|
||||
const link = document.createElement('link');
|
||||
link.setAttribute('rel', 'stylesheet');
|
||||
link.setAttribute('type', 'text/css');
|
||||
link.setAttribute('href', src);
|
||||
|
||||
(parent || document.head).appendChild(link);
|
||||
},
|
||||
|
||||
getScript: function(src, options = {}, legacyCondition) {
|
||||
if (typeof options === 'function') {
|
||||
return this.getScript(src, {
|
||||
@@ -362,6 +406,7 @@ NexT.utils = {
|
||||
} = {},
|
||||
parentNode = null
|
||||
} = options;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
if (condition) {
|
||||
resolve();
|
||||
@@ -401,7 +446,7 @@ NexT.utils = {
|
||||
}
|
||||
return new Promise(resolve => {
|
||||
const element = document.querySelector(selector);
|
||||
if (!CONFIG.comments.lazyload || !element) {
|
||||
if (!element) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Hugo NexT theme's custom config
|
||||
#
|
||||
|
||||
version: 4.0.0
|
||||
version: 4.2.0
|
||||
@@ -1,27 +1,84 @@
|
||||
# CDN 公共资源商列表
|
||||
# Public CDN vendor list
|
||||
#
|
||||
vendors:
|
||||
cdnjs: "//cdnjs.cloudflare.com/ajax/libs/${name}/${version}/${file}"
|
||||
unpkg: "//unpkg.com/${name}@${version}/${file}"
|
||||
cdnjs: "https://cdnjs.cloudflare.com/ajax/libs"
|
||||
unpkg: "https://unpkg.com"
|
||||
|
||||
|
||||
# Javascript Resources
|
||||
#
|
||||
# JavaScript 资源
|
||||
# JavaScript Resources
|
||||
js:
|
||||
- name: animejs
|
||||
version: 3.2.1
|
||||
file: lib/anime.min.js
|
||||
- name: mathjax
|
||||
version: 3.2.0
|
||||
file: es5/tex-mml-chtml.js
|
||||
# TODO
|
||||
#- name: mathjax
|
||||
# version: 3.2.0
|
||||
# file: es5/tex-mml-chtml.js
|
||||
|
||||
# CSS 资源
|
||||
# CSS Resources
|
||||
#
|
||||
css:
|
||||
- name: '@fortawesome/fontawesome-free'
|
||||
version: 6.1.1
|
||||
version: 6.1.2
|
||||
file: css/all.min.css
|
||||
alias: font-awesome
|
||||
- name: animate.css
|
||||
version: 3.1.1
|
||||
file: animate.min.css
|
||||
file: animate.min.css
|
||||
|
||||
# 第三方服务组件资源
|
||||
# 3rd servcies Resource
|
||||
|
||||
# 站点统计
|
||||
# Site analytics engine
|
||||
analytics:
|
||||
la: https://sdk.51.la/js-sdk-pro.min.js
|
||||
|
||||
# 文章分享
|
||||
# Share
|
||||
addthis:
|
||||
js: https://s7.addthis.com/js/300/addthis_widget.js
|
||||
|
||||
# 评论组件
|
||||
# Comment component
|
||||
waline:
|
||||
js:
|
||||
name: '@waline/client'
|
||||
version: 2.6.1
|
||||
file: dist/waline.js
|
||||
alias: waline
|
||||
css:
|
||||
name: '@waline/client'
|
||||
version: 2.6.1
|
||||
file: dist/waline.css
|
||||
alias: waline
|
||||
|
||||
artalk:
|
||||
js:
|
||||
name: artalk
|
||||
version: 2.3.4
|
||||
file: dist/Artalk.js
|
||||
css:
|
||||
name: artalk
|
||||
version: 2.3.4
|
||||
file: dist/Artalk.css
|
||||
|
||||
giscus:
|
||||
js: https://giscus.app/client.js
|
||||
|
||||
utterances:
|
||||
js: https://utteranc.es/client.js
|
||||
|
||||
livere:
|
||||
js: https://cdn-city.livere.com/js/embed.dist.js
|
||||
|
||||
# 全文搜索
|
||||
# Full text search
|
||||
algolia:
|
||||
name: algoliasearch
|
||||
version: 4.13.0
|
||||
file: dist/algoliasearch-lite.umd.js
|
||||
instant:
|
||||
name: instantsearch.js
|
||||
version: 4.40.5
|
||||
file: dist/instantsearch.production.min.js
|
||||
@@ -55,6 +55,42 @@ markup:
|
||||
endLevel: 3
|
||||
ordered: false
|
||||
|
||||
# 站点文章导航文件
|
||||
# Site map of all articles
|
||||
sitemap:
|
||||
filename: "sitemap.xml"
|
||||
changefreq: "weekly"
|
||||
priority: 0.5
|
||||
|
||||
outputFormats:
|
||||
RSS:
|
||||
baseName: "rss"
|
||||
# 自定义生成本地搜索文件
|
||||
# Custom file of indexes for local search
|
||||
LocalIndexes:
|
||||
mediaType: application/xml
|
||||
baseName: searchindexes
|
||||
isPlainText: true
|
||||
notAlternative: true
|
||||
# 生成 Algolia 索引文件
|
||||
# Build indexes of Aloglia
|
||||
AlgoliaIndexes:
|
||||
mediaType: application/json
|
||||
baseName: algolia
|
||||
isPlainText: true
|
||||
notAlternative: true
|
||||
|
||||
# 默认使用本地搜索,如切换到 Algolia 搜索引擎,
|
||||
# 请将下面的 LocalIndexes 替换成 AlgoliaIndexes
|
||||
# By default use local search, before switch to Algolia engine
|
||||
# Please replace LocalIndexes with AlgoliaIndexes
|
||||
outputs:
|
||||
home: ["HTML", "RSS", "LocalIndexes"]
|
||||
|
||||
# 输出 robots 文件支持爬虫扫描
|
||||
# Enable robots with support crawler scan
|
||||
enableRobotsTXT: true
|
||||
|
||||
#--------------------------------------
|
||||
# 菜单配置说明
|
||||
# identifier : 唯一标识不可重复
|
||||
@@ -84,16 +120,21 @@ menus:
|
||||
pageref: /about.html
|
||||
pre: user
|
||||
weight: 2
|
||||
- identifier: flinks
|
||||
name: 站点示例
|
||||
pageref: /flinks.html
|
||||
pre: thumbs-up
|
||||
weight: 3
|
||||
- identifier: archives
|
||||
name: 归档
|
||||
pageref: /posts
|
||||
pageref: /archives
|
||||
pre: archive
|
||||
weight: 3
|
||||
weight: 4
|
||||
- identifier: commonweal
|
||||
name: 公益 404
|
||||
url: /404.html
|
||||
pre: heartbeat
|
||||
weight: 4
|
||||
weight: 5
|
||||
|
||||
#-----------------------------------------
|
||||
# Hugo NexT 主题参数配置
|
||||
@@ -103,7 +144,7 @@ params:
|
||||
# 需要显示文章的部分,即content目录下的文件夹名称
|
||||
# Sections for show in home & archive page
|
||||
# and it's forlder name which under content
|
||||
mainSections: ["posts"]
|
||||
mainSections: ["post"]
|
||||
# 年,月,日及时间的格式化样式
|
||||
# Format style for year,month,date & time
|
||||
yearFormat: "2006"
|
||||
@@ -139,7 +180,7 @@ params:
|
||||
appleTouchIcon: /imgs/icons/apple_touch_icon_next.png
|
||||
|
||||
# 自定义 Logo (目前只支持 Mist 页面模式)
|
||||
# Custom Logo (Warning: Do not support scheme Mist)
|
||||
# Custom Logo (Warning: Only support scheme Mist)
|
||||
customLogo: #/imgs/hugo_next_logo.png
|
||||
|
||||
# 知识共享国际许可 4.0
|
||||
@@ -553,7 +594,7 @@ params:
|
||||
enable: true
|
||||
# 你的 Github 仓库地址
|
||||
# Your repository url on Github.
|
||||
permalink: https://github.com/yourname
|
||||
permalink: https://github.com/hugo-next
|
||||
# 关注说明
|
||||
# Show this title when cursor move on.
|
||||
title: Follow me on GitHub
|
||||
@@ -753,6 +794,7 @@ params:
|
||||
# Waline comments system
|
||||
# More info seee: https://waline.js.org/
|
||||
waline:
|
||||
pageView: true
|
||||
placeholder: "请文明发言"
|
||||
emoji: false
|
||||
imgUploader: false
|
||||
@@ -764,35 +806,35 @@ params:
|
||||
# 更多配置信息请参考:https://artalk.js.org
|
||||
# Artalk comments system
|
||||
# More info see: https://artalk.js.org
|
||||
artalk:
|
||||
site: "默认站点"
|
||||
placeholder: "请文明发言,谢谢!"
|
||||
server: #<your artalk server url>
|
||||
# artalk:
|
||||
# site: "默认站点"
|
||||
# placeholder: "请文明发言,谢谢!"
|
||||
# server: #<your artalk server url>
|
||||
|
||||
# Artalk 评论插件
|
||||
# 更多配置信息请参考:
|
||||
# LiveRe comments system
|
||||
# You can get your uid from https://livere.com/
|
||||
livere:
|
||||
uid: # <your_uid>
|
||||
# livere:
|
||||
# uid: # <your_uid>
|
||||
|
||||
# Utterances 评论插件
|
||||
# 更多配置信息请参考:https://utteranc.es
|
||||
# Utterances comments system
|
||||
# For more information: https://utteranc.es
|
||||
utterances:
|
||||
# Github 仓库地址,格式:用户名/仓库名称
|
||||
# Github repository owner and name
|
||||
repo: username/repo-name
|
||||
# 问题标题的模式,可选值:pathname | url | title | og:title
|
||||
# Available values: pathname | url | title | og:title
|
||||
issueTerm: pathname
|
||||
# 问题的标签分类
|
||||
# Label flag for Github issues
|
||||
label: comments
|
||||
# 主题可选值: github-light | github-dark | preferred-color-scheme | github-dark-orange | icy-dark | dark-blue | photon-dark | boxy-light
|
||||
# Available values: github-light | github-dark | preferred-color-scheme | github-dark-orange | icy-dark | dark-blue | photon-dark | boxy-light
|
||||
theme: preferred-color-scheme
|
||||
# utterances:
|
||||
# # Github 仓库地址,格式:用户名/仓库名称
|
||||
# # Github repository owner and name
|
||||
# repo: username/repo-name
|
||||
# # 问题标题的模式,可选值:pathname | url | title | og:title
|
||||
# # Available values: pathname | url | title | og:title
|
||||
# issueTerm: pathname
|
||||
# # 问题的标签分类
|
||||
# # Label flag for Github issues
|
||||
# label: comments
|
||||
# # 主题可选值: github-light | github-dark | preferred-color-scheme | github-dark-orange | icy-dark | dark-blue | photon-dark | boxy-light
|
||||
# # Available values: github-light | github-dark | preferred-color-scheme | github-dark-orange | icy-dark | dark-blue | photon-dark | boxy-light
|
||||
# theme: preferred-color-scheme
|
||||
|
||||
# Giscus 评论插件
|
||||
# 更多配置信息请参考:https://giscus.app
|
||||
@@ -801,16 +843,24 @@ params:
|
||||
giscus:
|
||||
# Github 仓库地址,格式:用户名/仓库名称
|
||||
# Github repository owner and name
|
||||
repo: username/repo_name
|
||||
repo: username/repo-name
|
||||
# Giscus 生成的仓库 Id
|
||||
# Generate repository Id from Giscus
|
||||
repoId: #<repo_id>
|
||||
repoId: #<repo-id>
|
||||
# 讨论区的分类名称
|
||||
# Github discussions category
|
||||
category: Announcements
|
||||
category: Comments
|
||||
# 讨论区分类 ID
|
||||
# Generate category Id from Giscus
|
||||
categoryId: #<category_id>
|
||||
categoryId: #<category-id>
|
||||
# 帖子上的反应将会显示在评论前
|
||||
# The reactions for post will be shown before the comments
|
||||
reactions: false
|
||||
# 将元数据定期被发送到父页面(被嵌入的页面或控制台,用于调试)
|
||||
# Metadata will be sent periodically to the parent window
|
||||
emit: false
|
||||
# 评论输入框的位置,可选值: top | bottom
|
||||
# Aavilable value: top | bottom
|
||||
# 讨论区帖子标题,可选值: pathname | url | title | og:title | 自定义
|
||||
# Available values: pathname | url | title | og:title | custom
|
||||
mapping: title
|
||||
@@ -853,24 +903,22 @@ params:
|
||||
# 更多信息请参考:https://invite.51.la/1NUfGTS1?target=V6
|
||||
# 51La Analytics
|
||||
# See: https://invite.51.la/1NUfGTS1?target=V6
|
||||
laId: #<anaytics_id>
|
||||
laId: #<anaytics_id>
|
||||
|
||||
# TODO
|
||||
# Show Views / Visitors of the website / page with busuanzi.
|
||||
# For more information: http://ibruce.info/2015/04/04/busuanzi/
|
||||
busuanzi:
|
||||
enable: true
|
||||
visitors: true
|
||||
visitors: false
|
||||
visitorsIcon: fa fa-user
|
||||
views: true
|
||||
views: false
|
||||
viewsIcon: fa fa-eye
|
||||
postViews: true
|
||||
postViews: false
|
||||
postViewsIcon: far fa-eye
|
||||
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
# TODO
|
||||
# 内容搜索服务(暂时未实现)
|
||||
# 内容搜索服务
|
||||
# Search Services
|
||||
# ---------------------------------------------------------------
|
||||
|
||||
@@ -878,19 +926,32 @@ params:
|
||||
# For more information: https://www.algolia.com
|
||||
algoliaSearch:
|
||||
enable: false
|
||||
appId: #<algolia app id>
|
||||
apiKey: #<algolia api key>
|
||||
indexName: #<algolia index name>
|
||||
hits:
|
||||
perPage: 10
|
||||
|
||||
# 本地搜索
|
||||
# Local Search
|
||||
localSearch:
|
||||
# 是否开启搜索功能
|
||||
# Enable search function
|
||||
enable: true
|
||||
# 搜索索引文件路径
|
||||
# Indexes file path for search
|
||||
path: searchindexes.xml
|
||||
# 是立即搜索当输入关键字时,可选值: auto | manual
|
||||
# If auto, trigger search by changing input.
|
||||
# If manual, trigger search by pressing enter key or search button.
|
||||
trigger: auto
|
||||
# 显示头部的搜索记录,-1 表示显示所有搜索结果
|
||||
# Show top n results per article, show all results by setting to -1
|
||||
top_n_per_article: 1
|
||||
topNPerArticle: -1
|
||||
# 将 html 字符串转换为可读字符串
|
||||
# Unescape html strings to the readable one.
|
||||
unescape: false
|
||||
# 页面加载时是否要重新载入索引文件
|
||||
# Preload the search data when the page loads.
|
||||
preload: false
|
||||
|
||||
@@ -968,7 +1029,7 @@ params:
|
||||
# Use Animate.css to animate everything.
|
||||
# For more information: https://animate.style
|
||||
motion:
|
||||
enable: false
|
||||
enable: true
|
||||
async: true
|
||||
transition:
|
||||
# All available transition variants: https://theme-next.js.org/animate/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "关于 Hugo NexT 组织"
|
||||
description: ""
|
||||
description: "Hugo NexT 组织介绍说明。"
|
||||
|
||||
date: 2022-06-09T20:12:52+08:00
|
||||
lastmod: 2022-06-09T20:12:52+08:00
|
||||
@@ -16,4 +16,12 @@ url: about.html
|
||||
|
||||
# 我们的愿景
|
||||
|
||||
延续 `NexT` 经典的黑白调搭配,保持简单的易用性及强大的功能。
|
||||
延续 `NexT` 经典的黑白调搭配,保持简单的易用性及强大的功能。
|
||||
|
||||
# 使用反馈
|
||||
|
||||
- 加入 [GitHub Discussions](https://github.com/hugo-next/hugo-theme-next/discussions) 或 [Gitter](https://gitter.im/hugo-next/community) 在线讨论 :beers:
|
||||
- [GitHub Issues](https://github.com/hugo-next/hugo-theme-next/issues/new?labels=Bug&template=bug-report.md) 提交错误报告 :bug:
|
||||
- [GitHub Feature](https://github.com/hugo-next/hugo-theme-next/issues/new?labels=Feature+Request&template=feature-request.md) 表新功能的想法 :sparkles:
|
||||
|
||||
> 同时国内用户也可加入 QQ 群交流: 604710815
|
||||
3
exampleSite/content/archives/_index.md
Normal file
3
exampleSite/content/archives/_index.md
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
date: 2022-07-26T21:46:25+08:00
|
||||
---
|
||||
16
exampleSite/content/flinks.md
Normal file
16
exampleSite/content/flinks.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: "站点示例"
|
||||
type: flinks
|
||||
url: flinks.html
|
||||
---
|
||||
|
||||
如想要交换友情链接,请在评论区留下你的站点信息,格式参考如下:
|
||||
|
||||
{{< note success no-icon >}}
|
||||
|
||||
**名称:** NexT 主题 <br/>
|
||||
**说明:** 保持简单的易用性和强大的功能。 <br/>
|
||||
**站标:** https://hugo-next.eu.org/imgs/hugo_next_avatar.png <br/>
|
||||
**网址:** https://hugo-next.eu.org <br/>
|
||||
|
||||
{{< /note >}}
|
||||
86
exampleSite/content/post/shortcodes.md
Normal file
86
exampleSite/content/post/shortcodes.md
Normal file
@@ -0,0 +1,86 @@
|
||||
---
|
||||
title: "自定义短语示例"
|
||||
description: "将常用的块引用、标签卡、按钮等信息设置成短代码,便于快速引用"
|
||||
keywords: "shortcode,短代码"
|
||||
|
||||
date: 2022-08-06T14:41:50+08:00
|
||||
lastmod: 2022-08-06T14:41:50+08:00
|
||||
|
||||
categories:
|
||||
- 示例
|
||||
tags:
|
||||
- 短代码
|
||||
- 语法
|
||||
url: "post/shortcodes.html"
|
||||
---
|
||||
|
||||
虽然 `Markdown` 语法已经非常丰富能够满足我们写文章的绝大部分需求,但是为更好的对文章内容进行更友好的排版,为引设计一套自定义的短语,便于在使用时能够快速引用。
|
||||
|
||||
<!--more-->
|
||||
|
||||
# 块引用
|
||||
|
||||
在引用一些经典名言名句时,可以采用此短语,语法参考如下:
|
||||
|
||||
```markdown
|
||||
{{</* quote */>}}
|
||||
### block quote
|
||||
写下你想表达的话语!
|
||||
{{</* /quote */>}}
|
||||
```
|
||||
|
||||
实际效果:
|
||||
|
||||
{{< quote >}}
|
||||
|
||||
希望是无所谓有,无所谓无的,这正如地上的路。
|
||||
|
||||
|
||||
其实地上本没有路,走的人多了,也便成了路。
|
||||
|
||||
**鲁迅**
|
||||
|
||||
{{< /quote >}}
|
||||
|
||||
# 信息块
|
||||
|
||||
支持 `default`,`info`,`success`,`warning`,`danger` 等五种不同效果的展示,语法参考如下:
|
||||
|
||||
```markdown
|
||||
{{</* note [class] [no-icon] */>}}
|
||||
书写表达的信息
|
||||
支持 Markdown 语法
|
||||
{{</* /note */>}}
|
||||
```
|
||||
|
||||
实际效果:
|
||||
|
||||
{{< note default no-icon >}}
|
||||
### Default Header without icon
|
||||
**Welcome** to [Hugo NexT!](https://preview.hugo-next.eu.org)
|
||||
{{< /note >}}
|
||||
|
||||
{{< note default >}}
|
||||
### Default Header
|
||||
**Welcome** to [Hugo NexT!](https://preview.hugo-next.eu.org)
|
||||
{{< /note >}}
|
||||
|
||||
{{< note info >}}
|
||||
### Info Header
|
||||
**Welcome** to [Hugo NexT!](https://preview.hugo-next.eu.org)
|
||||
{{< /note >}}
|
||||
|
||||
{{< note success >}}
|
||||
### Success Header
|
||||
**Welcome** to [Hugo NexT!](https://preview.hugo-next.eu.org)
|
||||
{{< /note >}}
|
||||
|
||||
{{< note warning >}}
|
||||
### Warning Header
|
||||
**Welcome** to [Hugo NexT!](https://preview.hugo-next.eu.org)
|
||||
{{< /note >}}
|
||||
|
||||
{{< note danger >}}
|
||||
### Danger Header
|
||||
**Welcome** to [Hugo NexT!](https://preview.hugo-next.eu.org)
|
||||
{{< /note >}}
|
||||
29
exampleSite/data/flinks.yaml
Normal file
29
exampleSite/data/flinks.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
# 友情链接
|
||||
# Friend's links
|
||||
|
||||
- FLinksTitle: 官方示例
|
||||
FLinksDesc: 来自主题官方的示例内容。
|
||||
FLinksList:
|
||||
- name: Hugo
|
||||
desc: 世界上最快的网站建设框架!
|
||||
avatar: https://gohugo.io/favicon-32x32.png
|
||||
link: https://gohugo.io
|
||||
|
||||
- name: Hugo-NexT
|
||||
desc: Hugo NexT 官方预览网站。
|
||||
avatar: https://hugo-next.eu.org/imgs/hugo_next_avatar.png
|
||||
link: https://hugo-next.eu.org
|
||||
|
||||
- name: 凡梦星尘空间站
|
||||
desc: 再平凡的人也有属于他的梦想!
|
||||
avatar: https://lisenhui.cn/img/avatar.png
|
||||
link: https://lisenhui.cn
|
||||
|
||||
|
||||
- FLinksTitle: Hugo NexT 粉丝群体
|
||||
FLinksDesc: 来自 Hugo NexT 主题爱好者们的精彩呈现!
|
||||
FLinksList:
|
||||
- name: 阿哈吉
|
||||
desc: 全网首个 Hugo NexT 忠实粉丝用户
|
||||
avatar: https://a.happy2008.top/imgs/stayhome-small.png
|
||||
link: https://a.happy2008.top/
|
||||
@@ -20,4 +20,4 @@ EOT
|
||||
|
||||
next `cat ../VERSION`
|
||||
|
||||
hugo server -D -t ../.. --port 1414 --panicOnWarning
|
||||
hugo server -t ../.. --port 1414 --panicOnWarning --config config.yaml
|
||||
|
||||
@@ -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"
|
||||
13
i18n/en.yaml
13
i18n/en.yaml
@@ -1,7 +1,7 @@
|
||||
#--------------------------------------
|
||||
# English Version
|
||||
#--------------------------------------
|
||||
posts:
|
||||
archives:
|
||||
other: Posts
|
||||
tag:
|
||||
other: Tag
|
||||
@@ -140,4 +140,13 @@ PageViewsLabel:
|
||||
other: Total Page Views
|
||||
|
||||
FooterPowerby:
|
||||
other: "Power by %s"
|
||||
other: "Power by %s"
|
||||
|
||||
SearchPh:
|
||||
other: Searching...
|
||||
SearchEmpty:
|
||||
other: "We didn't find any results for the search: ${query}"
|
||||
SearchHits:
|
||||
hits: "${hits} results found"
|
||||
SearchHitsTime:
|
||||
other: "${hits} results found in ${time} ms"
|
||||
@@ -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 强力驱动"
|
||||
@@ -2,7 +2,7 @@
|
||||
# 中文版本
|
||||
#--------------------------------------
|
||||
|
||||
posts:
|
||||
archives:
|
||||
other: 文章
|
||||
tag:
|
||||
other: 标签
|
||||
@@ -141,4 +141,13 @@ PageViewsLabel:
|
||||
other: 总访问量
|
||||
|
||||
FooterPowerby:
|
||||
other: 由 %s 强力驱动
|
||||
other: 由 %s 强力驱动
|
||||
|
||||
SearchPh:
|
||||
other: 搜索...
|
||||
SearchEmpty:
|
||||
other: "没有找到任何搜索结果:${query}"
|
||||
SearchHits:
|
||||
hits: "找到 ${hits} 个搜索结果"
|
||||
SearchHitsTime:
|
||||
other: "找到 ${hits} 个搜索结果(用时 ${time} 毫秒)"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 92 KiB |
BIN
images/tn.png
BIN
images/tn.png
Binary file not shown.
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 36 KiB |
@@ -1,4 +1,6 @@
|
||||
{{- partial "init.html" . -}}
|
||||
{{- range $k, $v := (partialCached "init.html" .) -}}
|
||||
{{- $.Scratch.Set $k $v -}}
|
||||
{{- end -}}
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ .Site.LanguageCode }}">
|
||||
|
||||
@@ -28,13 +30,13 @@
|
||||
<!-- Submenu,Content,Comment -->
|
||||
{{- block "main" . }}{{- end }}
|
||||
{{- if .IsPage }}
|
||||
{{- partial "comments.html" . }}
|
||||
{{- partialCached "comments.html" . }}
|
||||
{{- end }}
|
||||
</div>
|
||||
</main>
|
||||
<footer class="footer">
|
||||
<div class="footer-inner">
|
||||
{{- partial "footer.html" . }}
|
||||
{{- partialCached "footer.html" . }}
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
12
layouts/_default/list.algoliaindexes.json
Normal file
12
layouts/_default/list.algoliaindexes.json
Normal file
@@ -0,0 +1,12 @@
|
||||
[
|
||||
{{- range $index, $entry := where .Site.RegularPages "Kind" "page" }}
|
||||
{{- if $index }}, {{ end }}
|
||||
{
|
||||
"permalink": "{{ .Permalink | relURL }}",
|
||||
"title": {{ .Title | jsonify }},
|
||||
"content": {{ .Plain | jsonify }},
|
||||
"date": {{ .Date.Format $.Site.Params.timeFormat | jsonify }},
|
||||
"updated": {{ .Lastmod.Format $.Site.Params.timeFormat | jsonify }}
|
||||
}
|
||||
{{- end }}
|
||||
]
|
||||
@@ -1,29 +1,3 @@
|
||||
{{ range .Paginator.Pages.GroupByDate "2006" }}
|
||||
<div class="collection-year">
|
||||
<span class="collection-header">{{ .Key }}</span>
|
||||
</div>
|
||||
{{ range .Pages }}
|
||||
<article itemscope itemtype="http://schema.org/Article">
|
||||
<header class="post-header">
|
||||
<div class="post-meta-container">
|
||||
{{ $month := .Date.Format .Site.Params.monthFormat }}
|
||||
<time itemprop="dateCreated" datetime="{{ .Date.Format .Site.Params.timeFormat }}" content="{{ $month }}">
|
||||
{{ $month }}
|
||||
</time>
|
||||
</div>
|
||||
<div class="post-title">
|
||||
{{- if isset .Params "extlink" }}
|
||||
<a href="{{ .Params.extlink }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-title-link post-title-link-external" title="">
|
||||
<span itemprop="name">{{- .Title -}}</span>
|
||||
<i class="fa fa-external-link-alt"></i>
|
||||
</a>
|
||||
{{- else }}
|
||||
<a class="post-title-link" href="{{ .Permalink }}" itemprop="url">
|
||||
<span itemprop="name">{{ .Title }}</span>
|
||||
</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
</header>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $paginator := .Paginator.Pages.GroupByDate "2006" }}
|
||||
{{ partial "list.html" $paginator }}
|
||||
|
||||
|
||||
18
layouts/_default/list.localindexes.xml
Normal file
18
layouts/_default/list.localindexes.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
|
||||
<search>
|
||||
{{range where .Site.RegularPages "Kind" "page"}}
|
||||
<entry>
|
||||
<title>{{ .Title }}</title>
|
||||
<url>{{ .Permalink }}</url>
|
||||
<categories>
|
||||
{{- range .Params.categories }}<category>{{ . }}</category>{{- end }}
|
||||
</categories>
|
||||
<tags>
|
||||
{{- range .Params.tags }}
|
||||
<tag>{{ . }}</tag>
|
||||
{{- end }}
|
||||
</tags>
|
||||
<content type="html"><![CDATA[{{ .Content | plainify }}]]></content>
|
||||
</entry>
|
||||
{{ end }}
|
||||
</search>
|
||||
@@ -1,36 +1,15 @@
|
||||
{{- define "title" }}
|
||||
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "AllSome" }} - {{ .Site.Title -}}
|
||||
{{- .Params.Title | default (T .Section) | default .Section }} - {{ .Site.Title -}}
|
||||
{{- end -}}
|
||||
{{ define "main_inner_class" }}archive posts-collapse{{ end }}
|
||||
{{- define "main" }}
|
||||
<div class="post-block">
|
||||
<div class="post-content">
|
||||
<div class="collection-title">
|
||||
{{- $cheers := "Um" }}
|
||||
{{- $posts := .Scratch.Get "postsCount" }}
|
||||
{{- if gt $posts 210 }}
|
||||
{{- $cheers = "Excellent" }}
|
||||
{{- else if gt $posts 130 }}
|
||||
{{- $cheers = "Great" }}
|
||||
{{- else if gt $posts 80 }}
|
||||
{{- $cheers = "Good" }}
|
||||
{{- else if gt $posts 50 }}
|
||||
{{- $cheers = "Nice" }}
|
||||
{{- else if gt $posts 30 }}
|
||||
{{- $cheers = "Ok" }}
|
||||
{{- end }}
|
||||
<span class="collection-header">
|
||||
{{- T (printf "PostArchiveCheers%s" $cheers) }}
|
||||
{{- T "SymbolComma" }}
|
||||
{{- T "ArchiveCounterTitle" $posts | safeHTML }}
|
||||
{{- T "SymbolComma" }}
|
||||
{{- T "PostArchiveKeepOn" }}
|
||||
</span>
|
||||
</div>
|
||||
{{ define "main_inner_class" }}index posts-expand{{ end }}
|
||||
|
||||
{{ .Render "list" }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{- partial "pagination.html" . }}
|
||||
{{- define "main" }}
|
||||
|
||||
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "==" .Section) }}
|
||||
{{- range $paginator.Pages }}
|
||||
{{ partial "post.html" (dict "ctx" . "IsHome" true) }}
|
||||
{{- end }}
|
||||
|
||||
{{- partial "partials/pagination.html" . }}
|
||||
|
||||
{{- end }}
|
||||
2
layouts/archives/list.html
Normal file
2
layouts/archives/list.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{{ $paginator := (.Paginate (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)).Pages.GroupByDate "2006" }}
|
||||
{{ partial "list.html" $paginator }}
|
||||
36
layouts/archives/section.html
Normal file
36
layouts/archives/section.html
Normal file
@@ -0,0 +1,36 @@
|
||||
{{- define "title" }}
|
||||
{{- .Params.Title | default (T .Section) | default .Section | dict "Some" | T "AllSome" }} - {{ .Site.Title -}}
|
||||
{{- end -}}
|
||||
{{ define "main_inner_class" }}archive posts-collapse{{ end }}
|
||||
{{- define "main" }}
|
||||
<div class="post-block">
|
||||
<div class="post-content">
|
||||
<div class="collection-title">
|
||||
{{- $cheers := "Um" }}
|
||||
{{- $posts := .Scratch.Get "postsCount" }}
|
||||
{{- if gt $posts 210 }}
|
||||
{{- $cheers = "Excellent" }}
|
||||
{{- else if gt $posts 130 }}
|
||||
{{- $cheers = "Great" }}
|
||||
{{- else if gt $posts 80 }}
|
||||
{{- $cheers = "Good" }}
|
||||
{{- else if gt $posts 50 }}
|
||||
{{- $cheers = "Nice" }}
|
||||
{{- else if gt $posts 30 }}
|
||||
{{- $cheers = "Ok" }}
|
||||
{{- end }}
|
||||
<span class="collection-header">
|
||||
{{- T (printf "PostArchiveCheers%s" $cheers) }}
|
||||
{{- T "SymbolComma" }}
|
||||
{{- T "ArchiveCounterTitle" $posts | safeHTML }}
|
||||
{{- T "SymbolComma" }}
|
||||
{{- T "PostArchiveKeepOn" }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{{ .Render "list" }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{- partial "pagination.html" . }}
|
||||
{{- end }}
|
||||
34
layouts/flinks/single.html
Normal file
34
layouts/flinks/single.html
Normal file
@@ -0,0 +1,34 @@
|
||||
{{- define "title" }}{{- .Title }} - {{ .Site.Title -}}{{- end }}
|
||||
|
||||
{{- define "main_inner_class" }}flinks posts-expand{{- end }}
|
||||
|
||||
{{ define "main" }}
|
||||
<div class="flinks-block">
|
||||
<h1 class="flinks-block-title">{{ .Title }}</h1>
|
||||
<div class="flinks-lists">
|
||||
{{ range .Site.Data.flinks }}
|
||||
<div class="flinks-list">
|
||||
<div class="flinks-list-title">{{ .FLinksTitle | safeHTML }}</div>
|
||||
<div class="flinks-list-desc">{{ .FLinksDesc | safeHTML }}</div>
|
||||
<div class="flinks-list-items">
|
||||
{{ range .FLinksList }}
|
||||
<div class="flinks-list-item">
|
||||
<a href="{{ .link }}" rel="external nofollow noreferrer" title=" {{ .name }}" target="_blank">
|
||||
<div class="flinks-item-icon">
|
||||
<img class="no-lightbox entered loaded" src="{{ .avatar }}" alt="{{ .name }}"/>
|
||||
</div>
|
||||
<div class="flinks-item-name">{{ .name | safeHTML }}</div>
|
||||
<div class="flinks-item-desc" title="{{ .desc }}">{{ .desc | safeHTML }}</div>
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="flinks-list-footer"><hr/></div>
|
||||
<div class="flinks-page-desc">{{ .Content }}</div>
|
||||
</div>
|
||||
|
||||
|
||||
{{ end }}
|
||||
@@ -1,8 +1,11 @@
|
||||
{{- define "main_inner_class" }}index posts-expand{{- end }}
|
||||
|
||||
{{- define "main" }}
|
||||
|
||||
{{ $paginator := .Paginate (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
|
||||
{{- range $paginator.Pages }}
|
||||
{{ partial "post.html" (dict "ctx" . "IsHome" true) }}
|
||||
{{ partial "post.html" (dict "ctx" . "IsHome" true) }}
|
||||
{{- end }}
|
||||
|
||||
{{- partial "partials/pagination.html" . }}
|
||||
{{- end }}
|
||||
19
layouts/partials/_thirdparty/analytics/51la.html
vendored
19
layouts/partials/_thirdparty/analytics/51la.html
vendored
@@ -1,2 +1,17 @@
|
||||
<script charset="UTF-8" id="LA_COLLECT" src="https://sdk.51.la/js-sdk-pro.min.js"></script>
|
||||
<script>LA.init({id: "{{ . }}",ck: "{{ . }}",autoTrack:true})</script>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
var script = document.createElement('script');
|
||||
|
||||
script.charset = "UTF-8";
|
||||
script.id = "LA_COLLECT";
|
||||
script.src = "{{ .Site.Data.resources.analytics.la }}";
|
||||
script.async = "true"
|
||||
script.onload = function() {
|
||||
{{ with .Site.Params.analytics.laId }}
|
||||
LA.init({ id: "{{ . }}",ck: "{{ . }}", autoTrack:true });
|
||||
{{ end }}
|
||||
}
|
||||
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
</script>
|
||||
|
||||
21
layouts/partials/_thirdparty/comment/artalk.html
vendored
21
layouts/partials/_thirdparty/comment/artalk.html
vendored
@@ -1,20 +1 @@
|
||||
{{- with .Site.Params.artalk }}
|
||||
<link href="//unpkg.com/artalk@2.3.4/dist/Artalk.css" rel="stylesheet">
|
||||
<script src="//unpkg.com/artalk@2.3.4/dist/Artalk.js"></script>
|
||||
|
||||
<!-- Artalk -->
|
||||
<div id="Comments"></div>
|
||||
|
||||
<script>
|
||||
new Artalk({
|
||||
el : '#Comments',
|
||||
pageKey : '{{ $.Page.RelPermalink }}',
|
||||
pageTitle : '{{ $.Page.Title }}',
|
||||
server : '{{ .server }}',
|
||||
site : '{{ .site }}',
|
||||
locale : 'auto',
|
||||
placeholder : '{{ .placeholder }}'
|
||||
})
|
||||
</script>
|
||||
{{- end }}
|
||||
|
||||
<div class="artalk-container"></div>
|
||||
|
||||
20
layouts/partials/_thirdparty/comment/giscus.html
vendored
20
layouts/partials/_thirdparty/comment/giscus.html
vendored
@@ -1,19 +1 @@
|
||||
{{- with .Site.Params.giscus }}
|
||||
{{ printf "%t" (isset . "repo") }}
|
||||
<div class="giscus" style="position: relative;"></div>
|
||||
<script src="https://giscus.app/client.js"
|
||||
data-repo="{{ .repo }}"
|
||||
data-repo-id="{{ .repoId }}"
|
||||
data-category="{{ .category }}"
|
||||
data-category-id="{{ .categoryId }}"
|
||||
data-mapping="{{ .mapping }}"
|
||||
data-reactions-enabled="0"
|
||||
data-emit-metadata="1"
|
||||
data-input-position="{{ .inputPosition }}"
|
||||
data-theme="{{ .theme }}"
|
||||
data-lang="{{ $.Site.LanguageCode }}"
|
||||
data-loading="lazy"
|
||||
crossorigin="anonymous"
|
||||
async>
|
||||
</script>
|
||||
{{- end }}
|
||||
<div class="giscus-container"></div>
|
||||
14
layouts/partials/_thirdparty/comment/livere.html
vendored
14
layouts/partials/_thirdparty/comment/livere.html
vendored
@@ -1,13 +1 @@
|
||||
{{- with .Site.Params.LiveRe }}
|
||||
<div id="lv-container" data-id="city" data-uid="{{ .uid }}"></div>
|
||||
<script type="text/javascript">
|
||||
(function(d, s) {
|
||||
var j, e = d.getElementsByTagName(s)[0];
|
||||
if (typeof LivereTower === 'function') { return; }
|
||||
j = d.createElement(s);
|
||||
j.src = '//cdn-city.livere.com/js/embed.dist.js';
|
||||
j.async = true;
|
||||
e.parentNode.insertBefore(j, e);
|
||||
})(document, 'script');
|
||||
</script>
|
||||
{{- end }}
|
||||
<div id="lv-container" data-id="city" data-uid="{{ .Site.Params.livere.uid }}"></div>
|
||||
@@ -1,9 +1 @@
|
||||
{{- with .Site.Params.utterances }}
|
||||
<script src="https://utteranc.es/client.js"
|
||||
repo="{{ .repo }}"
|
||||
issue-term="{{ .issueTerm }}"
|
||||
label="{{ .label }}"
|
||||
crossorigin="anonymous"
|
||||
theme="{{ .theme }}" async>
|
||||
</script>
|
||||
{{- end }}
|
||||
<div class="utterances-container"></div>
|
||||
|
||||
24
layouts/partials/_thirdparty/comment/waline.html
vendored
24
layouts/partials/_thirdparty/comment/waline.html
vendored
@@ -1,23 +1 @@
|
||||
{{- with .Site.Params.waline }}
|
||||
<div id="waline"></div>
|
||||
|
||||
<link rel="stylesheet" href="//unpkg.com/@waline/client@v2/dist/waline.css"/>
|
||||
<script src="//unpkg.com/@waline/client@v2/dist/waline.js"></script>
|
||||
<script type="text/javascript">
|
||||
const locale = {
|
||||
placeholder: "{{ .placeholder }}"
|
||||
};
|
||||
Waline.init({
|
||||
locale,
|
||||
el : "#waline",
|
||||
pageview : {{ .pageView }},
|
||||
emoji : {{ .emoji }},
|
||||
imageUploader : {{ .imgUploader }},
|
||||
wordLimit : {{ .wordLimit }},
|
||||
requiredMeta : {{ .requiredMeta }},
|
||||
serverURL : "{{ .serverURL }}",
|
||||
lang : "{{ $.Lang }}",
|
||||
dark : "auto"
|
||||
});
|
||||
</script>
|
||||
{{- end }}
|
||||
<div class="waline-container"></div>
|
||||
14
layouts/partials/_thirdparty/search/algolia.html
vendored
Normal file
14
layouts/partials/_thirdparty/search/algolia.html
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<div class="search-header">
|
||||
<span class="search-icon">
|
||||
<i class="fa fa-search"></i>
|
||||
</span>
|
||||
<div class="search-input-container"></div>
|
||||
<span class="popup-btn-close" role="button">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="search-result-container">
|
||||
<div class="algolia-stats"><hr></div>
|
||||
<div class="algolia-hits"></div>
|
||||
<div class="algolia-pagination"></div>
|
||||
</div>
|
||||
18
layouts/partials/_thirdparty/search/local.html
vendored
Normal file
18
layouts/partials/_thirdparty/search/local.html
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<div class="search-header">
|
||||
<span class="search-icon">
|
||||
<i class="fa fa-search"></i>
|
||||
</span>
|
||||
<div class="search-input-container">
|
||||
<input autocomplete="off" autocapitalize="off" maxlength="80"
|
||||
placeholder="{{ T "SearchPh" }}" spellcheck="false"
|
||||
type="search" class="search-input">
|
||||
</div>
|
||||
<span class="popup-btn-close" role="button">
|
||||
<i class="fa fa-times-circle"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="search-result-container no-result">
|
||||
<div class="search-result-icon">
|
||||
<i class="fa fa-spinner fa-pulse fa-5x"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,3 @@
|
||||
{{- with .Site.Params.addThisId }}
|
||||
<div class="addthis_inline_share_toolbox" style="text-align: center;">
|
||||
<script src="//s7.addthis.com/js/300/addthis_widget.js#pubid={{ . }}" async="async"></script>
|
||||
</div>
|
||||
{{- if isset .Site.Params "addthisid" }}
|
||||
<div class="addthis_inline_share_toolbox" style="text-align: center;"></div>
|
||||
{{- end }}
|
||||
@@ -1,6 +1,5 @@
|
||||
{{- $root := . -}}
|
||||
{{- with .Site.Params.comments }}
|
||||
{{- if .enable }}
|
||||
{{- $tc := and .storage (gt (len .nav) 1) }}
|
||||
{{- $active := .active }}
|
||||
{{- $fc := .active }}
|
||||
@@ -41,4 +40,3 @@
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -5,4 +5,6 @@
|
||||
{{- partial "head/facebook.html" . }}
|
||||
{{- partial "head/verify.html" . }}
|
||||
{{- partialCached "head/style.html" . }}
|
||||
{{- partialCached "head/analytics.html" . }}
|
||||
{{- partial "head/config.html" . }}
|
||||
{{- partialCached "head/analytics.html" . }}
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
{{- with .Site.Params.analytics }}
|
||||
{{- if isset . "laid" }}
|
||||
{{ partial "_thirdparty/analytics/51la.html" .laId }}
|
||||
{{- if isset .Site.Params.analytics "laid" }}
|
||||
{{ partial "_thirdparty/analytics/51la.html" . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
10
layouts/partials/head/config.html
Normal file
10
layouts/partials/head/config.html
Normal file
@@ -0,0 +1,10 @@
|
||||
<script class="next-config" data-name="page" type="application/json">
|
||||
{{- dict
|
||||
"isHome" .IsHome
|
||||
"isPage" .IsPage
|
||||
"comments" (.Params.comments | default .Site.Params.comments.enable)
|
||||
"permalink" (.Page.Permalink | absURL)
|
||||
"path" (.Page.Permalink | path.Base)
|
||||
"title" .Page.Title
|
||||
-}}
|
||||
</script>
|
||||
@@ -1,7 +1,9 @@
|
||||
<!-- Website icons -->
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{{ .Site.Params.favicon.icon }}">
|
||||
<link rel="icon" type="image/x-icon" href="{{ .Site.Params.favicon.icon }}">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ .Site.Params.favicon.small }}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ .Site.Params.favicon.medium }}">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ .Site.Params.favicon.appleTouchIcon }}">
|
||||
{{- with .Site.Params.favicon }}
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{{ .icon }}">
|
||||
<link rel="icon" type="image/x-icon" href="{{ .icon }}">
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ .small }}">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="{{ .medium }}">
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ .appleTouchIcon }}">
|
||||
{{- end }}
|
||||
<!-- Website icons -->
|
||||
@@ -1,22 +1,22 @@
|
||||
<!-- Plugin style files -->
|
||||
{{- $cssRes := .Site.Data.resources.css }}
|
||||
{{- $vendor := .Site.Params.vendors.plugins }}
|
||||
{{- $vendorCDN := .Scratch.Get "pluginCDN" }}
|
||||
{{- $router := .Scratch.Get "router" }}
|
||||
{{ $cssFmt := "%s/%s@%s/%s" }}
|
||||
{{- range $css := $cssRes }}
|
||||
{{- $pluginCSS := $vendorCDN }}
|
||||
{{- $npm := $css.name }}
|
||||
{{- $file := $css.file }}
|
||||
{{- if eq $vendor "cdnjs" }}
|
||||
{{- with $css.alias }}
|
||||
{{- $npm = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- $file = replaceRE `(dist|lib|source\/js)\/` "" $css.file }}
|
||||
{{- $cssFmt = "%s/%s/%s/%s" }}
|
||||
{{- end }}
|
||||
{{- $pluginCSS = replace $pluginCSS "${name}" $npm }}
|
||||
{{- $pluginCSS = replace $pluginCSS "${version}" $css.version }}
|
||||
{{- $pluginCSS = replace $pluginCSS "${file}" $file }}
|
||||
<link rel="stylesheet" href="{{ $pluginCSS }}">
|
||||
{{- $pluginCSS := printf $cssFmt $router $npm $css.version $file }}
|
||||
<link type="text/css" rel="stylesheet" href="{{ $pluginCSS }}" />
|
||||
{{- end }}
|
||||
|
||||
<!-- Main Style file -->
|
||||
{{- $scss := resources.Get "css/main.scss" }}
|
||||
{{- $scss = $scss | resources.ExecuteAsTemplate "main.scss" . }}
|
||||
@@ -27,7 +27,7 @@
|
||||
<link rel="stylesheet" href="{{ $css.RelPermalink }}">
|
||||
{{- if .IsPage }}
|
||||
<style type="text/css">
|
||||
.post-footer hr:after {
|
||||
.post-footer, .flinks-list-footer hr:after {
|
||||
content: "{{ .Site.Params.postFooter.endLineTip }}";
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
{{ partial "header/brand.html" . }}
|
||||
{{ partial "header/menus.html" . }}
|
||||
{{ partial "header/menus.html" . }}
|
||||
{{ partial "header/search.html" . }}
|
||||
11
layouts/partials/header/search.html
Normal file
11
layouts/partials/header/search.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{- if or .Site.Params.algoliaSearch.enable .Site.Params.localSearch.enable }}
|
||||
<div class="search-pop-overlay">
|
||||
<div class="popup search-popup">
|
||||
{{- if .Site.Params.algoliaSearch.enable }}
|
||||
{{ partial "_thirdparty/search/algolia.html" . }}
|
||||
{{- else if .Site.Params.localSearch.enable }}
|
||||
{{ partial "_thirdparty/search/local.html" . }}
|
||||
{{- end }}
|
||||
</div>
|
||||
</div>
|
||||
{{- end }}
|
||||
@@ -1,14 +1,109 @@
|
||||
{{/* Use to defind global variables */}}
|
||||
|
||||
{{- if not hugo.IsExtended }}
|
||||
{{- warnf "Hugo NexT 主题使用了 SCSS 框架,请到官方地址下载 Hugo Extended 版本:https://github.com/gohugoio/hugo/releases" -}}
|
||||
{{- errorf "Because that use SCSS framework in Hugo NexT, Please download Hugo extended version on offical site: https://github.com/gohugoio/hugo/releases" -}}
|
||||
{{- end }}
|
||||
{{ $version := int (index (split hugo.Version ".") 1) }}
|
||||
{{ if lt $version 89 }}
|
||||
{{ warnf "当前 Hugo 版本小于 0.89.0,请到官方地址下载 Hugo 最新版本:https://github.com/gohugoio/hugo/releases" }}
|
||||
{{ errorf "Current Hugo version is less then 0.89.0, Please download Hugo latest version on offical site: https://github.com/gohugoio/hugo/releases" }}
|
||||
{{ end }}
|
||||
|
||||
{{- .Scratch.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) -}}
|
||||
{{- .Scratch.Set "catsCount" (len .Site.Taxonomies.categories) -}}
|
||||
{{- .Scratch.Set "tagsCount" (len .Site.Taxonomies.tags) -}}
|
||||
{{- $vendors := .Site.Data.resources.vendors -}}
|
||||
{{- $pluginVen := .Site.Params.vendors.plugins -}}
|
||||
{{- $pluginCDN := index $vendors $pluginVen -}}
|
||||
{{- .Scratch.Set "pluginCDN" $pluginCDN -}}
|
||||
{{ if not hugo.IsExtended }}
|
||||
{{ warnf "Hugo NexT 主题使用了 SCSS 框架,请到官方地址下载 Hugo Extended 版本:https://github.com/gohugoio/hugo/releases" }}
|
||||
{{ errorf "Because that use SCSS framework in Hugo NexT, Please download Hugo extended version on offical site: https://github.com/gohugoio/hugo/releases" }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{ $globalVars := newScratch }}
|
||||
|
||||
{{ $globalVars.Set "postsCount" (len (where .Page.Site.RegularPages "Section" "in" .Site.Params.mainSections)) }}
|
||||
{{ $globalVars.Set "catsCount" (len .Site.Taxonomies.categories) }}
|
||||
{{ $globalVars.Set "tagsCount" (len .Site.Taxonomies.tags) }}
|
||||
|
||||
{{ $vendor := .Site.Params.vendors.plugins }}
|
||||
{{ $router := index .Site.Data.resources.vendors $vendor }}
|
||||
{{ $globalVars.Set "router" $router }}
|
||||
|
||||
{{ $config := dict
|
||||
"hostname" .Site.BaseURL
|
||||
"root" "/"
|
||||
"lang" .Site.LanguageCode
|
||||
"vendor" (dict "plugins" $vendor "router" $router)
|
||||
"darkmode" .Site.Params.darkmode
|
||||
"version" .Site.Data.config.version
|
||||
"scheme" .Site.Params.scheme
|
||||
"sidebar" .Site.Params.sidebar
|
||||
"copybtn" .Site.Params.codeblock.copyBtn
|
||||
"bookmark" .Site.Params.bookmark
|
||||
"lazyload" .Site.Params.lazyload
|
||||
"motion" .Site.Params.motion
|
||||
"i18n" (dict
|
||||
"placeholder" (T "SearchPh")
|
||||
"empty" (T "SearchEmpty")
|
||||
"hits_time" (T "SearchHitsTime")
|
||||
"hits" (T "SearchHits")
|
||||
)
|
||||
}}
|
||||
|
||||
{{ if .Site.Params.localSearch.enable }}
|
||||
{{ $localSearch := dict "localSearch" .Site.Params.localSearch }}
|
||||
{{ $config = merge $config $localSearch }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.algoliaSearch.enable }}
|
||||
{{ $algoliaSearch := dict
|
||||
"js" .Site.Data.resources.algolia
|
||||
"instantjs" .Site.Data.resources.instant
|
||||
"cfg" .Site.Params.algoliaSearch
|
||||
}}
|
||||
{{ $config = merge $config (dict "algolia" $algoliaSearch) }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Params.waline }}
|
||||
{{ $waline := dict
|
||||
"js" $.Site.Data.resources.waline.js
|
||||
"css" $.Site.Data.resources.waline.css
|
||||
"cfg" .
|
||||
}}
|
||||
{{ $config = merge $config (dict "waline" $waline) }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Params.giscus }}
|
||||
{{ $giscus := dict
|
||||
"js" $.Site.Data.resources.giscus.js
|
||||
"cfg" .
|
||||
}}
|
||||
{{ $config = merge $config (dict "giscus" $giscus) }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Params.artalk }}
|
||||
{{ $artalk := dict
|
||||
"js" $.Site.Data.resources.artalk.js
|
||||
"css" $.Site.Data.resources.artalk.css
|
||||
"cfg" .
|
||||
}}
|
||||
{{ $config = merge $config (dict "artalk" $artalk) }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Params.livere }}
|
||||
{{ $livere := dict "js" $.Site.Data.resources.livere.js }}
|
||||
{{ $config = merge $config (dict "livere" $livere) }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Params.utterances }}
|
||||
{{ $utterances := dict
|
||||
"js" $.Site.Data.resources.utterances.js
|
||||
"cfg" .
|
||||
}}
|
||||
{{ $config = merge $config (dict "utterances" $utterances) }}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Params.addThisId }}
|
||||
{{ $addthis := dict
|
||||
"js" $.Site.Data.resources.addthis.js
|
||||
"cfg" (dict "pubid" .)
|
||||
}}
|
||||
{{ $config = merge $config (dict "addthis" $addthis) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $globalVars.Set "config" $config }}
|
||||
|
||||
{{ return $globalVars.Values }}
|
||||
|
||||
29
layouts/partials/list.html
Normal file
29
layouts/partials/list.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{{ range . }}
|
||||
<div class="collection-year">
|
||||
<span class="collection-header">{{ .Key }}</span>
|
||||
</div>
|
||||
{{ range .Pages }}
|
||||
<article itemscope itemtype="http://schema.org/Article">
|
||||
<header class="post-header">
|
||||
<div class="post-meta-container">
|
||||
{{ $month := .Date.Format .Site.Params.monthFormat }}
|
||||
<time itemprop="dateCreated" datetime="{{ .Date.Format .Site.Params.timeFormat }}" content="{{ $month }}">
|
||||
{{ $month }}
|
||||
</time>
|
||||
</div>
|
||||
<div class="post-title">
|
||||
{{- if isset .Params "extlink" }}
|
||||
<a href="{{ .Params.extlink }}" rel="noopener external nofollow noreferrer" target="_blank" class="exturl post-title-link post-title-link-external" title="">
|
||||
<span itemprop="name">{{- .Title -}}</span>
|
||||
<i class="fa fa-external-link-alt"></i>
|
||||
</a>
|
||||
{{- else }}
|
||||
<a class="post-title-link" href="{{ .RelPermalink | relLangURL }}" itemprop="url">
|
||||
<span itemprop="name">{{ .Title }}</span>
|
||||
</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
</header>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -25,15 +25,15 @@
|
||||
<div class="post-nav">
|
||||
<div class="post-nav-next post-nav-item">
|
||||
{{- with .NextInSection }}
|
||||
<a href="{{ .Permalink}}" rel="next" title="{{.Title}}">
|
||||
<i class="fa fa-chevron-left"></i> {{.Title}}
|
||||
<a href="{{ .RelPermalink | relLangURL }}" rel="next" title="{{ .Title }}">
|
||||
<i class="fa fa-chevron-left"></i> {{ .Title }}
|
||||
</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
<div class="post-nav-prev post-nav-item">
|
||||
{{- with .PrevInSection }}
|
||||
<a href="{{ .Permalink}}" rel="prev" title="{{.Title}}">
|
||||
{{.Title}}
|
||||
<a href="{{ .RelPermalink | relLangURL }}" rel="prev" title="{{ .Title }}">
|
||||
{{ .Title }}
|
||||
<i class="fa fa-chevron-right"></i>
|
||||
</a>
|
||||
{{- end }}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{{- with .Params.tags }}
|
||||
{{- if gt (len .) 0 }}
|
||||
<div class="post-tags">
|
||||
{{ range . }}
|
||||
<a href="{{ . }}">{{ . }}</a>
|
||||
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize | lower }}">
|
||||
{{ . }}
|
||||
</a>
|
||||
{{- end }}
|
||||
</div>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,11 +1,11 @@
|
||||
{{- if .Site.Params.postMeta.categories }}
|
||||
{{- if and .Params.categories (gt (len .Params.categories) 0) }}
|
||||
{{- with .Params.categories }}
|
||||
<span class="post-meta-item">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="far fa-folder-open"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{- print (T "PostCategory") (T "SymbolColon") -}}</span>
|
||||
{{- range (first 1 .Params.categories) }}
|
||||
{{- range (first 1 .) }}
|
||||
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
||||
<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}" itemprop="url" rel="index">
|
||||
<span itemprop="name">{{- . -}}</span>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
{{- if .Site.Params.leancloudVisitors.enable }}
|
||||
{{- $pageViewCls = "leancloud-visitors-count" }}
|
||||
{{- end }}
|
||||
{{- if and .Site.Params.waline.enable .Site.Params.waline.pageView }}
|
||||
{{- if .Site.Params.waline.pageView }}
|
||||
{{- $pageViewCls = "waline-pageview-count" }}
|
||||
{{- end }}
|
||||
{{- if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.postViews }}
|
||||
{{- if .Site.Params.busuanzi.postViews }}
|
||||
{{- $pageViewCls = "busuanzi_value_page_pv" }}
|
||||
{{- end }}
|
||||
<span class="post-meta-item" title="{{ T "PostViews" }}">
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{{- if isset .Params "categories" }}
|
||||
{{- if not (eq (len .Params.categories) 0) }}
|
||||
<span class="post-meta-item">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-folder-open"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{- T "PostCatg" }}{{- T "ColoneFlag"}}</span>
|
||||
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
||||
{{- range (first 3 .Params.categories) }}
|
||||
<span class="post-meta-catg" itemprop="name">
|
||||
<a href="{{ . | urlize }}" itemprop="url" rel="index">{{ . }}</a>
|
||||
</span>
|
||||
{{- end }}
|
||||
</span>
|
||||
</span>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -1,16 +0,0 @@
|
||||
<span class="post-meta-item">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="far fa-calendar"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{- T "PostPublishDate" }}{{- T "ColoneFlag" }}</span>
|
||||
<time title="{{ T "PostPublishTime" }}{{ T "ColoneFlag" }}{{ .PublishDate }}" itemprop="dateCreated datePublished" datetime="{{ .PublishDate }}">{{- .PublishDate.Format .Site.Params.DateFormat -}}</time>
|
||||
</span>
|
||||
{{- if gt .Lastmod .PublishDate }}
|
||||
<span class="post-meta-item">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="far fa-calendar-check"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{- T "PostLastModDate" }}{{- T "ColoneFlag" }}</span>
|
||||
<time title="{{ T "PostLastModTime" }}{{ T "ColoneFlag" }}{{ .Lastmod }}" itemprop="dateModified" datetime="{{ .Lastmod }}">{{- .Lastmod.Format .Site.Params.DateFormat -}}</time>
|
||||
</span>
|
||||
{{- end }}
|
||||
@@ -1,7 +0,0 @@
|
||||
<span class="post-meta-item">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-hourglass"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{- T "PostReading" }}{{- T "ColoneFlag" -}}</span>
|
||||
<span>{{- T "PostReadTime" . -}}</span>
|
||||
</span>
|
||||
@@ -1,17 +0,0 @@
|
||||
{{- if isset .Params "tags" }}
|
||||
{{- if not (eq (len .Params.tags) 0) }}
|
||||
<span class="post-meta-item">
|
||||
<span class="post-meta-item-icon">
|
||||
<i class="fa fa-tags"></i>
|
||||
</span>
|
||||
<span class="post-meta-item-text">{{- T "PostTag" }}{{- T "ColoneFlag"}}</span>
|
||||
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
|
||||
{{- range (first 3 .Params.tags) }}
|
||||
<span class="post-meta-catg" itemprop="name">
|
||||
<a href="{{ . | urlize }}" itemprop="url" rel="index">{{ . }}</a>
|
||||
</span>
|
||||
{{- end }}
|
||||
</span>
|
||||
</span>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user