本篇博客已首发在个人博客 【快乐码原】 :Hexo主题之livemylife个性化构建你的博客
欢迎各位客官来康康~
tips:部分图片加载异常,可以到我的个人博客浏览完整版。

简介

livemylife是hexo5.x主题之一,比起主流的next、yilia等知名度有一定差距;但本人依然在搭建完next主题后选择使用livemylife重构博客,下面是我的博客【快乐码原】 效果图:

夜间模式

白天模式


下面我先将官方配置文档copy一份,方便查阅,然后在后面加上我的个性化配置以及bug处理。

官方文档

仓库

Github 仓库地址:https://github.com/V-Vincen/hexo-theme-livemylife
Gitee 仓库地址:https://gitee.com/V_Vincen/hexo-theme-livemylife

预览 LiveMyLife 博客 ➾

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xWBQAAKi-1629680054311)(livemylife-desktop.png)]

快速开始

为了方便起见,我发布了整个项目,因此您可以按照下面的说明进行操作,然后就可以轻松自定义您自己的博客!

让我们开始!!!

安装 Node.js 和 Git

#For Mac
brew install node
brew install git

Windows:下载 & 安装 Node.js。-> Node.js

Windows:下载 & 安装 Git。-> Git

安装 Hexo

$ npm install -g hexo-cli

什么是 Hexo?

Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。

设置你的博客

$ hexo init blog

更多的命令 -> Hexo Commands

主题使用

初始化

cd blog
rm -rf scaffolds source themes _config.landscape.yml _config.yml package.json yarn.lock #just keep node_modules
git clone https://github.com/V-Vincen/hexo-theme-livemylife.git
mv hexo-theme-livemylife/* ./
rm -rf hexo-theme-livemylife
npm install

设置主题

修改 theme 属性值,在 _config.yml 配置文件中。

# Extensions
## Themes: https://hexo.io/themes/
## Plugins: https://hexo.io/plugins/
theme: livemylife

启动服务

hexo generate # or hexo g
hexo server   # or hexo s

启动本地服务器。 默认访问地址 http://localhost:4000/

更多命令 -> Hexo Commands

配置

使用您自己的信息修改 _config.yml 配置文件,尤其是以下部分:

网址信息配置

将以下信息替换为您自己的信息。

# Site
title: Live My Life
subtitle: 淡而无味也是一种味道
author: Mr.Vincent
timezone:

语言国际化 (i18n)

若要让您的网站以不同语言呈现,您可使用国际化(internationalization)功能。-> 文档:How to Use Internationalization(i18n)

# Internationalization (i18n) Setting
language: # At present, only en、cn and tw are supported. You can customize the language,refer to `languages/en.yml`.- en- cnlangselect:enable: true # If open, it will automatically generation lang-select button.This button can jump in articles in different languages, but the articles must have the same name.options: # langselect button display optionsen: Englishcn: 简体中文# tw: 正體中文i18n_dir: :lang
permalink: :lang/:title/
new_post_name: :lang/:title.md# hexo-generator-i18n config
## Docs: https://github.com/xcatliu/hexo-generator-index-i18n
index_generator:per_page: 10pagination_dir: pagepath: ''order_by: -datearchive_generator:enabled: falseper_page: 10yearly: truemonthly: truedaily: falseorder_by: -date

English 预览:

Chinese 预览:

CDN 配置

JsDelivr JsDelivr是一种免费,快速,可靠和自动化的CDN,可用于开源。如何使用 Jsdelivr?-> 文档:免费 CDN 提速 Github 静态资源访问

# CDN Setting
# Docs: https://www.jsdelivr.com/?docs=gh
# If Github Pages deploy,you can ues jsdelivr settings
#
jsdelivr:jsdelivr_url: https://cdn.jsdelivr.net/gh/github_username: V-Vincen

注意: Hexo-theme-livemylife 主题中有大量的 css、js 和 images,为了提高访问速度,主题中所有资源文件都使用了 JsDelivr CDN(内容分发)。但仅适用于 Github Pages 部署方式。-> 文档:How to apply JsDelivr CDN in Hexo-theme-livemylife Theme

站点设置

将自定义图片放在 img 目录中。

# Site settings
SEOTitle: JavaDev | 一如Java深似海
email: hexo-theme-livemylife@mail.com
description: "It's an IT blog..."
keyword: "Java,v-vincen,v-vincen,livemylife,IT  blog,Blog"
header-img: img/header_img/newhome_bg.jpg
archives-img: img/header_img/archive_bg2.jpg

网站图标设置

favicon: img/avatar/favicon.jpg

签名设置

将您的签名图片复制到 <root>/img/signature 并修改配置文件 _config.yml

signature: true   # show signature
signature-img: img/signature/<your-signature>

如何制作签名 -> Free Online Signature

波浪设置

# Wave settings
wave: true

案例:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-S2I6o6b1-1629680054320)(wave.png)]

社交网络服务设置

如果您不想显示它,则可以直接将其删除。

# SNS settings
# RSS: true
github_username: V-Vincen
twitter_username: V_Vincen_
instagram_username: V_Vincen_
# facebook_username:  yourAccount
# linkedin_username:  yourAccount
# zhihu_username: yourAccount
weibo_username: WVincen

侧边栏设置

将您的头像复制到 <root>/img/avatar 并修改配置文件 _config.yml

sidebar: true   # whether or not using Sidebar.
sidebar-about-description: "I don't know where I am going ,but I am on my way..."
sidebar-avatar: img/avatar/vincnet.jpg    # use absolute URL, seeing it's used in both `/` and `/about/`
widgets:
- visitor   # busuanzi: https://busuanzi.ibruce.info/
- featured-tags
- short-about
- recent-posts
- friends-blog
- archive
- category# widget behavior
## Archive
archive_type: 'monthly'
show_count: true## Featured Tags
featured-tags: true   # whether or not using Feature-Tags
featured-condition-size: 0    # A tag will be featured if the size of it is more than this## Friends
friends: [{title: "V_Vincen",href: "https://v-vincen.life/"},{title: "Teacher Ye",href: "http://teacherye.com/"}
]

评论系统设置

Hexo-Theme-LiveMyLife 主题暂时支持三种评论方式。我使用 gitalk 为默认评论系统。

Gitalk

Gitalk 是基于 GitHub Issue 和 Preact 的现代化的评论组件。 有关详细的配置方法,请参考 Gitalk 官方文档。

# Gitalk Settings
# Doc: https://github.com/gitalk/gitalk/blob/master/readme-cn.md
gitalk:owner:                          # 'GitHub repo owner'admin:                          # ['GitHub repo owner and collaborators, only these guys can initialize github issues']repo:                           # 'GitHub repo'clientID:                       # 'GitHub Application Client ID'clientSecret:                   # 'GitHub Application Client Secret'perPage: 10                     # Pagination size, with maximum 100.pagerDirection: last            # Comment sorting direction, available values are last and first.createIssueManually: false      # By default, Gitalk will create a corresponding github issue for your every single page automatically when the logined user is belong to the admin users. You can create it manually by setting this option to truelanguage: en                    # Localization language key, en, zh-CN and zh-TW are currently available.maxCommentHeight: 250           # An optional number to limit comments' max height, over which comments will be folded.Default 250.proxy: https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token                         # GitHub oauth request reverse proxy for CORS. For example, the demo url is 'https://cors-anywhere.herokuapp.com/https://github.com/login/oauth/access_token'.You should deploy your own proxy url as in this issue https://github.com/gitalk/gitalk/issues/429.

Gitment

Gitment 是一个基于 GitHub Issues 的评论系统,可以在前端使用它,而无需任何服务器端实现。有关详细的配置方法,请参见 Gitment 官方文档。

## Gitment Settings
## Doc: https://github.com/imsun/gitment
gitment:owner:                          # Your GitHub ID. Required.repo:                           # The repository to store your comments. Make sure you're repo's owner. Required.client_id:                      # GitHub client ID. Required.client_secret:                  # GitHub client secret. Required.desc:                           # An optional description for your page, used in issue's body. Default ''.perPage: 10                     # An optional number to which comments will be paginated. Default 20.maxCommentHeight: 250           # An optional number to limit comments' max height, over which comments will be folded. Default 250.

Disqus

如果你想要使用 Disqus 评论系统,则必须有代理。

# Disqus settings
disqus_username: your-disqus-ID

站点分析设置

如何配置站点分析? -> 文档:Analytics and Sitemap Settings

# Analytics settings
# Google Analytics
ga_track_id: UA-xxxxxx-xx   # Format: UA-xxxxxx-xx# Baidu Analytics
ba_track_id: ba_track_id

站点地图设置

如何配置站点地图? -> 文档:Analytics and Sitemap Settings

# Google sitemap
sitemap:path: sitemap.xml# Baidu sitemap
baidusitemap:path: baidusitemap.xmlbaidu_push: true

置顶图标设置

我使用的置顶图标是键头,你可以在 sourcre/css/images 目录下替换你自己想要的图标。

文章标签

您可以选择是否显示博文标签。

home_posts_tag: true

案例:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-PmYYcCbb-1629680054324)(home_posts_tag-true.png)]

Markdown 渲染器

我使用的 markdown 渲染引擎插件是 hexo-renderer-markdown-it。

# Markdown-it config
## Docs: https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki
markdown:render:html: truexhtmlOut: falsebreaks: truelinkify: truetypographer: truequotes: '“”‘’'

安装 Mathjax(数学公式渲染器)

要安装 Mathjax,请单击 How to Use Mathjax 以获取详细的教程。

Anchorjs(锚点)设置

如果你想要更改文章目录标题前部的锚点 “❡”,则可以到 layout/_partial/anchorjs.ejs 目录下进行更改。如何使用 anchorjs,请参阅 AnchorJS 以获取详细示例。

# Anchorjs Settings
anchorjs: true    # if you want to customize anchor. check out line:26 of `anchorjs.ejs`
async("//cdn.bootcss.com/anchor-js/1.1.1/anchor.min.js",function(){anchors.options = {visible: 'hover',placement: 'left',icon: '❡'// icon: 'ℬ'};anchors.add().remove('.intro-header h1').remove('.subheading').remove('.sidebar-container h5');})

博文置顶

# article top
top: true

Hexo-theme-livemylife 主题添加了文章顶部功能,只要在您的 markdown 笔记中添加属性sticky: number 配置,文章按此数字排序。
案例:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-AWTHigEt-1629680054326)(top.png)]

文章字数统计设置

WordCount 是 Hexo 的文章字数统计插件. 有关详细的配置方法,请参见 WordCount 文档。

# Dependencies: https://github.com/willin/hexo-wordcount
# Docs: https://www.npmjs.com/package/hexo-wordcount
wordcount: true

Busuanzi(不蒜子)设置

Busuanzi 是一个网站流量统计插件。如何使用 Busuanzi,有关详细示例,请参见 Busuanzi 文档。

## Dependencies: https://busuanzi.ibruce.info/
## Docs: https://ibruce.info/
busuanzi: true

顶部滚动进度条设置

# top scroll progress
scroll: true

著作权声明设置

tip:enable: truecopyright: Say what you think... # If the copyright is blank, the default value will be used.

社交分享博文设置

#Docs: https://github.com/overtrue/share.js
share: true

Viewer(图片预览)设置

Viewer 是一个简单的 jQuery 图片预览插件. 让我们首先看一个 demo。有关详细配置,请参见 Viewer 官方文档。 如果要修改 Viewer 的 options 设置,则可以到 sourcre/js/viewer/pic-viewer.js 目录下修改。

# Viewer config
viewer: true

主题模式设置

Hexo-Theme-LiveMyLife 主题暂时支持两种主题模式。

# ThemeColor config
themecolor:enable: truemode: dark # themecolor mode light or dark, default light

明亮主题模式预览:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-SrbelUJv-1629680054328)(light.png)]

黑暗主题模式预览:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NhFe4z1I-1629680054330)(dark.png)]

鼠标点击效果设置

# Mouseclick config
mouseclick:enable: truecontent:- The first step is as good as half over...- Laugh and grow fat...- Man proposes God disposes...- When all else is lost the future still remains...- Wasting time is robbing oneself...- Sharp tools make good work...- Cease to struggle and you cease to live...- A friend in need is a friend indeed...- Faith can move mountains...color:- '#9933CC'- '#339933'- '#66CCCC'- '#FF99CC'- '#CCCCFF'- '#6666CC'- '#663399'- '#66CC99'- '#FF0033'

鼠标点击效果预览:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-KfhGtbpW-1629680054333)(mouseclick.png)]

背景绸带效果设置

ribbonDynamic: true

背景绸带效果预览:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-43Wxb3Xw-1629680054335)(ribbon.png)]

背景线画布效果设置

bglinecanvas: true  # The special effects will take up a lot of cpu resorces, please open it carefully.

背景线画布效果预览:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qVqP0fbb-1629680054336)(bglinecanvas.png)]

搜索设置

# Dependencies: https://github.com/V-Vincen/hexo-generator-zip-search
search:enable: truepath: search.jsonzipPath: search.flvversionPath: searchVersion.jsonfield: post# if auto, trigger search by changing input# if manual, trigger search by pressing enter key or search buttontrigger: auto# show top n results per article, show all results by setting to -1top_n_per_article: 1

Gitter(聊天室)

Gitter 是一个聊天和网络平台,通过消息、内容和发现,帮助管理、发展和连接社区。 详细配置方法请查看 Gitter 官方文档。

## Docs:https://gitter.im/?utm_source=left-menu-logo
##
gitter:room: your-community/your-room

部署

替换为你自己的仓库地址。

deploy:type: gitrepo: https://github.com/<yourAccount>/<repo> # or https://gitee.com/<yourAccount>/<repo>branch: <your-branch>

Hexo 常用命令

hexo new post "<post name>"   # you can change post to another layout if you want
hexo clean && hexo generate   # generate the static file
hexo server   # run hexo in local environment
hexo deploy   # hexo will push the static files automatically into the specific branch(gh-pages) of your repo!

有一个好的体验 _

如果你喜欢该主题,请 Star!不胜感激你的 Follow!比心

issue

Mathjax渲染配置

官方在How to Use Mathjax 中提到了这个问题,但是本人经过官方配置啪啪一顿操作后发现并不生效,并且官方网站中的案例也没有生效(/doge),下面是解决办法:

1.换源

官方提供的源是:

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-MML-AM_CHTML"></script>

经过实测这个源会报以下这个错误(本人在Chrome和FireFox均已测试):

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-uU7Wb7pk-1629680054340)(1.png)]

并且该错误在官方教程中也存在。(浏览器F12检查)

如果尝试直接访问这个源,浏览器会报这个错误:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xWTMNzNv-1629680054346)(2.png)]

不知道这是网络问题还是怎么回事,反正手机端也无法渲染,于是我找到了另一个源:

<script src="https://mathjax.josephjctang.com/MathJax.js?config=TeX-MML-AM_HTMLorMML"></script>

终于不报错了!但是…还是不能渲染出公式,emmm接下来就是不停找源不停测试的过程…此处省略半小时。

2.开启Mathjax

如标题所见,你可能知道要怎么操作了,既然源是能正常访问,那就不是网络问题了。

操作方法

在主题配置文件也就是hexo/themes/livemylife/_config.yml中,添加如下代码:

mathjax:enable: true

搞定!解决这个问题是因为我的上一个博客版本Next的主题配置文件中自带了这两句代码,而这个没有,需要手动添加。

效果:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-h4xq6Jd4-1629680054348)(5.png)]

修改大标题尺寸

官方的页面中央大标题(pagetitle)个人感觉有点大,可以自己修改一下:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Gwyt24pC-1629680054349)(me3.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-oZVH79zt-1629680054352)(light.png)]

找到livemylife/layout/_partial/目录下的header.ejs文件,按ctrl+f查找到代码class="site-heading",如下:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Mf8ooe7k-1629680054354)(3.png)]

将其下面一行的

<h1><%= page.title || config.title %></h1>

修改为:

<h2 style="font-size: 40px;"><%= page.title || config.title %></h2>

可以根据自己调节font-size值。

取消侧边栏的list-style

livemylife/source/css/目录下的livemylife.css添加代码:

.sidebar-container .widget li {list-style: none;
}

tags字体图标

效果如下:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-IW9s9JRL-1629680054358)(4.png)]

找到livemylife/layout/_partial/_widget/目录下的featured-tags.ejs文件

修改成如下代码:

<!-- Featured Tags -->
<% if(config['featured-tags']) { %>
<section><h5><a href="<%= config.root %>tags/">标签云</a></h5><div class="tags"><% site.tags.map(function(tag){  %><% if(tag.length > config['featured-condition-size']) { %><a href="<%= config.root %>tags/#<%= tag.name %>" title="<%= tag.name %>" rel="<%= tag.length %>"><i class="fa fa-tag" style="color: aqua;"></i> <%= tag.name %></a><% } %><% }) %></div>
</section>
<% }%>

其他地方类似,可自行打开控制台查找位置。

修改块引用样式

效果:

块引用

livemylife/source/css/目录下的livemylife.css添加代码:

blockquote{border-left: 4px solid #f1e1e7;box-shadow: inset -5px 5px 10px #afadae,inset 5px -5px 10px #c9c8c8;border-radius: 5px;padding-top: 10px;padding-bottom: 5px;margin-top: 15px;margin-bottom: 15px;text-indent: 0;}
blockquote P{font-size: 15px !important;text-indent: 0;line-height: 23px !important;margin: 5px 5px !important;font-style: normal;
}

去掉图片阴影

livemylife/source/css/目录下的livemylife.css添加代码:

.post-container p img{box-shadow: none!important;
}

修改代码框样式

livemylife/source/css/目录下的livemylife.css添加代码:

.highlight {border-radius: 5px;box-shadow:  5px 5px 12px #9b9b9b,-5px -5px 12px #a1a1a1;
}
.highlight .gutter pre {background: rgba(63, 62, 62, 0.219);  padding-left: 8px;padding-right: 8px!important;
}
.highlight .gutter pre span {line-height: 20px;
}
.highlight .code span{font-weight: bold;font-size: 14px;
}

效果:

console.log("hello, world!")

后续有问题会继续更新,或者可以在博客的gitter聊天室留下您的问题,一起讨论,谢谢。

Hexo主题之livemylife个性化构建你的博客相关推荐

  1. 个人博客构建——github个人博客

    摘要 为什么需要构建自己的博客呢?第一,是为解决平台的可能随意删除自己博文,需要有一个不被其他所左右的分享平台,第二,需要一个载体来记录的自己的学习内容,第三,也是为自己自媒体提前做一个铺垫.第四,认 ...

  2. 【Gitee + Hexo】从0开始搭建自己的博客网站

    每一名开发者,都期望有属于自己的技术博客网站,这其中更多的人依赖CSDN.博客园.掘金等去分享技术性文章.本文的目的是带着大家快速搭建一个属于自己的免费博客网站,其实现原理:先用Hexo 把提前写好的 ...

  3. 使用github+Hexo人人都能拥有一个美美的博客

    我相信很多人都想拥有一个自己的博客,把自己的一些生活感想或者学习总结写到这上面分享给大家.首先我推荐一个网站简书,无论你是否是搞技术开发工作的或者其他文艺工作者,只要你想写文章,简书无疑是一个好的写文 ...

  4. 基于hexo使用github.io免费域名搭建个人博客记录

    基于hexo使用github.io免费域名搭建个人博客记录 说明,学习的时候,看的是这篇链接https://blog.csdn.net/sinat_37781304/article/details/8 ...

  5. 使用Hexo+Github一步步搭建属于自己的博客(基础)

    使用Hexo+Github一步步搭建属于自己的博客(基础) 转载于:https://blog.51cto.com/tenderrain/2312450

  6. 博客园美化教程大集合----极致个性化你的专属博客(超详细,看这篇就够了)...

    阅读目录: 1. 前言 2. 定制自己的博客 00. 美化整体效果 01. 准备工作 02. 自定义个性化导航栏 03. 添加顶部博主信息 04. 添加顶部滚动公告 05. 为博客文章添加目录导航 0 ...

  7. 使用halo和hexo+github两种方式免费搭建个人博客网站

    hexo 简介 Hexo是一款基于Node.js的静态博客框架,依赖少易于安装使用,可以方便的生成静态网页托管在GitHub和Heroku上,是搭建博客的首选框架. hexo搭建步骤 安装Git 安装 ...

  8. 使用Hexo+Github+腾讯云+Netlify搭建个人博客

    安装Hexo 要使用Hexo必须先安装Git和Node.js.本文是在Ubuntu20环境下进行操作的.使用其它系统也可以将下面的操作作为参考. 安装Git sudo apt-get install ...

  9. hexo同时在github和gitcafe搭建个人博客

    说明 自己在使用hexo搭建静态博客的时候踩了许多坑,最终去官网看教程搞定了, 建议用hexo搭建个人博客的时候,最好看清教程的日期和使用的版本,这样就 不会因为版本的不同导致的问题了.建议先去hex ...

最新文章

  1. UVA1364 Knights of the Round Table(双连通分量、二分图染色,超详细解释)
  2. Sublime Text 3 安装Package Control及配置Python环境
  3. Proteus仿真STM32F103R6的寄存器版跑马灯程序(存储器宏定义)
  4. A Self-Attention Setentence Embedding 阅读笔记
  5. Java 内建函数式接口
  6. linux 强制结束p进程的命令,Linux常用命令之性能命令
  7. update yum 到指定版本_CentOS 使用yum update 更新时保留特定版本的软件
  8. js生成vCard,以及格式参数详细说明
  9. python怎么读写文件-怎么用python读取和写入TIFF文件1
  10. k8s-kubectl进程源码分析
  11. IOMMU之Interrupt Remapping
  12. 怎样在计算机查汉字,推荐一种集汉字识字、查字、计算机输入于一体的规范汉字字形输入法—郑码(之二)...
  13. 华为折叠手机是鸿蒙系统吗,华为发布新一代折叠屏手机 将首批升级鸿蒙系统...
  14. 踩坑之路---JWT验证
  15. cesium 旋转图片
  16. 图文安装VMware Workstation教程
  17. 【原创】企业级Linux环境部署(很全、很细)
  18. ubuntu安装opencv viz模块
  19. overflow属性的用法
  20. 【Ubuntu安装git与git clone远程仓库】

热门文章

  1. 的it生活_比起最近热议的996,中年IT人的生活才是水深火热
  2. Python文件的三种打开方式
  3. GuassDB数据库的GRANT REVOKE
  4. C++递归和迭代的区别,并举例说明
  5. 乐高亲子主题活动 乐高X 起亚智能
  6. 惊了!如何通过阿里 EasyExcel 7 行代码, 优雅地实现 Excel 文件导出功能?
  7. React解决跨域问题
  8. 记录一次大厂的游戏引擎工程师的两次技术面试
  9. MMdetection环境搭建
  10. python拟合函数_python之拟合的实现