tags: [转载,gitlab]
categories: [CICD]
前言
折腾还是折腾,orz, 早晚得改,受不了了每天就是改博客样式,文章没写几篇!没错,我就是在喷我自己!
现在将之前NEXT主题替换为icarus
,本来准备使用inside主题的,奈何生态实在不是很好,一想到之后还要修改,还是果断换了
更换主题
主题下载
下载地址:https://github.com/ppoffice/hexo-theme-icarus/releases
也能使用git clone
git clone https://github.com/ppoffice/hexo-theme-icarus.git themes/icarus
建议还是使用下载,快啊,完毕后,放到主题文件夹中
安装依赖
icarus
的依赖非常多,需要提前安装好
npm install bulma-stylus
npm install hexo-component-inferno
npm install hexo-renderer-inferno
npm install inferno
npm install inferno-create-element
npm install --save bulma-stylus@0.8.0
发布测试
切换到blog目录下
配置文件添加
# Deployment
deploy:
type: git
repo: git@github.com:xxxx/github.blog.git
branch: master
接着执行以下脚本
# 清理
hexo clean
# 生成文件
hexo g
# 部署
hexo d
观察到出现以下界面表示发布成功
版本回退
有点突兀,但是最新版本3.x有两点我不好处理,就退回了2.8.2
,第一个就是新版本不支持Valine评论,第二点就是网络上很多配置尤其是文章栏目的调整,只有旧版本,我对前端也不是很了解,所以干脆退回了之前版本,省心
主题优化
基本配置
主要修改默认信息,主要包括
- 作者信息
- 菜单栏的值替换
- 头像的替换
- 社交链接填写
- Valine评论功能
- 捐赠信息
具体可以参照以下
# Version of the Icarus theme that is currently used
version: 2.8.1
# Path or URL to the website's icon
favicon: /images/favicon.svg
# Additional HTML meta tags in an array.
meta:
# Path or URL to RSS atom.xml
rss:
# Path or URL to the website's logo to be shown on the left of the navigation bar or footer
logo: /images/logo.svg
# Open Graph metadata
# https://hexo.io/docs/helpers.html#open-graph
open_graph:
# Facebook App ID
fb_app_id:
# Facebook Admin ID
fb_admins:
# Twitter ID
twitter_id:
# Twitter site
twitter_site:
# Google+ profile link
google_plus:
# Navigation bar link settings
navbar:
# Navigation bar menu links
menu:
# 首页
首页: /
# 归档
归档: /archives
# 分类
分类: /categories
# 标签
标签: /tags
#友链
#友链: /friends/
# 关于
#关于: /about/
# Navigation bar links to be shown on the right
# links:
# Download on GitHub:
# icon: fab fa-github
# url: 'https://github.com/ppoffice/hexo-theme-icarus'
# Footer section link settings
footer:
# Links to be shown on the right of the footer section
links:
Creative Commons:
icon: fab fa-creative-commons
url: 'https://creativecommons.org/'
Attribution 4.0 International:
icon: fab fa-creative-commons-by
url: 'https://creativecommons.org/licenses/by/4.0/'
# Download on GitHub:
# icon: fab fa-github
# url: 'https://github.com/ppoffice/hexo-theme-icarus'
# Article display settings
article:
# Code highlight settings
highlight:
# Code highlight themes
# https://github.com/highlightjs/highlight.js/tree/master/src/styles
theme: atom-one-light
# Show code copying button
clipboard: true
# Default folding status of the code blocks. Can be "", "folded", "unfolded"
fold: unfolded
# Whether to show article thumbnail images
thumbnail: true
# Whether to show estimate article reading time
readtime: true
# Search plugin settings
# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Search
search:
# Name of the search plugin
type: insight
# Comment plugin settings
# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Comment
comment:
type: valine
enable: true
shortname: 孙博文
app_id: 你的app_id
app_key: 你的app_key
notify: true # mail notifier , https://github.com/xCss/Valine/wiki
verify: true # Verification code
placeholder: 说点什么吧... # comment box placeholder
avatar: retro # gravatar style
guest_info: nick,mail,link # custom comment header
pageSize: 10 # pagination size
# Donation entries
# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Donation
donate:
-
type: alipay
# Alipay qrcode image URL
qrcode: 'images/alipay.jpg'
-
type: wechat
# Wechat qrcode image URL
qrcode: 'images/wechat.png'
# Share plugin settings
# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Share
share:
# Share plugin name
type: sharejs
# Sidebar settings.
# Please be noted that a sidebar is only visible when it has at least one widget
sidebar:
# left sidebar settings
left:
# Whether the left sidebar is sticky when page scrolls
# https://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/make-a-sidebar-sticky-when-page-scrolls/
sticky: false
# right sidebar settings
right:
# Whether the right sidebar is sticky when page scrolls
# https://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/make-a-sidebar-sticky-when-page-scrolls/
sticky: false
# Sidebar widget settings
# https://ppoffice.github.io/hexo-theme-icarus/categories/Widgets/
widgets:
-
# Widget name
type: profile
# Where should the widget be placed, left or right
position: left
# Author name to be shown in the profile widget
author: 孙博文
# Author title
author_title: 我胖虎好TM想打人
# Author's current location
location: 中国 安徽
# URL or path to the avatar image
avatar: images/avatar.jpg
# 头像显示为圆还是方
avatar_rounded: false
# Email address for the Gravatar
gravatar:
# URL or path for the follow button
follow_link: 'https://github.com/bwensun'
# Links to be shown on the bottom of the profile widget
social_links:
Github:
icon: fab fa-github
url: 'https://github.com/bwensun'
网易云:
icon: fa fa-music
url: 'https://music.163.com/#/user/home?id=73195716'
豆瓣:
icon: fa fa-film
url: 'https://www.douban.com/people/176248529/'
RSS:
icon: fas fa-rss
url: /
-
# Widget name
type: toc
# Where should the widget be placed, left or right
position: left
-
# Widget name
type: links
# Where should the widget be placed, left or right
position: left
# Links to be shown in the links widget
links:
daiwenzh5: 'https://daiwenzh5.github.io'
zoombar: 'http://139.224.224.177/'
-
# Widget name
type: category
# Where should the widget be placed, left or right
position: left
-
# Widget name
type: tagcloud
# Where should the widget be placed, left or right
position: left
-
# Widget name
type: recent_posts
# Where should the widget be placed, left or right
position: left
# -
# # Widget name
# type: archive
# # Where should the widget be placed, left or right
# position: right
# -
# # Widget name
# type: tag
# # Where should the widget be placed, left or right
# position: right
# Other plugin settings
plugins:
# Enable page animations
animejs: true
# Enable the lightGallery and Justified Gallery plugins
# https://ppoffice.github.io/hexo-theme-icarus/Plugins/General/gallery-plugin/
gallery: true
# Enable the Outdated Browser plugin
# http://outdatedbrowser.com/
outdated-browser: true
# Enable the MathJax plugin
# https://ppoffice.github.io/hexo-theme-icarus/Plugins/General/mathjax-plugin/
mathjax: true
# Show the back to top button on mobile devices
back-to-top: true
# Google Analytics plugin settings
# https://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Google-Analytics
google-analytics:
# Google Analytics tracking id
tracking_id:
# Baidu Analytics plugin settings
# https://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Baidu-Analytics
baidu-analytics:
# Baidu Analytics tracking id
tracking_id:
# Hotjar user feedback plugin
# https://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Hotjar
hotjar:
# Hotjar site id
site_id:
# Show a loading progress bar at top of the page
progressbar: true
# BuSuanZi site/page view counter
# https://busuanzi.ibruce.info
busuanzi: false
# 51计数
tj51la: true
# CDN provider settings
# https://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/speed-up-your-site-with-custom-cdn/
providers:
# Name or URL of the JavaScript and/or stylesheet CDN provider
cdn: jsdelivr
# Name or URL of the webfont CDN provider
fontcdn: google
# Name or URL of the webfont Icon CDN provider
iconcdn: fontawesome
其他功能
网站三栏变两栏
这个项目被提及最多的就是这个文章内容的布局,它的内容宽度过少,导致看起来很不舒服,作者也提到了关于这个问题的解决方案,有关这个问题的讨论可见https://github.com/ppoffice/hexo-theme-icarus/issues/434
,这里只说下具体措施
修改
source/css/style.styl
文件中的media样式@media screen and (min-width: screen-widescreen)
.is-1-column .container
.is-2-column .container
max-width: screen-widescreen - 2 * gap
width: screen-widescreen - 2 * gap
@media screen and (min-width: screen-fullhd)
.is-2-column .container
max-width: screen-fullhd - 2 * gap
width: screen-fullhd - 2 * gap
.is-1-column .container
max-width: screen-desktop - 2 * gap
width: screen-desktop - 2 * gap
修改一下
layout/layout.ejs
和layout/common/widget.ejs
的文件内容<% function main_column_class() {
switch (column_count()) {
case 1:
return 'is-12';
case 2:
return 'is-8-tablet is-9-desktop is-9-widescreen';
case 3:
return 'is-8-tablet is-8-desktop is-6-widescreen'
}
return '';
} %>
<% function side_column_class() {
switch (column_count()) {
case 2:
return 'is-4-tablet is-3-desktop is-3-widescreen';
case 3:
return 'is-4-tablet is-4-desktop is-3-widescreen';
}
return '';
} %>
Hexo拉取语雀文档到博客
语雀的博客我一直在写,它对于markdown的语法支持,以及干净的界面让你可以关注于内容,而不是花里胡哨的界面,界面如下
所以以后也会一直把首要更新放到语雀上面来,后拉取语雀文档刷新博客,关于这一点,语雀已经做了
官方的文档:
我想了下,还是写上具体的步骤NMP安装插件
npm i -g yuque-hexo
获取自己的Token
头像 -> 账户设置 -> Token
- 在blog目录下package.json中添加红线标注内容 ```json { “name”: “hexo-site”, “version”: “0.0.0”, “private”: true, “scripts”: { “build”: “hexo generate”, “clean”: “hexo clean”, “deploy”: “hexo deploy”, “server”: “hexo server” }, “hexo”: { “version”: “4.2.1” }, ————————————add start———————————————————————————— “yuqueConfig”: { “postPath”: “source/_posts/yuque”, “token”: “你的TOKEN”, “cachePath”: “yuque.json”, “mdNameFormat”: “title”, “adapter”: “hexo”, “concurrency”: 5, “baseUrl”: “https://www.yuque.com/api/v2“, “login”: “guyuefangyuan”, “repo”: “blog”, “onlyPublished”: false, “onlyPublic”: false }, ————————————-add end————————————————————————————- “dependencies”: { “bulma-stylus”: “^0.8.0”, “cheerio”: “^1.0.0-rc.3”, “hexo”: “^4.2.1”, “hexo-component-inferno”: “^0.2.7”, “hexo-deployer-git”: “^2.1.0”, “hexo-generator-archive”: “^1.0.0”, “hexo-generator-category”: “^1.0.0”, “hexo-generator-index”: “^1.0.0”, “hexo-generator-tag”: “^1.0.0”, “hexo-permalink-pinyin”: “^1.1.0”, “hexo-renderer-ejs”: “^1.0.0”, “hexo-renderer-inferno”: “^0.1.3”, “hexo-renderer-marked”: “^2.0.0”, “hexo-renderer-stylus”: “^1.1.0”, “hexo-server”: “^1.0.0”, “inferno”: “^7.4.2”, “inferno-create-element”: “^7.4.2”, “social-share.js”: “^1.0.16” } }
4. 在blog目录下新建yuque.json,这个文件不用写,是用来做语雀相关的缓存的,但必须得有
4. 执行命令拉取语雀文档
```shell
yuque-hexo sync
可以观看到日志上的拉取内容,在post文件夹中也会多出来yuque文件夹,里面是语雀文档申城的md文件
设置语雀模板来简化标签分类以及more操作
为了文档的美观和使用方便,都会添加上文章的分类和标签,并且会将文章前言部分之后内容做隐藏,一般完成的文章会像这样
可以在语雀中自定义一个模板,将这些默认项都添加上去
# 博客标题
tags: [tag1,tag2]<br />categories: [分类]
---
<a name="iOsWy"></a>
## 前言
<br />
<br />
<br /><-- more -->
总结
博客弄起来是真的很折腾,我之后也不会再改这个样式了,会将注意力转到内容上来,另外我发现很多网上的东西写的没头没尾,浪费我很多的时间,写的人总是站在自己的角度考虑问题,一些自己走过的坑会下意识的忽略掉,这可能就是为什么网络上教程都是成功的,按着来都是错误的原因吧,写东西毕竟是给人看的,我如果看不明白,那就是有问题的。