Skip to content

Commit

Permalink
feat: #150
Browse files Browse the repository at this point in the history
  • Loading branch information
everfu committed Mar 26, 2024
1 parent 6bb5602 commit 8a710e8
Show file tree
Hide file tree
Showing 9 changed files with 564 additions and 294 deletions.
146 changes: 77 additions & 69 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ nav:
# logo 箱子
# logo group
group:
# 项目: # 分类名称
# Solitude: https://github.com/valor-x/hexo-theme-solitude || /img/logo.png # 子菜单名称(submenu name): 链接地址(address) || 图标(icon)
# 项目: # 分类名称
# Solitude: https://github.com/valor-x/hexo-theme-solitude || /img/logo.png # 子菜单名称(submenu name): 链接地址(address) || 图标(icon)

# 中心菜单
# center menu
menu:
# 首页: / # 显示名称:路径 / Display name: path
# 文库: # 显示名称 / Display name
# 文章列表: /archives/ || st-folder-fill # 子菜单名称:路径 || 图标 / Submenu name: path || icon
# 全部分类: /categories/ || st-checkbox-multiple-blank-fill
# 全部标签: /tags/ || st-price-tag-fill
# 友链:
# 友链鱼塘: /moments/ || st-wifi-fill
# 友情链接: /links/ || st-group-fill
# 宝藏博主: javascript:travelling() || st-gift-fill
# 我的:
# 装备: /equipment/ || st-laptop-line
# 工具箱: /tlink/ || st-tools-fill
# 音乐馆: /music/ || st-disc-fill
# 关于:
# 关于本站: /about/ || st-contacts-fill
# 首页: / # 显示名称:路径 / Display name: path
# 文库: # 显示名称 / Display name
# 文章列表: /archives/ || st-folder-fill # 子菜单名称:路径 || 图标 / Submenu name: path || icon
# 全部分类: /categories/ || st-checkbox-multiple-blank-fill
# 全部标签: /tags/ || st-price-tag-fill
# 友链:
# 友链鱼塘: /moments/ || st-wifi-fill
# 友情链接: /links/ || st-group-fill
# 宝藏博主: javascript:travelling() || st-gift-fill
# 我的:
# 装备: /equipment/ || st-laptop-line
# 工具箱: /tlink/ || st-tools-fill
# 音乐馆: /music/ || st-disc-fill
# 关于:
# 关于本站: /about/ || st-contacts-fill

# 右侧按钮
# Button on the right
Expand All @@ -69,11 +69,11 @@ nav:
# 左至右
# from left to right
custom:
# - name: 开往 - 友链接力 # 显示文字 / Displayed text
# url: https://www.travellings.cn/go.html # 跳转链接 / Jump link
# icon: st-train-line # 图标 / Icon
# onclick: # 点击事件 / Click event
# id: travellings_button # id
# - name: 开往 - 友链接力 # 显示文字 / Displayed text
# url: https://www.travellings.cn/go.html # 跳转链接 / Jump link
# icon: st-train-line # 图标 / Icon
# onclick: # 点击事件 / Click event
# id: travellings_button # id

# 首页顶部样式
# Home top style
Expand All @@ -93,31 +93,31 @@ hometop:
# Carousel icon
# tip: 76x76 size
icon:
# HTML: # 名字 / Name
# img: https://7.isyangs.cn/34/65f2e42921677-34.png # 图片 / Image
# color: "#e9572b" # 背景色 / Background color
# JS:
# img: https://7.isyangs.cn/34/65f2e43ceddda-34.png
# color: "#f7cb4f"
# Docker:
# img: https://7.isyangs.cn/34/65f2e45462045-34.png
# color: "#57b6e6"
# Flutter:
# img: https://7.isyangs.cn/34/65f2e47acbe98-34.png
# color: "#ffffff"
# WebPack:
# img: https://7.isyangs.cn/34/65f2e488bf8ed-34.png
# color: "#2e3a41"
# Git:
# img: https://7.isyangs.cn/34/65f2e499066fa-34.png
# color: "#df5b40"
# HTML: # 名字 / Name
# img: https://7.isyangs.cn/34/65f2e42921677-34.png # 图片 / Image
# color: "#e9572b" # 背景色 / Background color
# JS:
# img: https://7.isyangs.cn/34/65f2e43ceddda-34.png
# color: "#f7cb4f"
# Docker:
# img: https://7.isyangs.cn/34/65f2e45462045-34.png
# color: "#57b6e6"
# Flutter:
# img: https://7.isyangs.cn/34/65f2e47acbe98-34.png
# color: "#ffffff"
# WebPack:
# img: https://7.isyangs.cn/34/65f2e488bf8ed-34.png
# color: "#2e3a41"
# Git:
# img: https://7.isyangs.cn/34/65f2e499066fa-34.png
# color: "#df5b40"

# 左下跳转按钮
# Banner lower left jump button
group:
# 热门: /tags/热门/ || st-fire-fill || linear-gradient(to right,#f65,#ffbf37)
# 教程: /tags/教程/ || st-book-mark-fill || linear-gradient(to right,#358bff,#15c6ff)
# 精选: /tags/精选/ || st-star-smile-fill || linear-gradient(to right,#18e7ae,#1eebeb)
# 热门: /tags/热门/ || st-fire-fill || linear-gradient(to right,#f65,#ffbf37)
# 教程: /tags/教程/ || st-book-mark-fill || linear-gradient(to right,#358bff,#15c6ff)
# 精选: /tags/精选/ || st-star-smile-fill || linear-gradient(to right,#18e7ae,#1eebeb)

# 右侧置顶列表(在文章的front matter中添加“recommend: true”)
# Right top list (add "recommend: true" in the front matter of the article)
Expand Down Expand Up @@ -257,7 +257,7 @@ aside:
# 高亮显示标签列表
# Highlighted tag list
list:
# - "Solitude"
# - "Solitude"

# 侧边栏归档
# aside archive
Expand Down Expand Up @@ -291,6 +291,14 @@ aside:
# Format: yyyy-MM-dd hh-mm-ss
runtime: "2023-04-20 00:00:00"

# 首页文章配置信息
# Configure information on the home page
index_post_list:
direction: column # row / column
content: 3 # 1: post.description / 2: 自动获取description或截取内容(Automatically get descriptions or screenshots) / 3: 只使用截取内容(Use only screenshots) / false: 不显示内容(No content is displayed)
length: 500 # 截取内容的长度 : The length of the screenshot content
cover: both # left: 在左侧 : left / right: 在右侧 : right / both: 两侧 : both

# 页面默认设置
# page default settings
page:
Expand All @@ -301,7 +309,7 @@ page:
# 默认图片
# default cover
cover:
# - /img/default.png # 默认图片 / default cover
# - /img/default.png # 默认图片 / default cover

# 文章页默认设置
# post default settings
Expand All @@ -310,7 +318,7 @@ post:
# 文章默认图片
# default cover
cover:
# - # 默认图片 / default cover
# - # 默认图片 / default cover
# 文章发布默认地址
# default post locate
locate: 衡阳
Expand Down Expand Up @@ -410,20 +418,20 @@ footer:
# 底部导航栏
# Bottom navigation bar
group:
# 导航:
# 归档: /archives/
# 分类: /categories/
# 标签: /tags/
# 服务:
# 阿里云: https://aliyun.com/
# 51la统计: https://v6.51.la/
# 百度统计: https://tongji.baidu.com/
# 支持:
# 打赏记录: /about/
# 协议:
# Cookies: /cookies/
# 用户协议: /privacy/
# 版权协议: /copyright/
# 导航:
# 归档: /archives/
# 分类: /categories/
# 标签: /tags/
# 服务:
# 阿里云: https://aliyun.com/
# 51la统计: https://v6.51.la/
# 百度统计: https://tongji.baidu.com/
# 支持:
# 打赏记录: /about/
# 协议:
# Cookies: /cookies/
# 用户协议: /privacy/
# 版权协议: /copyright/

# 页脚随机友链
# Random links at footer
Expand Down Expand Up @@ -502,7 +510,7 @@ music:
capsule:
enable:
false
# 歌单id / playlist id
# 歌单id / playlist id
id: 8407304077
# 播放列表的服务商。netease:网易云 / tencent:腾讯 / kugou:酷狗 / xiami:小米 / baidu:百度
# Music service provider. netease: Netease Cloud / tencent: Tencent / kugou: Kugou / xiaomi: Xiaomi / baidu: Baidu
Expand Down Expand Up @@ -660,8 +668,8 @@ search:
# - Solitude
# - Hexo
algolia:
# hits:
# per_page: 6
# hits:
# per_page: 6
local:
preload: false
CDN:
Expand Down Expand Up @@ -738,10 +746,10 @@ comment:
# 仅需要填写验证代码即可,譬如:codeva-KReTIJu5us
# Only need to fill in the verification code, such as: codeva-KReTIJu5us
verify_site:
# - name: google-site-verification
# content: xxxxxx
# - name: baidu-site-verification
# content: xxxxxxx
# - name: google-site-verification
# content: xxxxxx
# - name: baidu-site-verification
# content: xxxxxxx

# CSS 前缀
# CSS prefix
Expand All @@ -755,7 +763,7 @@ css_prefix: false
# Font
font:
font-size: 16px
code-font-size: 1rem
code-font-size: 16px
font-family: '"PingFang SC","Hiragino Sans GB","Microsoft YaHei"'
code-font-family: '"monospace", "monospace"'

Expand All @@ -765,7 +773,7 @@ font:
# Insert additional code such as: statistics, advertising, etc.
extends:
head: # 在head中插入 / Insert in head
# - <script src="https://cdn.bootcdn.net/ajax/libs/pace/1.2.4/pace.min.js"></script>
# - <script src="https://cdn.bootcdn.net/ajax/libs/pace/1.2.4/pace.min.js"></script>
body: # 在body中插入 / Insert in body

# PWA
Expand Down
1 change: 0 additions & 1 deletion layout/includes/widgets/home/categoryGroup.pug
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

if group
.categoryGroup

each item in group
- var array = item[1].split('||')
.categoryItem
Expand Down
103 changes: 74 additions & 29 deletions layout/includes/widgets/home/postList.pug
Original file line number Diff line number Diff line change
@@ -1,34 +1,79 @@
mixin cover
a(href=url_for(post.path), title=post.title)
img.post_bg(src=url_for(post.cover), alt=post.title)

mixin info
div.recent-post-info-top
div.recent-post-info-top-tips
if post.sticky && is_home()
span.article-meta.sticky-warp
i.solitude.st-thumbtack-solid.sticky.orange
span.sticky.orange= _p('home.recent-post.sticky')
each category in post.categories.data
span.original= category.name

if post.prev == null && is_home()
span.original= _p('home.recent-post.new')

a.unvisited-post(href=url_for(post.path))= _p('home.recent-post.read')

a.article-title(href=url_for(post.path), title=post.title)= post.title

case theme.index_post_list.content
when false
break
when 1
.content!= post.description
when 2
if post.description
.content!= post.description
else
- const content = strip_html(post.content)
- let expert = content.substring(0, theme.index_post_list.length)
- content.length > theme.index_post_list.length ? expert += ' ...' : ''
.content!= expert
default
- const content = strip_html(post.content)
- let expert = content.substring(0, theme.index_post_list.length)
- content.length > theme.index_post_list.length ? expert += ' ...' : ''
.content!= expert

div.article-meta-wrap
span.article-meta.tags
each tag in post.tags.data
a.article-meta__tags(href=tag.path, onclick="event.stopPropagation();")
span.tags-punctuation=tag.name

span.post-meta-date
time(datetime=moment(post.date))

- const { direction, cover } = theme.index_post_list

if direction === 'row'
- var position = cover === 'both' ? index % 2 === 0 ? 0 : 1 : cover === 'left' ? 0 : 1

div.recent-post-item(onclick="pjax.loadUrl('" + url_for(post.path) + "')")
div.post_cover
a(href=url_for(post.path), title=post.title)
img.post_bg(src=url_for(post.cover), alt=post.title)
div.recent-post-info
div.recent-post-info-top
div.recent-post-info-top-tips
if post.sticky && is_home()
span.article-meta.sticky-warp
i.solitude.st-thumbtack-solid.sticky.orange
span.sticky.orange= _p('home.recent-post.sticky')
each category in post.categories.data
span.original= category.name

if post.prev == null && is_home()
span.original= _p('home.recent-post.new')

a.unvisited-post(href=url_for(post.path))= _p('home.recent-post.read')

a.article-title(href=url_for(post.path), title=post.title)= post.title

div.article-meta-wrap
span.article-meta.tags
each tag in post.tags.data
a.article-meta__tags(href=tag.path, onclick="event.stopPropagation();")
span.tags-punctuation=tag.name

span.post-meta-date
time(datetime=moment(post.date))
if direction === 'column'
div.post_cover
+cover()
div.recent-post-info
+info()
else
case position
when 0
div.post_cover
+cover()
div.recent-post-info
+info()
when 1
div.recent-post-info
+info()
div.post_cover
+cover()


if (theme.google_adsense && theme.google_adsense.enable && theme.google_adsense.auto_ads === false)
if (index + 1) % 3 == 0
if (index + 1) % 3 === 0
div.recent-post-item.google-ads-warp
ins.adsbygoogle(style="display:block; text-align:center;", data-ad-layout="in-article", data-ad-format="fluid", data-ad-client=theme.google_adsense.client, data-ad-slot=theme.google_adsense.slot)
script.
Expand Down
4 changes: 3 additions & 1 deletion scripts/event/merge_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ hexo.extend.filter.register('before_generate', () => {
runtimeenable: true,
runtime: "2023-04-20 00:00:00",
},
}, index_post_list: {
direction: 'column', content: false, length: 500, cover: 'both'
}, page: {
error: true, tags: true, categories: true, default: {
cover: ['/img/default.png'],
Expand Down Expand Up @@ -169,7 +171,7 @@ hexo.extend.filter.register('before_generate', () => {
css_prefix: false,
font: {
'font-size': '16px',
'code-font-size': '1rem',
'code-font-size': '16px',
'font-family': '"PingFang SC","Hiragino Sans GB","Microsoft YaHei"',
'code-font-family': '"monospace", "monospace"',
},
Expand Down
4 changes: 2 additions & 2 deletions scripts/filter/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ hexo.extend.filter.register('after_post_render', function (data) {
const {config} = hexo.theme;
if (data.layout === 'post') {
let {copyright, locate, cover} = hexo.theme.config.post.default
cover = cover !== null ? cover : ['/img/default']
cover = cover !== null ? cover : ['/img/default.png']
data.locate = data.locate || locate
data.cc = data.cc || copyright
data.cover = data.cover || cover[getRandomInt(0, cover?.length)]
Expand All @@ -14,7 +14,7 @@ hexo.extend.filter.register('after_post_render', function (data) {
}
if (data.layout === 'page') {
let {cover} = hexo.theme.config.page.default
cover = cover !== null ? cover : ['/img/default']
cover = cover !== null ? cover : ['/img/default.png']
data.cover = data.cover || cover[getRandomInt(0, cover?.length)]
data.excerpt = data.title
data.toc = !!(config.aside.toc.page && data.toc !== false && data.aside);
Expand Down
Loading

0 comments on commit 8a710e8

Please sign in to comment.