GitHub+Hexo(7)-网站速度优化

前言:博客速度为什么慢?如何优化

加速你的网站!

  1. 域名解析分流
  2. CDN优化
  3. 功能优化
  4. 资源压缩
  5. 源码优化

网站瓶颈分析

chrome 工具

https://kaitohh.com/2019/02/01/tweak-hexo-2/
http://luckykun.com/work/2016-07-10/hexo-faster.html
https://sesprie.bid/website/hexo-03.html

域名解析 https://console.cloud.tencent.com/domain
https://console.cloud.tencent.com/cns/detail/

域名解析分流

增加coding分流

https://izpan.com/use-github-coding-build-hexo-bolg

CDN优化

js的cnd

https://11.tt/posts/2018/set-up-cdn-for-hexo/
https://www.gokuweb.com/operation/cc4a1e83.html

功能优化

取消侧边栏的网易音乐播放器

更改部分js的引用源,利用CDN加速

  1. 就在主题配置文件里更改
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    # Internal path prefix. Please do not edit it.
    _internal: lib

    # Internal version: 3.4.1
    # Example:
    jquery: //cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
    # jquery: //cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js
    # jquery:

    # leancloud-storage
    # See: https://www.npmjs.com/package/leancloud-storage
    # Example:
    leancloud: //cdn.jsdelivr.net/npm/leancloud-storage@3/dist/av-min.js
    #leancloud:

    # valine
    # See: https://github.com/xCss/Valine
    # Example:
    valine: //cdn.jsdelivr.net/npm/valine@1/dist/Valine.min.js
    # valine: //cdnjs.cloudflare.com/ajax/libs/valine/1.3.4/Valine.min.js
    # valine:

资源压缩

tinypng压缩图片