Hexo部署更新说明


主要记录hexo部署过程的一些配置,其中从标题2.0开始,设置主要对应hexo6.1版本

hexo

2.2屏蔽分享功能

删除了\hexo\node_modules\hexo-theme-landscape\source\js目录下script.ejs文件58-63行

1
2
3
4
5
6
'<div class="article-share-links">',
'<a href="https://twitter.com/intent/tweet?text=' + encodeURIComponent(title) + '&url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
'<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
'<a href="http://pinterest.com/pin/create/button/?url=' + encodedUrl + '" class="article-share-pinterest" target="_blank" title="Pinterest"></a>',
'<a href="https://www.linkedin.com/shareArticle?mini=true&url=' + encodedUrl + '" class="article-share-linkedin" target="_blank" title="LinkedIn"></a>',
'</div>',

2.1删除cdn地址

删除了\hexo\node_modules\hexo-theme-landscape\layout\_partial目录下head.ejs文件32-34行

1
2
3
<% if (config.highlight.enable){ %>
<%- css('https://cdn.jsdelivr.net/npm/typeface-source-code-pro@0.0.71/index.min.css') %>
<% } %>

2.0 配置信息目录

  1. 主题目录:\hexo\node_modules\hexo-theme-landscape

  2. banner目录:\hexo\node_modules\hexo-theme-landscape\source\css\images

  3. favicon目录:\hexo\node_modules\hexo-theme-landscape\source

    注意:如果将favicon图标和banner放在一起,需要修改主题的配置文件为:favicon: “/css/images/favicon.png”

  4. 站内搜索:\hexo\node_modules\hexo\lib\plugins\helper,将目录下search_form.js文件内的“google.com”修改为“bing.com”

1.6 更改“上一页”、“下一页”样式

1
2
3
<% var prev_text = "&laquo; " + __('prev');var next_text = __('next') + " &raquo;"%>
修改为
<% var prev_text = __('prev');var next_text = __('next') %>

文件路径:\hexo\themes\landscape\layout_partial;

1.5更改Googleapis

修改主题路径\hexo\themes\landscape\layout\_partial下修改after-footer.ejs;

1
2
3
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
替换为
<script src="//cdn.bootcdn.net/ajax/libs/jquery/2.0.3/jquery.min.js"></script>

修改主题路径\hexo\themes\landscape\layout\_partial下修改head.ejs;

1
2
3
<link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
替换为
<link href="https://fonts.proxy.ustclug.org/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">

1.4 URL改为urlname

hexo配置文件~/_config.yml

1
permalink: :title/

修改为

1
permalink: :urlname/

1.3 URL去掉日期

hexo配置文件~/_config.yml

1
permalink: :year/:month/:day/:title/

修改为

1
permalink: :title/

1.2 站内搜索

hexo配置文件~/_config.yml

1
2
3
4
5
6
#  path: search.xml
search:
path: search.xml
field: post
format: html
limit: 10000

landscape配置文件~/_config.yml

1
2
3
# Local search
local_search:
enable: true

JS文件search_form.js

路径:\hexo\node_modules\hexo\lib\plugins\helper

修改为:bing.com

1
2
3
4
5
6
7
8
9
10
11
12
'use strict';

function searchFormHelper(options = {}) {
const { config } = this;
const className = options.class || 'search-form';
const { text = 'Search', button } = options;

return `<form action="//bing.com/search" method="get" accept-charset="UTF-8" class="${className}"><input type="search" name="q" class="${className}-input"${text ? ` placeholder="${text}"` : ''}>${button ? `<button type="submit" class="${className}-submit">${typeof button === 'string' ? button : text}</button>` : ''}<input type="hidden" name="sitesearch" value="${config.url}"></form>`;
}

module.exports = searchFormHelper;

1.1 主题设置

landscape配置文件~/_config.yml

阅读更多

1
2
3
# Content
excerpt_link: 阅读更多
fancybox: true

统计数字

1
2
3
# widget behavior
archive_type: 'monthly'
show_count: true

站点图标

路径~\hexo\themes\landscape\source

1
favicon: /favicon.png

站点banner

路径~\hexo\themes\landscape\source\css\images

1.0 Git配置

hexo配置文件~/_config.yml

方法一:

1
2
3
4
5
6
7
8
9
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
- type: git
repo: git@github.com:w***e/w***e.github.io.git
branch: master
- type: git
repo: git@e.coding.net:a*e/w***e.git
branch: master

方法二:

1
2
3
4
5
6
7
8
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo:
github: https://e.coding.net/a*e/w***e.git
coding: https://github.com/w***e/w***e.github.io.git
branch: master