Skip to content

Commit

Permalink
chore: fix code style & udpate deps version & update docs
Browse files Browse the repository at this point in the history
1. Fix code style: fix .ejs files' code style, as a must be done thing.
2. Update deps version: update jquery, fancybox, instantsearch.js and so on.
3. Update docs: there are so many issues (like #168, #231) caused by installing instruction, so I just update related docs.
4. One more thing: unify the majority of CDN links to `cdn.jsdelivr.net`
  • Loading branch information
LolipopJ committed Jul 17, 2021
1 parent 3147f89 commit 8c242d6
Show file tree
Hide file tree
Showing 51 changed files with 1,081 additions and 1,237 deletions.
58 changes: 51 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,30 @@

- 本主题受 [yilia](https://github.com/litten/hexo-theme-yilia) 主题和 [huxpro](https://github.com/Huxpro/huxpro.github.io) 主题的启发,结合了前者的 sidebar 设计及后者的 UI 设计。通过 sidebar 能够快速执行 archive, tag 以及 categories 导航。
- 兼容性:现代浏览器及 IE10+。
- 有任何使用上的问题欢迎 [**发起 issue**](https://github.com/fi3ework/hexo-theme-archer/wiki/%E5%90%AF%E7%94%A8-Algolia-%E6%90%9C%E7%B4%A2)
- 有任何使用上的问题欢迎 **发起 issue**

## 安装主题

### 安装依赖,拉取 Archer 主题文件
### 安装主题依赖

Hexo 根目录下执行以下命令
Archer 主题依赖于 `hexo-generator-json-content``hexo-wordcount`,因此需要在 Hexo 根目录执行以下命令

``` bash
npm i hexo-generator-json-content --save && npm i --save hexo-wordcount && git clone https://github.com/fi3ework/hexo-theme-archer.git themes/archer --depth=1
npm i hexo-generator-json-content --save
npm i hexo-wordcount --save
```

### 拉取主题文件

还是在 Hexo 根目录执行下面的命令:

``` bash
git clone https://github.com/fi3ework/hexo-theme-archer.git themes/archer --depth=1
```

现在,Archer 主题已经顺利拉取到 `themes/archer` 目录下。

### 设置 Hexo 主题为 Archer
### 设置 Hexo 博客主题为 Archer

修改 Hexo 根目录下的 `_config.yml` 文件中的 `theme` 字段为 `archer`

Expand Down Expand Up @@ -64,6 +73,10 @@ jsonContent:
tags: true
```

### 启动博客预览

在 Hexo 根目录下执行 `hexo s`,即可启用本地博客预览。

## 主题配置

现在您的博客项目的目录目录结构应当如下:
Expand All @@ -77,19 +90,50 @@ jsonContent:
└── _config.yml # Hexo 配置文件
```

您可以通过 `hexo -v` 命令,或在 Hexo 根目录下的 `package.json` 中查看您当前使用的 Hexo 版本。

如果 Hexo 版本 >= 5.0.0,建议首先复制 Archer 主题目录下的 [`_config.yml`](./_config.yml) 到 Hexo 根目录,并命名为 `_config.archer.yml`。接下来修改 Hexo 根目录下的这个 `_config.archer.yml` 文件即可对主题进行配置。

如果 Hexo 版本 >= 2.8.2,修改 Archer 主题目录下的 [`_config.yml`](./_config.yml) 文件即可对主题进行配置。

如果 Hexo 版本 < 2.8.2,请参考 Archer 主题目录下的 [`_config.yml`](./_config.yml) 中的配置,在 Hexo 根目录下的 `_config.yml` 添加相应字段即可进行配置。请注意不要添加重复字段。

您可以在 Hexo 根目录下的 `package.json` 查看您当前使用的 Hexo 版本
上面三种情况的主题配置文件 `_config.archer.yml` 或 `_config.yml`,为与 Hexo 根目录下的全局配置文件 `_config.yml` 作区分,在后面的介绍中统称为「Archer 主题目录下的 `_config.yml`」

这个[维基页面](https://github.com/fi3ework/hexo-theme-archer/wiki/Archer-%E4%B8%BB%E9%A2%98%E9%85%8D%E7%BD%AE%E4%BF%A1%E6%81%AF%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83)包含了主题配置属性的中文参考。

**警告**:不要把自己 api-token 之类的私密信息添加到配置中,更不要推送到公共仓库。

### 可选配置
### 启用 Mermaid

[Mermaid](https://github.com/mermaid-js/mermaid) 是一款基于 JavaScript 的流程图和图表工具,它使用 Markdown 定义并渲染各种图表,帮助构建软件工程或各类技术文档。

为了启用 Mermaid,您需要首先在 Hexo 根目录下安装 [`hexo-filter-mermaid-diagrams`](https://github.com/webappdevelp/hexo-filter-mermaid-diagrams) 依赖:

``` bash
npm install hexo-filter-mermaid-diagrams --save
```

然后在 Archer 主题目录下的 `_config.yml` 设置启用 Mermaid:

``` yml
mermaid:
enable: true
```

现在,您可以在任意文章中添加下面的内容(需要去掉第一行和最后一行多的空格),测试 Mermaid 是否启用成功:

``` plaintext
` `` mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
` ``
```

### 其它可选配置

- [启用 about 页](https://github.com/fi3ework/hexo-theme-archer/wiki/%E5%90%AF%E7%94%A8about%E9%A1%B5)
- [启用 404 页](https://github.com/fi3ework/hexo-theme-archer/wiki/%E5%90%AF%E7%94%A8404%E9%A1%B5)
Expand Down
24 changes: 13 additions & 11 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ social:
rss:
# friends
friends:
friendA: //www.baidu.com
friendB: //www.google.com
friendC:
# friendA: //www.baidu.com
# friendB: //www.google.com
about:
enable: true
image: '/intro/about-bg.jpg'
Expand All @@ -57,6 +56,14 @@ post_header_image: '/intro/post-bg.jpg'
# 404 image
_404_image: '/intro/404-bg.jpg'

# ========== Theme ========== #
# Blog float button theme ('default' or 'rounded')
float_button_theme: default
# Blog read progress color ('default' for black or 'feature' for feature-color)
read_progress_color: default
# Blog post banner theme ('default' or 'clean')
post_banner_theme: default

# ========== Search ========== #
algolia_search:
enable: false
Expand Down Expand Up @@ -141,14 +148,9 @@ website_approve:
beian_img: /assets/beian.png
# Blog page article timeliness days reminder, 0 for no threshold
outdated_threshold: 0
# Blog float button theme ('default' or 'rounded')
float_button_theme: default
# Blog read progress color ('default' for black or 'feature' for feature-color)
read_progress_color: default
# Blog post banner theme ('default' or 'clean')
post_banner_theme: default
# Mermaid Chart: https://github.com/knsv/mermaid
mermaid:
enable: true
version: '7.1.2'
enable: false
version: 8.11.0
theme: dark
options: # find more api options from https://github.com/knsv/mermaid/blob/master/src/mermaidAPI.js
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
autoprefixer = require('autoprefixer'),
webpack = require('webpack'),
sass = require('gulp-sass'),
sass = require('gulp-sass')(require('node-sass')),
browserSync = require('browser-sync').create()

/* ========== develop ========== */
Expand Down
2 changes: 1 addition & 1 deletion layout/404.ejs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!-- 不可以删除,否则会调用post的layout -->
<!-- 不可以删除,否则会调用 post 的 layout -->
33 changes: 16 additions & 17 deletions layout/_partial/algolia.ejs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<div class="site-search">
<div class="algolia-popup popup">
<div class="algolia-search">
<div class="algolia-search-input-icon">
<i class="fa fa-search"></i>
</div>
<div class="algolia-search-input" id="algolia-search-input"></div>
</div>
<div class="algolia-popup popup">
<div class="algolia-search">
<div class="algolia-search-input-icon">
<i class="fa fa-search"></i>
</div>
<div class="algolia-search-input" id="algolia-search-input"></div>
</div>

<div class="algolia-results">
<div id="algolia-stats"></div>
<div id="algolia-hits"></div>
<div id="algolia-pagination" class="algolia-pagination"></div>
</div>
<div class="algolia-results">
<div id="algolia-stats"></div>
<div id="algolia-hits"></div>
<div id="algolia-pagination" class="algolia-pagination"></div>
</div>

<span class="popup-btn-close">
<i class="iconfont-archer">&#xe609;</i>
</span>
</div>
<span class="popup-btn-close">
<i class="iconfont-archer">&#xe609;</i>
</span>
</div>
</div>

40 changes: 20 additions & 20 deletions layout/_partial/base-background-image.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<% var bgURL; %>
<!-- 主页 -->
<% if (is_home()) { %>
<% bgURL = theme.site_header_image; %>
<% bgURL = theme.site_header_image; %>
<!-- 文章页 -->
<% } else if (is_post()) { %>
<% bgURL = page.header_image || theme.post_header_image || theme.site_header_image; %>
<% bgURL = page.header_image || theme.post_header_image || theme.site_header_image; %>
<!-- 404-->
<% } else if (page.layout === "404") { %>
<% bgURL = theme._404_image || theme.site_header_image; %>
<% bgURL = theme._404_image || theme.site_header_image; %>
<!-- about页 -->
<% } else if (page.layout === "about") { %>
<% bgURL = theme.about.image || theme.site_header_image; %>
<% bgURL = theme.about.image || theme.site_header_image; %>
<% } %>
<div class="site-intro-placeholder"></div>
<div class="site-intro-img" style="background-image: url(<%- url_for(bgURL) %>)"></div>
Expand All @@ -20,36 +20,36 @@
<h1 class="intro-title">
<!-- 主页 -->
<% if (is_home()) { %>
<%- theme.main_title || config.title%>
<%- theme.main_title || config.title %>
<!-- 文章页 -->
<% } else if(is_post()) { %>
<%- truncate(strip_html(page.title), {length: 80, omission: '...'}) || '[Untitled Post]' %>
<%- truncate(strip_html(page.title), {length: 80, omission: '...'}) || '[Untitled Post]' %>
<!-- 404 -->
<% } else if(page.layout === "404") { %>
<%- page.title || '[404]'%>
<%- page.title || '[404]'%>
<!-- about -->
<% } else if(page.layout === "about" ) { %>
<%- page.title || 'About' %>
<%- page.title || 'About' %>
<% } %>
</h1>
<!-- 副标题 -->
<p class="intro-subtitle">
<!-- 主页副标题 -->
<% if (is_home()) { %>
<% if(typeof theme.subtitle === 'string') { %>
<%- theme.subtitle %>
<% } %>
<% if(typeof theme.subtitle === 'string') { %>
<%- theme.subtitle %>
<% } %>
<!-- 文章页 -->
<% } else if (is_post()) { %>
<% if(typeof page.subtitle === 'string') { %>
<%- page.subtitle %>
<% } %>
<% if(typeof page.subtitle === 'string') { %>
<%- page.subtitle %>
<% } %>
<!-- 404 -->
<% } else if (page.layout === "404") { %>
<%- page.description %>
<% } %>
</p>
<!-- 文章页meta -->
<!-- 文章页 meta -->
<% if(is_post()) { %>
<div class="post-intros">
<!-- 文章页标签 -->
Expand All @@ -67,10 +67,10 @@
<span class="post-intro-calander iconfont-archer">&#xe676;</span>
<span class="post-intro-time"><%- date(page.date, "YYYY/MM/DD") %></span>
<% if (theme.busuanzi) { %>
<span id="busuanzi_container_page_pv" class="busuanzi-pv">
<span class="iconfont-archer">&#xe602;</span>
<span id="busuanzi_value_page_pv"></span>
</span>
<span id="busuanzi_container_page_pv" class="busuanzi-pv">
<span class="iconfont-archer">&#xe602;</span>
<span id="busuanzi_value_page_pv"></span>
</span>
<% } %>
<span class="shareWrapper">
<span class="iconfont-archer shareIcon">&#xe71d;</span>
Expand All @@ -89,4 +89,4 @@
</div>
<% } %>
</div>
</div>
</div>
16 changes: 8 additions & 8 deletions layout/_partial/base-footer-fixed.ejs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<% if(is_home()) { %>
<footer class="footer-fixed index-footer-fixed">
<footer class="footer-fixed index-footer-fixed">
<% } else { %>
<footer class="footer-fixed">
<footer class="footer-fixed">
<% } %>
<!-- back to top button -->
<div class="footer-fixed-element">
<% if(theme.float_button_theme === 'rounded') { %>
<div class="back-top back-top-rounded">
<div class="back-top back-top-rounded">
<% } else { %>
<div class="back-top">
<div class="back-top">
<% } %>
<% if(theme.float_button_theme === 'rounded') { %>
<% if(theme.float_button_theme === 'rounded') { %>
<i class="fas fa-chevron-up"></i>
<% } else { %>
<% } else { %>
<div>&#xe639;</div>
<% } %>
<% } %>
</div>
</div>
</footer>
</footer>
63 changes: 27 additions & 36 deletions layout/_partial/base-footer.ejs
Original file line number Diff line number Diff line change
@@ -1,49 +1,40 @@
<footer class="footer footer-unloaded">
<!-- social -->
<% if(theme.social) { %>
<div class="social">
<%- partial('base-social') %>
</div>
<div class="social">
<%- partial('base-social') %>
</div>
<% } %>
<!-- powered by Hexo -->
<div class="copyright">
<span id="hexo-power">Powered by <a href="https://hexo.io/" target="_blank">Hexo</a></span><span class="iconfont-archer power">&#xe635;</span><span id="theme-info">theme <a href="https://github.com/fi3ework/hexo-theme-archer" target="_blank">Archer</a></span>
</div>
<!-- website approve for Chinese user -->
<% if(theme.website_approve.enable) { %>
<div class="website-approve">
<% if(theme.website_approve.icp_approve) { %>
<span id="icp-approve" class="icp-approve">
<a href="https://beian.miit.gov.cn/" target="_blank"><%- theme.website_approve.icp_approve %></a>
</span>
<% } %>
<% if(theme.website_approve.beian_approve && theme.website_approve.beian_img) { %>
<% const beianPath = theme.website_approve.beian_img %>
<img class="beian-img" src="<%- url_for(beianPath) %>" />
<span id="beian-approve" class="beian-approve">
<a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=<%- theme.website_approve.beian_approve %>" target="_blank">京公网安备 <%- theme.website_approve.beian_approve %></a>
</span>
<% } %>
</div>
<div class="website-approve">
<% if(theme.website_approve.icp_approve) { %>
<span id="icp-approve" class="icp-approve">
<a href="https://beian.miit.gov.cn/" target="_blank"><%- theme.website_approve.icp_approve %></a>
</span>
<% } %>
<% if(theme.website_approve.beian_approve && theme.website_approve.beian_img) { %>
<% const beianPath = theme.website_approve.beian_img %>
<img class="beian-img" src="<%- url_for(beianPath) %>" />
<span id="beian-approve" class="beian-approve">
<a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=<%- theme.website_approve.beian_approve %>" target="_blank">京公网安备 <%- theme.website_approve.beian_approve %></a>
</span>
<% } %>
</div>
<% } %>
<!-- 不蒜子 -->
<% if (theme.busuanzi) { %>
<div class="busuanzi-container">
<% var sloganPieces = theme.busuanzi_slug.split('${count}') %>
<% if(theme.busuanzi_pv_or_uv === 'pv') { %>
<span id="busuanzi_container_site_pv"><%- sloganPieces[0] %><span id="busuanzi_value_site_pv"></span><%- sloganPieces[1] %></span>
<% } else if (theme.busuanzi_pv_or_uv === 'uv') { %>
<span id="busuanzi_container_site_uv"><%- sloganPieces[0] %><span id="busuanzi_value_site_uv"></span><%- sloganPieces[1] %></span>
<% } %>
</div>
<% } %>
<!-- mermaid -->
<% if (theme.mermaid.enable) { %>
<script src='https://unpkg.com/mermaid@<%= theme.mermaid.version %>/dist/mermaid.min.js'></script>
<script>
if (window.mermaid) {
mermaid.initialize({theme: 'forest'});
}
</script>
<% } %>
</footer>
<div class="busuanzi-container">
<% var sloganPieces = theme.busuanzi_slug.split('${count}') %>
<% if(theme.busuanzi_pv_or_uv === 'pv') { %>
<span id="busuanzi_container_site_pv"><%- sloganPieces[0] %><span id="busuanzi_value_site_pv"></span><%- sloganPieces[1] %></span>
<% } else if (theme.busuanzi_pv_or_uv === 'uv') { %>
<span id="busuanzi_container_site_uv"><%- sloganPieces[0] %><span id="busuanzi_value_site_uv"></span><%- sloganPieces[1] %></span>
<% } %>
</div>
<% } %>
</footer>
Loading

0 comments on commit 8c242d6

Please sign in to comment.