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-stylusnpm install hexo-component-infernonpm install hexo-renderer-infernonpm install infernonpm install inferno-create-elementnpm install --save bulma-stylus@0.8.0
发布测试
切换到blog目录下
配置文件添加
# Deploymentdeploy:type: gitrepo: git@github.com:xxxx/github.blog.gitbranch: master
接着执行以下脚本
# 清理hexo clean# 生成文件hexo g# 部署hexo d
观察到出现以下界面表示发布成功
版本回退
有点突兀,但是最新版本3.x有两点我不好处理,就退回了2.8.2,第一个就是新版本不支持Valine评论,第二点就是网络上很多配置尤其是文章栏目的调整,只有旧版本,我对前端也不是很了解,所以干脆退回了之前版本,省心
主题优化
基本配置
主要修改默认信息,主要包括
- 作者信息
- 菜单栏的值替换
- 头像的替换
- 社交链接填写
- Valine评论功能
- 捐赠信息
具体可以参照以下
# Version of the Icarus theme that is currently usedversion: 2.8.1# Path or URL to the website's iconfavicon: /images/favicon.svg# Additional HTML meta tags in an array.meta:# Path or URL to RSS atom.xmlrss:# Path or URL to the website's logo to be shown on the left of the navigation bar or footerlogo: /images/logo.svg# Open Graph metadata# https://hexo.io/docs/helpers.html#open-graphopen_graph:# Facebook App IDfb_app_id:# Facebook Admin IDfb_admins:# Twitter IDtwitter_id:# Twitter sitetwitter_site:# Google+ profile linkgoogle_plus:# Navigation bar link settingsnavbar:# Navigation bar menu linksmenu:# 首页首页: /# 归档归档: /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 settingsfooter:# Links to be shown on the right of the footer sectionlinks:Creative Commons:icon: fab fa-creative-commonsurl: 'https://creativecommons.org/'Attribution 4.0 International:icon: fab fa-creative-commons-byurl: 'https://creativecommons.org/licenses/by/4.0/'# Download on GitHub:# icon: fab fa-github# url: 'https://github.com/ppoffice/hexo-theme-icarus'# Article display settingsarticle:# Code highlight settingshighlight:# Code highlight themes# https://github.com/highlightjs/highlight.js/tree/master/src/stylestheme: atom-one-light# Show code copying buttonclipboard: true# Default folding status of the code blocks. Can be "", "folded", "unfolded"fold: unfolded# Whether to show article thumbnail imagesthumbnail: true# Whether to show estimate article reading timereadtime: true# Search plugin settings# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Searchsearch:# Name of the search plugintype: insight# Comment plugin settings# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Commentcomment:type: valineenable: trueshortname: 孙博文app_id: 你的app_idapp_key: 你的app_keynotify: true # mail notifier , https://github.com/xCss/Valine/wikiverify: true # Verification codeplaceholder: 说点什么吧... # comment box placeholderavatar: retro # gravatar styleguest_info: nick,mail,link # custom comment headerpageSize: 10 # pagination size# Donation entries# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Donationdonate:-type: alipay# Alipay qrcode image URLqrcode: 'images/alipay.jpg'-type: wechat# Wechat qrcode image URLqrcode: 'images/wechat.png'# Share plugin settings# https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Shareshare:# Share plugin nametype: sharejs# Sidebar settings.# Please be noted that a sidebar is only visible when it has at least one widgetsidebar:# left sidebar settingsleft:# 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 settingsright:# 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 nametype: profile# Where should the widget be placed, left or rightposition: left# Author name to be shown in the profile widgetauthor: 孙博文# Author titleauthor_title: 我胖虎好TM想打人# Author's current locationlocation: 中国 安徽# URL or path to the avatar imageavatar: images/avatar.jpg# 头像显示为圆还是方avatar_rounded: false# Email address for the Gravatargravatar:# URL or path for the follow buttonfollow_link: 'https://github.com/bwensun'# Links to be shown on the bottom of the profile widgetsocial_links:Github:icon: fab fa-githuburl: 'https://github.com/bwensun'网易云:icon: fa fa-musicurl: 'https://music.163.com/#/user/home?id=73195716'豆瓣:icon: fa fa-filmurl: 'https://www.douban.com/people/176248529/'RSS:icon: fas fa-rssurl: /-# Widget nametype: toc# Where should the widget be placed, left or rightposition: left-# Widget nametype: links# Where should the widget be placed, left or rightposition: left# Links to be shown in the links widgetlinks:daiwenzh5: 'https://daiwenzh5.github.io'zoombar: 'http://139.224.224.177/'-# Widget nametype: category# Where should the widget be placed, left or rightposition: left-# Widget nametype: tagcloud# Where should the widget be placed, left or rightposition: left-# Widget nametype: recent_posts# Where should the widget be placed, left or rightposition: 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 settingsplugins:# Enable page animationsanimejs: 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 devicesback-to-top: true# Google Analytics plugin settings# https://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Google-Analyticsgoogle-analytics:# Google Analytics tracking idtracking_id:# Baidu Analytics plugin settings# https://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Baidu-Analyticsbaidu-analytics:# Baidu Analytics tracking idtracking_id:# Hotjar user feedback plugin# https://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Hotjarhotjar:# Hotjar site idsite_id:# Show a loading progress bar at top of the pageprogressbar: true# BuSuanZi site/page view counter# https://busuanzi.ibruce.infobusuanzi: 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 providercdn: jsdelivr# Name or URL of the webfont CDN providerfontcdn: google# Name or URL of the webfont Icon CDN providericoncdn: 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 .containermax-width: screen-widescreen - 2 * gapwidth: screen-widescreen - 2 * gap@media screen and (min-width: screen-fullhd).is-2-column .containermax-width: screen-fullhd - 2 * gapwidth: screen-fullhd - 2 * gap.is-1-column .containermax-width: screen-desktop - 2 * gapwidth: 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. 执行命令拉取语雀文档```shellyuque-hexo sync
可以观看到日志上的拉取内容,在post文件夹中也会多出来yuque文件夹,里面是语雀文档申城的md文件
设置语雀模板来简化标签分类以及more操作
为了文档的美观和使用方便,都会添加上文章的分类和标签,并且会将文章前言部分之后内容做隐藏,一般完成的文章会像这样
可以在语雀中自定义一个模板,将这些默认项都添加上去
# 博客标题tags: [tag1,tag2]<br />categories: [分类]---<a name="iOsWy"></a>## 前言<br /><br /><br /><-- more -->
总结
博客弄起来是真的很折腾,我之后也不会再改这个样式了,会将注意力转到内容上来,另外我发现很多网上的东西写的没头没尾,浪费我很多的时间,写的人总是站在自己的角度考虑问题,一些自己走过的坑会下意识的忽略掉,这可能就是为什么网络上教程都是成功的,按着来都是错误的原因吧,写东西毕竟是给人看的,我如果看不明白,那就是有问题的。
