众所周知,本站(KAYGB)采用的是hexo+github+coding+又拍云CDN+icarus主题的组合,华丽美观,好看高大上,哈哈哈

接下来开始我的魔改吧。

侧边栏修改

本来是三侧边栏的样式,好看是好看,但是我总觉得内容有一点挤,所以我就把所有的侧边栏放置在了左边。

打开左侧边栏固定

打开themes -> icarus -> _config.yml,找到sidebar,将左边栏固定

# Sidebar settings.
# Please be noted that a sidebar is only visible when it has at least one widget
sidebar:# 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: true     #更改这里为true# 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

更改目录挂件显示的位置

目的是在阅读文章的同时配合上方的设定将目录固定在个人信息卡片的上方

复制toc的内容,包括符号【 - 】

 -       #这个也需要复制下来# Widget nametype: toc# Where should the widget be placed, left or rightposition: left

粘贴到profile之前,【widgets:】之后,像这样:

widgets:-# Widget nametype: toc# Where should the widget be placed, left or rightposition: left-# Widget nametype: profile# Where should the widget be placed, left or rightposition: left# Author name to be shown in the profile widgetauthor: KAYGB# Title of the author to be shown in the profile widgetauthor_title: Web Lover# Author's current location to be shown in the profile widgetlocation: WuHan,China

修改为双栏模式

找到widgets,将所有的position改为left

widgets:-# Widget nametype: toc# Where should the widget be placed, left or rightposition: left          #修改为left-# Widget nametype: profile# Where should the widget be placed, left or rightposition: left         #修改为left# Author name to be shown in the profile widgetauthor: KAYGB# Title of the author to be shown in the profile widgetauthor_title: Web Lover# Author's current location to be shown in the profile widgetlocation: WuHan,China# Path or URL to the avatar to be shown in the profile widgetavatar: //file.kaygb.top/static_image/kaygb-logo/tx.png# Email address for the Gravatar to be shown in the profile widgetgravatar: # Whether to show avatar image rounded or squareavatar_rounded: false# Path or URL for the follow buttonfollow_link: 'https://github.com/kaygb/'# Links to be shown on the bottom of the profile widgetsocial_links:网站监控:icon: fa fa-bullseyeurl: 'https://status.kaygb.top'旧站:icon: fab fa-dribbbleurl: 'https://kaygb.kaygb.top'咔叽云盘:icon: fa fa-cloudurl: 'https://cloud.kaygb.top/'咔叽图床:icon: fa fa-picture-ourl: 'https://image.kaygb.top/'Github:icon: fab fa-githuburl: 'https://github.com/kaygb/'# Facebook:#     icon: fab fa-facebook#     url: '#'# Twitter:#     icon: fab fa-twitter#     url: '#'# Dribbble:#     icon: fab fa-dribbble#     url: '#'RSS:icon: fas fa-rssurl: /atom.xml

取消不需要的侧边栏widgets(侧边栏挂件)

这里其实很简简单,可能有些同学直接注释的时候发现在部署的时候可能会出错,其实是因为注释需要将开头的符号【 - 】 也一起注释掉

 # -         #这个不注释的话可能会出现错误#     # Widget name#     type: tagcloud#     # 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: left# -#     # Widget name#     type: tag#     # Where should the widget be placed, left or right#     position: left

去除个人头像,并添加渐变滚动字体

打开themes -> icarus -> layout -> widget -> profile.ejs

参考下方代码打上注释和添加代码

<% function avatar() {const avatar = get_config_from_obj(widget, 'avatar');const gravatar_email = get_config_from_obj(widget, 'gravatar');if (gravatar_email !== null) {return gravatar(gravatar_email, 128);}if (avatar !== null) {return url_for(avatar)}return url_for('images/avatar.png');
} %>
<div class="card widget"><div class="card-content"><nav class="level"><div class="level-item has-text-centered" style="flex-shrink: 1"><div><!--
<!--这里是头像 --><% const is_rounded = get_config_from_obj(widget, 'avatar_rounded', false); %><figure class="image is-128x128 has-mb-6"><img class="<%= is_rounded ? 'is-rounded' : '' %>" src="<%= avatar() %>" alt="<%= get_config_from_obj(widget, 'author') %>"></figure><% if (get_config_from_obj(widget, 'author')) { %><p class="is-size-4 is-block"><%= get_config_from_obj(widget, 'author') %></p><% } %><% if (get_config_from_obj(widget, 'author_title')) { %><p class="is-size-6 is-block"><%= get_config_from_obj(widget, 'author_title') %></p><% } %><% if (get_config_from_obj(widget, 'location')) { %><p class="is-size-6 is-flex is-flex-center has-text-grey"><i class="fas fa-map-marker-alt has-mr-7"></i><span><%= get_config_from_obj(widget, 'location') %></span></p><% } %>-->  <!--这里是头像的结尾部分 --><!-- 渐变滚动字体 --><div id="binft"></div><script>var binft = function (r) {function t() {return b[Math.floor(Math.random() * b.length)]}  function e() {return String.fromCharCode(94 * Math.random() + 33)}function n(r) {for (var n = document.createDocumentFragment(), i = 0; r > i; i++) {var l = document.createElement("span");l.textContent = e(), l.style.color = t(), n.appendChild(l)}return n}function i() {var t = o[c.skillI];c.step ? c.step-- : (c.step = g, c.prefixP < l.length ? (c.prefixP >= 0 && (c.text += l[c.prefixP]), c.prefixP++) : "forward" === c.direction ? c.skillP < t.length ? (c.text += t[c.skillP], c.skillP++) : c.delay ? c.delay-- : (c.direction = "backward", c.delay = a) : c.skillP > 0 ? (c.text = c.text.slice(0, -1), c.skillP--) : (c.skillI = (c.skillI + 1) % o.length, c.direction = "forward")), r.textContent = c.text, r.appendChild(n(c.prefixP < l.length ? Math.min(s, s + c.prefixP) : Math.min(s, t.length - c.skillP))), setTimeout(i, d)}var l = "",o = ["Hello,KAYGB!","每天学一点,菜鸟变大神。", "不要轻易抱怨","抱怨只能说明自己能力不足。", "自律是最好的老师。","今天你开心了吗?","你好呀,陌生人!","人非圣贤,孰能无过。"].map(function (r) {return r + ""}),a = 2,g = 1,s = 5,d = 75,b = ["rgb(110,64,170)", "rgb(150,61,179)", "rgb(191,60,175)", "rgb(228,65,157)", "rgb(254,75,131)", "rgb(255,94,99)", "rgb(255,120,71)", "rgb(251,150,51)", "rgb(226,183,47)", "rgb(198,214,60)", "rgb(175,240,91)", "rgb(127,246,88)", "rgb(82,246,103)", "rgb(48,239,130)", "rgb(29,223,163)", "rgb(26,199,194)", "rgb(35,171,216)", "rgb(54,140,225)", "rgb(76,110,219)", "rgb(96,84,200)"],c = {text: "",prefixP: -s,skillI: 0,skillP: 0,direction: "forward",delay: a,step: g};i()};binft(document.getElementById('binft'));</script>
<!-- 渐变滚动字体End --></div></div></nav><nav class="level is-mobile"><div class="level-item has-text-centered is-marginless"><div><p class="heading"><%= _p('common.post', post_count()) %></p><p class="title has-text-weight-normal"><%= post_count() %></p></div></div><div class="level-item has-text-centered is-marginless"><div><p class="heading"><%= _p('common.category', category_count()) %></p><p class="title has-text-weight-normal"><%= category_count() %></p></div></div><div class="level-item has-text-centered is-marginless"><div><p class="heading"><%= _p('common.tag', tag_count()) %></p><p class="title has-text-weight-normal"><%= tag_count() %></p></div></div></nav><% if (widget.follow_link) { %><!-- 这里是关注按钮<div class="level"><a class="level-item button is-link is-rounded" href="<%= url_for(widget.follow_link) %>" target="_blank"><%= __('widget.follow') %></a></div>--><% } %><% const socialLinks = get_config_from_obj(widget, 'social_links'); %><% if (socialLinks !== null) { %><div class="level is-mobile"><% for (let name in socialLinks) {let link = socialLinks[name]; %><a class="level-item button is-white is-marginless" target="_blank"title="<%= name %>" href="<%= url_for(typeof(link) === 'string' ? link : link.url) %>"><% if (typeof(link) === 'string') { %><%= name %><% } else { %><i class="<%= link.icon %>"></i><% } %></a><% } %></div><% } %></div>
</div>

背景以及鼠标指针修改

修改背景为漂浮的彩带

打开themes -> icarus -> layout -> layout.ejs

在结尾的【/body】标签之前添加以下代码,两个样式选择一个自己喜欢的就可以了。

<!-- 样式一(鼠标点击更换样式) -->
<script src="//g.joyinshare.com/hc/ribbon.min.js" type="text/javascript"></script>
<!-- 样式二(飘动的彩带) -->
<script src="//g.joyinshare.com/hc/piao.js" type="text/javascript"></script>

这里改动之后可能会出现背景不生效的问题,以下是解决办法

打开themes -> icarus -> source-> css -> style.styl

找到body,将background属性注释掉

body//background-color: #096

修改鼠标指针样式

打开themes -> icarus -> source-> css -> style.styl

找到body,在后面添加

cursor: url(//cdn.jsdelivr.net/gh/TRHX/CDN-for-itrhx.com@2.1.6/images/mouse.cur),auto;

由于背景是是白色的,看起来没有层次感,所以我们加一点灰度

添加background-color

background-color: rgba(10, 10, 10, 0.02);

修改之后应该是这个样子的:

body//background-color: #096background-color: rgba(10, 10, 10, 0.02);cursor: url(//cdn.jsdelivr.net/gh/TRHX/CDN-for-itrhx.com@2.1.6/images/mouse.cur),auto;

添加404公益页面

icarus主题默认是不带404页面的(可能只有我自己《 - _ - 》),如果访问不存在的页面会直接出现can’t get xxx,所以我添加了腾讯的404公益页面,也算是尽了一份力吧!

开始折腾

在source文件夹下新建404.html文件

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><title>404 - Hello KAYGB</title><link rel="icon" href="你的icon链接"></head><body><script type="text/javascript"            src="//qzonestyle.gtimg.cn/qzone/hybrid/app/404/search_children.js"  homePageUrl="你的博客链接"homePageName="回到我的主页"charset="utf-8"></script></body>
</html>

不要以为这就搞定了,如果只是单纯的deploy,你就会发现hexo吧这个文件也进行了渲染,所以我们要让hexo不渲染这个html文件。

找到博客根目录下的_config.yml,打开并修改

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:        #如果也有别的页面不需要渲染,直接在下方添加就可以了- 404.html     #将404.html加进去,【-】之后要有空格隔开

然后

hexo g -d

访问一下http://yoursite/404

添加简单的SEO设置

安装hexo nofollow插件

参考我的文章:

Hexo自动为站内链接加上nofollow插件

安装sitemap插件

控制台输入

npm install hexo-generator-sitemap --save #sitemap.xml适合提交给谷歌搜素引擎
npm install hexo-generator-baidu-sitemap --save #baidusitemap.xml适合提交百度搜索引擎

然后在站点配置文件_config.yml中添加以下代码

# 自动生成sitemap
sitemap:
path: sitemap.xml
baidusitemap:
path: baidusitemap.xml

最后修改站点配置文件_config.yml中的域名

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: http://你的网站

修改文章链接显示方式

网上看到说蜘蛛只爬取三层目录,再往下就不行了,所以我将链接修改成了http://site/posts/2019-11-22-english_url.html

打开博客根目录下的_config.yml

找到URL的配置项并修改

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://kaygb.top
root: /
# permalink: :year/:month-:day-:title.html
permalink: posts/:year:month:day-:english_url.html      #这里是我修改过的
# permalink: posts/:abbrlink/           #这里请忽略
#   abbrlink:
#   alg: crc32
#   rep: hex
permalink_defaults:lang: en
pretty_urls:trailing_index: true # Set to false to remove trailing index.html from permalinks

以后只要在写文章的时候改一下english_url就可以了

关于那个abbrlink,我设置的时候出错了,也就没有管它了,大家可以尝试一下

如果大家觉得每次需要去手写english_url很烦的话,可以直接在模板中添加属性

找到博客根目录下的sacffolds文件夹下的post.md,添加属性就可以了

---
title: {{ title }}
english_url:
date: {{ date }}
tags:
toc: true
comments: true
categories:
thumbnail:
---

相关资料链接以及文章中一些资料的部分来源:

https://blog.csdn.net/Fzidx/article/details/99185663

https://blog.csdn.net/yanzi1225627/article/details/77761488

https://blog.csdn.net/lzy98/article/details/81140704

https://blog.csdn.net/qq_36759224/article/details/85420403#font_colorFF0000___font_289

https://blog.csdn.net/marvine/article/details/89816846

总结

目前修改的内容大概就这么多了吧,icarus这个主题虽然不如next的名气大,但是我认为她是一个非常优秀的主题,当然也得益于作者良好的代码习惯,我们才可以更好的自定义,贴上icarus的主题链接:https://github.com/ppoffice/hexo-theme-icarus,大家可以尝试一下,有什么需要我帮助的也可以直接在下方评论哦!

原文链接:

hexo之icarus主题的美化修改以及简单的SEO配置

hexo之icarus主题的美化修改以及简单的SEO配置相关推荐

  1. Hexo中Next主题个性化美化的解决方案

    目录 1.Next主题的启用 2.更改Next主题为中文 3.添加标签页和分类页 4.正确打开标签页和分类页 5.主题样式的更改 6.更改图像 7.更改标题.作者和链接 8.启动侧边栏社交链接 9.启 ...

  2. 博客园主题页面美化修改

    [美化来源] 资料来源:白色泪光 现用皮肤来源:bndong [美化内容] 基本模板 darkgreen 页面定制CSS #home { margin: 0 auto; width: 80%;/*原始 ...

  3. 在hexo的butterfly主题中开启看板娘配置

    在hexo的butterfly主题中开启看板娘 官网地址配置:https://www.npmjs.com/package/hexo-helper-live2d 1.安装依赖 卸载命令:npm unin ...

  4. Hexo - Next - Mist 风格主题的美化(二)

    注:两个 _config.yml,一个是 站点配置文件,一个是 主题配置文件. 一.基本美化 0. 更换主题风格 要更改的文件:主题配置文件 如果出现,本地的风格改变了,github 上的风格没改变 ...

  5. Hexo+icarus主题配置

    下载icarus主题 飞鱼的博客 进入博客主目录,点击鼠标右键Git Bash Here,进入命令行界面 输入: git clone https://github.com/ppoffice/hexo- ...

  6. Hexo博客icarus主题定制篇

    本文基于Hexo和Icarus4.1.1版本,对博客主题定制过程做一个记录.在icarus4.0版本中,主题npm方式安装的话,本地将不会有主题相关的文件,需要定制的话,可以通过修改node_modu ...

  7. hexo(butterfly)蝴蝶主题+个性美化

    文章目录 一.前言 二.蝴蝶主题 1.快速入门 2.valine评论移植 3.文章移植 三.个性美化 1.boyui对话框式简介页面 2.说说动态页面 3.友链页面优化 一.前言 这两天心血来潮给自己 ...

  8. 用html5看板娘,HEXO+icarus主题 给博客添加看板娘(Live2D)

    最近在很多博客左下角或者右下角有看到小人(看板娘),折腾了一番搜到的都没有达到预期的效果,并且大多数教程都是基于Next来做的,本人使用的主题是Icarus,跟Next有细微的区别.后面找到了大神的作 ...

  9. 【教程】Hexo+Coding搭建自己的博客网站系列5-Next6.7版本主题深度美化

    在我进行主题优化的时候,参考了网上很多文章,但是随着Next版本的变迁,越来越多个性化设置已经被集成到Next中.所以我写了这篇关于Next6.7版本主题优化的方案.有时间和精力的话,这篇文章也会随着 ...

  10. Hexo-Matery主题细致美化

    文章目录 Hexo-Matery主题美化 下载安装Matery主题 切换主题 新建页面 1.标签页 2.分类页 3.关于页面 4.留言板 5.友情链接 6.添加 404 页面 7.添加自定义页面 配置 ...

最新文章

  1. 为什么DOM操作很慢
  2. 计算机专业必须读的经典书籍
  3. [剑指offer][JAVA]面试题第[04]题[二维数中的查找][数组]
  4. UVA 10129 Play on Words
  5. C语言动态存储分配函数
  6. OS X 10.10.2 也不顶用? Wi-Fi 问题仍存在
  7. 求小球落地5次后所经历的路程和第5次反弹的高度
  8. 专业美妆磨皮大师扩展插件支持PS2021版效果
  9. wps 宏 禁用_WPS表格如何解除宏禁用
  10. 嵌入式系统作业12(SD卡读取)
  11. 强大的Git客户端:Tower for Mac
  12. 服务器共享文件打开未响应,win7共享文件夹会话未响应
  13. SpringUtil 工具类
  14. 全志A40i开发板(4核ARM CortexA7)测评合集——存储介质读写测试
  15. 粥佐罗时间管理课学习笔记
  16. JPA映射数据库mysql表名,字段名大小写转化,下划线分割.
  17. Linux脚本的制作命令
  18. 国内用户访问国内服务器,国外用户访问国外服务器
  19. 我们的征途是星辰大海(演讲稿)(作者:黄哲威)
  20. netlink怎么读_跑长途的时候如何不寂寞,车机互联G-Netlink全解说明

热门文章

  1. 1853: [Scoi2010]幸运数字[容斥原理]
  2. 帝国cms 标签php,帝国CMS ecmsinfo万能标签
  3. 前端如何修改网页的标题栏图标和名称
  4. 城市大脑建设典型实践及经验启示
  5. Python Interpreter
  6. 山东省第五届蓝桥杯 ///标题:史丰收速算//c/c++组
  7. h2支持mysql函数,H2数据库用户自定义函数方法及范例
  8. 2011年09月04日
  9. 个人对于IT开发型技能段位的划分,我只是一个小小铂金,你什么段位了!
  10. python判断身份证是否合法的函数_oracle中验证身份证是否合法的函数脚本