• 博客 - - Hexo + fluid + Github 搭建教程(github.io)


    环境:

            Windows 10 LTSC

            GitHub.io:提供网站文件托管+域名

            Hexo:由markdown文件和配置主动生成网页静态文件

            fluid:Hexo主题

    1、安装 Git

    2、安装 node.js

    3、github

            3-1 创建 Yourname.github.io 仓库

            3-2 填写仓库名,

                    格式:Yourname.github.io。

                    Yourname 需要和 xxx.github.com 保持一致。

                    否则访问地址会是:https://tom.github.com/tom.github.io 。

                    无法通过 Yourname.github.io 域名记性访问。

                    例如: github网址:tom.github.com ,那么新建的仓库名是:tom.github.io。

            3-3 进入 setting 下的 pages 选项

                    在github pages页面,source 选择Deploy from a branch; 

                    Branch 根据仓库的分支名来确定,这里是main 的 / 根目录下。

     

    4、安装 Hexo

    1. # 至于Hexo 版本,官方推荐最新的(需兼容node.js版本)
    2. # 全局安装(小白推荐,cmd中可直接使用hexo init)
    3. npm install -g hexo-cli 
    4. # 局部安装
    5. npm install hexo  # npm 安装 hexo
    6. npx hexo   # npm5.2版以后可用,npx init myhexo ;npx 将 hexo 下载到一个临时目录,再次执行 重新下载 hexo。
    7. echo 'PATH="$PATH:./node_modules/.bin"' >> ~/.profile  # 记得将 Hexo 所在的目录下的 node_modules 添加到环境变量之中即可直接使用 hexo

    Windows 下 Ctrl + R 打开运行,输入 CMD 打开命令行。

    新建 hexo目录并cd 进去(以下基于全局安装模式)。

    1. cd Hexo
    2. hexo init //Hexo 即会自动在目标文件夹建立网站所需要的所有文件。
    3. npm install //安装依赖包

    本地查看hexo服务:

    1. hexo generate  # 或者 hexo g ;生成静态文件
    2. hexo server  # 启动本地http服务 浏览器输入:http://localhost:4000

    至此,hexo 搭建完成

    5、安装Fluid 主题

    进入 hexo 目录,执行:

    npm install --save hexo-theme-fluid

    然后在博客目录下创建 _config.fluid.yml,将主题的 _config.yml 内容复制进去。

     _config.yml 内容如下:

    1. #---------------------------
    2. # Hexo Theme Fluid
    3. # Author: Fluid-dev
    4. # Github: GitHub - fluid-dev/hexo-theme-fluid: 一款 Material Design 风格的 Hexo 主题 / An elegant Material-Design theme for Hexo
    5. #
    6. # 配置指南: 配置指南 | Hexo Fluid 用户手册
    7. # 你可以从指南中获得更详细的说明
    8. #
    9. # Guide: Guide | Hexo Fluid Docs
    10. # You can get more detailed help from the guide
    11. #---------------------------
    12. #---------------------------
    13. # 全局
    14. # Global
    15. #---------------------------
    16. # 用于浏览器标签的图标
    17. # Icon for browser tab
    18. favicon: /img/fluid.png
    19. # 用于苹果设备的图标
    20. # Icon for Apple touch
    21. apple_touch_icon: /img/fluid.png
    22. # 浏览器标签页中的标题分隔符,效果: 文章名 - 站点名
    23. # Title separator in browser tab, eg: article - site
    24. tab_title_separator: " - "
    25. # 强制所有链接升级为 HTTPS(适用于图片等资源出现 HTTP 混入报错)
    26. # Force all links to be HTTPS (applicable to HTTP mixed error)
    27. force_https: false
    28. # 代码块的增强配置
    29. # Enhancements to code blocks
    30. code:
    31.   # 是否开启复制代码的按钮
    32.   # Enable copy code button
    33.   copy_btn: true
    34.   # 代码语言
    35.   # Code language
    36.   language:
    37.     enable: true
    38.     default: "TEXT"
    39.   # 代码高亮
    40.   # Code highlight
    41.   highlight:
    42.     enable: true
    43.     # 代码块是否显示行号
    44.     # If true, the code block display line numbers
    45.     line_number: true
    46.     # 实现高亮的库,对应下面的设置
    47.     # Highlight library
    48.     # Options: highlightjs | prismjs
    49.     lib: "highlightjs"
    50.     highlightjs:
    51.       # 在链接中挑选 style 填入
    52.       # Select a style in the link
    53.       # See: highlight.js demo
    54.       style: "github gist"
    55.       style_dark: "dark"
    56.     prismjs:
    57.       # 在下方链接页面右侧的圆形按钮挑选 style 填入,也可以直接填入 css 链接
    58.       # Select the style button on the right side of the link page, you can also set the CSS link
    59.       # See: Prism
    60.       style: "default"
    61.       style_dark: "tomorrow night"
    62.       # 设为 true 高亮将本地静态生成(但只支持部分 prismjs 插件),设为 false 高亮将在浏览器通过 js 生成
    63.       # If true, it will be generated locally (but some prismjs plugins are not supported). If false, it will be generated via JS in the browser
    64.       preprocess: true
    65. # 一些好玩的功能
    66. # Some fun features
    67. fun_features:
    68.   # 为 subtitle 添加打字机效果
    69.   # Typing animation for subtitle
    70.   typing:
    71.     enable: true
    72.     # 打印速度,数字越大越慢
    73.     # Typing speed, the larger the number, the slower
    74.     typeSpeed: 70
    75.     # 游标字符
    76.     # Cursor character
    77.     cursorChar: "_"
    78.     # 是否循环播放效果
    79.     # If true, loop animation
    80.     loop: false
    81.     # 在指定页面开启,不填则在所有页面开启
    82.     # Enable in specified page, all pages by default
    83.     # Options: home | post | tag | category | about | links | page | 404
    84.     scope: []
    85.   # 为文章内容中的标题添加锚图标
    86.   # Add an anchor icon to the title on the post page
    87.   anchorjs:
    88.     enable: true
    89.     element: h1,h2,h3,h4,h5,h6
    90.     # Options: left | right
    91.     placement: left
    92.     # Options: hover | always | touch
    93.     visible: hover
    94.     # Options: § | # | ❡
    95.     icon: ""
    96.   # 加载进度条
    97.   # Progress bar when loading
    98.   progressbar:
    99.     enable: true
    100.     height_px: 3
    101.     color: "#29d"
    102.     # See: https://github.com/rstacruz/nprogress
    103.     options: { showSpinner: false, trickleSpeed: 100 }
    104. # 主题暗色模式,开启后菜单中会出现切换按钮,用户浏览器会存储切换选项,并且会遵循 prefers-color-scheme 自动切换
    105. # Theme dark mode. If enable, a switch button will appear on the menu, each of the visitor's browser will store his switch option
    106. dark_mode:
    107.   enable: true
    108.   # 默认的选项(当用户手动切换后则不再按照默认模式),选择 `auto` 会优先遵循 prefers-color-scheme,其次按用户本地时间 18 点到次日 6 点之间进入暗色模式
    109.   # Default option (when the visitor switches manually, the default mode is no longer followed), choosing `auto` will give priority to prefers-color-scheme, and then enter the dark mode from 18:00 to 6:00 in the visitor’s local time
    110.   # Options: auto | light | dark
    111.   default: auto
    112. # 主题颜色配置,其他不生效的地方请使用自定义 css 解决,配色可以在下方链接中获得启发
    113. # Theme color, please use custom CSS to solve other colors, color schema can be inspired by the links below
    114. # See: LOL Colors - Curated color palette inspiration
    115. color:
    116.   # body 背景色
    117.   # Color of body background
    118.   body_bg_color: "#eee"
    119.   # 暗色模式下的 body 背景色,下同
    120.   # Color in dark mode, the same below
    121.   body_bg_color_dark: "#181c27"
    122.   # 顶部菜单背景色
    123.   # Color of navigation bar background
    124.   navbar_bg_color: "#2f4154"
    125.   navbar_bg_color_dark: "#1f3144"
    126.   # 顶部菜单字体色
    127.   # Color of navigation bar text
    128.   navbar_text_color: "#fff"
    129.   navbar_text_color_dark: "#d0d0d0"
    130.   # 副标题字体色
    131.   # Color of navigation bar text
    132.   subtitle_color: "#fff"
    133.   subtitle_color_dark: "#d0d0d0"
    134.   # 全局字体色
    135.   # Color of global text
    136.   text_color: "#3c4858"
    137.   text_color_dark: "#c4c6c9"
    138.   # 全局次级字体色(摘要、简介等位置)
    139.   # Color of global secondary text (excerpt, introduction, etc.)
    140.   sec_text_color: "#718096"
    141.   sec_text_color_dark: "#a7a9ad"
    142.   # 主面板背景色
    143.   # Color of main board
    144.   board_color: "#fff"
    145.   board_color_dark: "#252d38"
    146.   # 文章正文字体色
    147.   # Color of post text
    148.   post_text_color: "#2c3e50"
    149.   post_text_color_dark: "#c4c6c9"
    150.   # 文章正文字体色(h1 h2 h3...)
    151.   # Color of Article heading (h1 h2 h3...)
    152.   post_heading_color: "#1a202c"
    153.   post_heading_color_dark: "#c4c6c9"
    154.   # 文章超链接字体色
    155.   # Color of post link
    156.   post_link_color: "#0366d6"
    157.   post_link_color_dark: "#1589e9"
    158.   # 超链接悬浮时字体色
    159.   # Color of link when hovering
    160.   link_hover_color: "#30a9de"
    161.   link_hover_color_dark: "#30a9de"
    162.   # 超链接悬浮背景色
    163.   # Color of link background when hovering
    164.   link_hover_bg_color: "#f8f9fa"
    165.   link_hover_bg_color_dark: "#364151"
    166.   # 分隔线和表格边线的颜色
    167.   # Color of horizontal rule and table border
    168.   line_color: "#eaecef"
    169.   line_color_dark: "#435266"
    170.   # 滚动条颜色
    171.   # Color of scrollbar
    172.   scrollbar_color: "#c4c6c9"
    173.   scrollbar_color_dark: "#687582"
    174.   # 滚动条悬浮颜色
    175.   # Color of scrollbar when hovering
    176.   scrollbar_hover_color: "#a6a6a6"
    177.   scrollbar_hover_color_dark: "#9da8b3"
    178.   # 按钮背景色
    179.   # Color of button
    180.   button_bg_color: "transparent"
    181.   button_bg_color_dark: "transparent"
    182.   # 按钮悬浮背景色
    183.   # Color of button when hovering
    184.   button_hover_bg_color: "#f2f3f5"
    185.   button_hover_bg_color_dark: "#46647e"
    186. # 主题字体配置
    187. # Font
    188. font:
    189.   font_size: 16px
    190.   font_family:
    191.   letter_spacing: 0.02em
    192.   code_font_size: 85%
    193. # 指定自定义 .js 文件路径,支持列表;路径是相对 source 目录,如 /js/custom.js 对应存放目录 source/js/custom.js
    194. # Specify the path of your custom js file, support list. The path is relative to the source directory, such as `/js/custom.js` corresponding to the directory `source/js/custom.js`
    195. custom_js:
    196. # 指定自定义 .css 文件路径,用法和 custom_js 相同
    197. # The usage is the same as custom_js
    198. custom_css:
    199. # 网页访问统计
    200. # Analysis of website visitors
    201. web_analytics:  # 网页访问统计
    202.   enable: false
    203.   # 遵循访客浏览器"请勿追踪"的设置,如果开启则不统计其访问
    204.   # Follow the "Do Not Track" setting of the visitor's browser
    205.   # See: Tracking Preference Expression (DNT)
    206.   follow_dnt: true
    207.   # 百度统计的 Key,值需要获取下方链接中 `hm.js?` 后边的字符串
    208.   # Baidu analytics, get the string behind `hm.js?`
    209.   # See: 百度统计——一站式智能数据分析与应用平台
    210.   baidu:
    211.   # Google 统计的 Tracking ID
    212.   # Google analytics, set Tracking ID
    213.   # See: https://developers.google.com/analytics/devguides/collection/analyticsjs
    214.   google:
    215.   # Google gtag.js 的媒体资源 ID
    216.   # Google gtag.js GA_MEASUREMENT_ID
    217.   # See: https://developers.google.com/analytics/devguides/collection/gtagjs/
    218.   gtag:
    219.   # 腾讯统计的 H5 App ID,开启高级功能才有cid
    220.   # Tencent analytics, set APP ID
    221.   # See: https://mta.qq.com/h5/manage/ctr_app_manage
    222.   tencent:
    223.     sid:
    224.     cid:
    225.   # 51.la 站点统计 ID
    226.   # 51.la analytics
    227.   # See: 51LA用户中心
    228.   woyaola:  # 51.la 站点统计 ID,参见
    229.   # 友盟/cnzz 站点统计 web_id
    230.   # cnzz analytics
    231.   # See: https://web.umeng.com/main.php?c=site&a=show
    232.   cnzz:
    233.   # LeanCloud 计数统计,可用于 PV UV 展示,如果 `web_analytics: enable` 没有开启,PV UV 展示只会查询不会增加
    234.   # LeanCloud count statistics, which can be used for PV UV display. If `web_analytics: enable` is false, PV UV display will only query and not increase
    235.   leancloud:
    236.     app_id:
    237.     app_key:
    238.     # REST API 服务器地址,国际版不填
    239.     # Only the Chinese mainland users need to set
    240.     server_url:
    241.     # 统计页面时获取路径的属性
    242.     # Get the attribute of the page path during statistics
    243.     path: window.location.pathname
    244.     # 开启后不统计本地路径( localhost 与 127.0.0.1 )
    245.     # If true, ignore localhost & 127.0.0.1
    246.     ignore_local: false
    247. # 对页面中的图片和评论插件进行懒加载处理,可见范围外的元素不会提前加载
    248. # Lazy loading of images and comment plugin on the page
    249. lazyload:
    250.   enable: true
    251.   # 加载时的占位图片
    252.   # The placeholder image when loading
    253.   loading_img: /img/loading.gif
    254.   # 开启后懒加载仅在文章页生效,如果自定义页面需要使用,可以在 Front-matter 里指定 `lazyload: true`
    255.   # If true, only enable lazyload on the post page. For custom pages, you can set 'lazyload: true' in front-matter
    256.   onlypost: false
    257.   # 触发加载的偏移倍数,基数是视窗高度,可根据部署环境的请求速度调节
    258.   # The factor of viewport height that triggers loading
    259.   offset_factor: 2
    260. # 图标库,包含了大量社交类图标,主题依赖的不包含在内,因此可自行修改,详见 图标 | Hexo Fluid 用户手册
    261. # Icon library, which includes many social icons, does not include those theme dependent, so your can modify link by yourself. See: Icons | Hexo Fluid Docs
    262. iconfont: //at.alicdn.com/t/font_1736178_lbnruvf0jn.css
    263. #---------------------------
    264. # 页头
    265. # Header
    266. #---------------------------
    267. # 导航栏的相关配置
    268. # Navigation bar
    269. navbar:
    270.   # 导航栏左侧的标题,为空则按 hexo config 中 `title` 显示
    271.   # The title on the left side of the navigation bar. If empty, it is based on `title` in hexo config
    272.   blog_title: "Fluid"
    273.   # 导航栏毛玻璃特效,实验性功能,可能会造成页面滚动掉帧和抖动,部分浏览器不支持会自动不生效
    274.   # Navigation bar frosted glass special animation. It is an experimental feature
    275.   ground_glass:
    276.     enable: false
    277.     # 模糊像素,只能为数字,数字越大模糊度越高
    278.     # Number of blurred pixel. the larger the number, the higher the blur
    279.     px: 3
    280.     # 不透明度,数字越大透明度越低,注意透明过度可能看不清菜单字体
    281.     # Ratio of opacity, 1.0 is completely opaque
    282.     # available: 0 - 1.0
    283.     alpha: 0.7
    284.   # 导航栏菜单,可自行增减,key 用来关联 languages/*.yml,如不存在关联则显示 key 本身的值;icon 是 css class,可以省略;增加 name 可以强制显示指定名称
    285.   # Navigation bar menu. `key` is used to associate languages/*.yml. If there is no association, the value of `key` itself will be displayed; if `icon` is a css class, it can be omitted; adding `name` can force the display of the specified name
    286.   menu:
    287.     - { key: "home", link: "/", icon: "iconfont icon-home-fill" }
    288.     - { key: "archive", link: "/archives/", icon: "iconfont icon-archive-fill" }
    289.     - { key: "category", link: "/categories/", icon: "iconfont icon-category-fill" }
    290.     - { key: "tag", link: "/tags/", icon: "iconfont icon-tags-fill" }
    291.     - { key: "about", link: "/about/", icon: "iconfont icon-user-fill" }
    292.     #- { key: "links", link: "/links/", icon: "iconfont icon-link-fill" }
    293. # 搜索功能,基于 hexo-generator-search 插件,若已安装其他搜索插件请关闭此功能,以避免生成多余的索引文件
    294. # Search feature, based on hexo-generator-search. If you have installed other search plugins, please disable this feature to avoid generating redundant index files
    295. search:
    296.   enable: true
    297.   # 搜索索引文件的路径,可以是相对路径或外站的绝对路径
    298.   # Path for search index file, it can be a relative path or an absolute path
    299.   path: /local-search.xml
    300.   # 文件生成在本地的位置,必须是相对路径
    301.   # The location where the index file is generated locally, it must be a relative location
    302.   generate_path: /local-search.xml
    303.   # 搜索的范围
    304.   # Search field
    305.   # Options: post | page | all
    306.   field: post
    307.   # 搜索是否扫描正文
    308.   # If true, search will scan the post content
    309.   content: true
    310. # 首屏图片的相关配置
    311. # Config of the big image on the first screen
    312. banner:
    313.   # 视差滚动,图片与板块会随着屏幕滚动产生视差效果
    314.   # Scrolling parallax
    315.   parallax: true
    316.   # 图片最小的宽高比,以免图片两边被过度裁剪,适用于移动端竖屏时,如需关闭设为 0
    317.   # Minimum ratio of width to height, applicable to the vertical screen of mobile device, if you need to close it, set it to 0
    318.   width_height_ratio: 1.0
    319. # 向下滚动的箭头
    320. # Scroll down arrow
    321. scroll_down_arrow:
    322.   enable: true
    323.   # 头图高度不小于指定比例,才显示箭头
    324.   # Only the height of the banner image is greater than the ratio, the arrow is displayed
    325.   # Available: 0 - 100
    326.   banner_height_limit: 80
    327.   # 翻页后自动滚动
    328.   # Auto scroll after page turning
    329.   scroll_after_turning_page: true
    330. # 向顶部滚动的箭头
    331. # Scroll top arrow
    332. scroll_top_arrow:
    333.   enable: true
    334. # Open Graph metadata
    335. # See: Helpers | Hexo
    336. open_graph:
    337.   enable: true
    338.   twitter_card: summary_large_image
    339.   twitter_id:
    340.   twitter_site:
    341.   google_plus:
    342.   fb_admins:
    343.   fb_app_id:
    344. #---------------------------
    345. # 页脚
    346. # Footer
    347. #---------------------------
    348. footer:
    349.   # 页脚第一行文字的 HTML,建议保留 Fluid 的链接,用于向更多人推广本主题
    350.   # HTML of the first line of the footer, it is recommended to keep the Fluid link to promote this theme to more people
    351.   content: '
    352.     Hexo
    353.    
    354.     Fluid
    355.   '
    356.   # 展示网站的 PV、UV 统计数
    357.   # Display website PV and UV statistics
    358.   statistics:
    359.     enable: false
    360.     # 统计数据来源,使用 leancloud 需要设置 `web_analytics: leancloud` 中的参数;使用 busuanzi 不需要额外设置,但是有时不稳定,另外本地运行时 busuanzi 显示统计数据很大属于正常现象,部署后会正常
    361.     # Data source. If use leancloud, you need to set the parameter in `web_analytics: leancloud`
    362.     # Options: busuanzi | leancloud
    363.     source: "busuanzi"
    364.   # 国内大陆服务器的备案信息
    365.   # For Chinese mainland website policy, other areas keep disable
    366.   beian:
    367.     enable: false
    368.     # ICP证号
    369.     icp_text: 京ICP证123456号
    370.     # 公安备案号,不填则只显示ICP
    371.     police_text: 京公网安备12345678号
    372.     # 公安备案的编号,用于URL跳转查询
    373.     police_code: 12345678
    374.     # 公安备案的图片. 为空时不显示备案图片
    375.     police_icon: /img/police_beian.png
    376. #---------------------------
    377. # 首页
    378. # Home Page
    379. #---------------------------
    380. index:
    381.   # 首页 Banner 头图,可以是相对路径或绝对路径,以下相同
    382.   # Path of Banner image, can be a relative path or an absolute path, the same on other pages
    383.   banner_img: /img/default.png
    384.   # 头图高度,屏幕百分比
    385.   # Height ratio of banner image
    386.   # Available: 0 - 100
    387.   banner_img_height: 100
    388.   # 头图黑色蒙版的不透明度,available: 0 - 1.0, 1 是完全不透明
    389.   # Opacity of the banner mask, 1.0 is completely opaque
    390.   # Available: 0 - 1.0
    391.   banner_mask_alpha: 0.3
    392.   # 首页副标题的独立设置
    393.   # Independent config of home page subtitle
    394.   slogan:
    395.     enable: true
    396.     # 为空则按 hexo config.subtitle 显示
    397.     # If empty, text based on `subtitle` in hexo config
    398.     text: "An elegant Material-Design theme for Hexo"
    399.     # 通过 API 接口作为首页副标题的内容,必须返回的是 JSON 格式,如果请求失败则按 text 字段显示,该功能必须先开启 typing 打字机功能
    400.     # Subtitle of the homepage through the API, must be returned a JSON. If the request fails, it will be displayed in `text` value. This feature must first enable the typing animation
    401.     api:
    402.       enable: false
    403.       # 请求地址
    404.       # Request url
    405.       url: ""
    406.       # 请求方法
    407.       # Request method
    408.       # Available: GET | POST | PUT
    409.       method: "GET"
    410.       # 请求头
    411.       # Request headers
    412.       headers: {}
    413.       # 从请求结果获取字符串的取值字段,最终必须是一个字符串,例如返回结果为 {"data": {"author": "fluid", "content": "An elegant theme"}}, 则取值字段为 ['data', 'content'];如果返回是列表则自动选择第一项
    414.       # The value field of the string obtained from the response. For example, the response content is {"data": {"author": "fluid", "content": "An elegant theme"}}, the expected `keys: ['data','content']`; if the return is a list, the first item is automatically selected
    415.       keys: []
    416.   # 自动截取文章摘要
    417.   # Auto extract post
    418.   auto_excerpt:
    419.     enable: true
    420.   # 打开文章的标签方式
    421.   # The browser tag to open the post
    422.   # Available: _blank | _self
    423.   post_url_target: _self
    424.   # 是否显示文章信息(时间、分类、标签)
    425.   # Meta information of post
    426.   post_meta:
    427.     date: true
    428.     category: true
    429.     tag: true
    430.   # 文章通过 sticky 排序后,在首页文章标题前显示图标
    431.   # If the posts are sorted by `sticky`, an icon is displayed in front of the post title
    432.   post_sticky:
    433.     enable: true
    434.     icon: "iconfont icon-top"
    435. #---------------------------
    436. # 文章页
    437. # Post Page
    438. #---------------------------
    439. post:
    440.   banner_img: /img/default.png
    441.   banner_img_height: 70
    442.   banner_mask_alpha: 0.3
    443.   # 文章在首页的默认封面图,当没有指定 index_img 时会使用该图片,若两者都为空则不显示任何图片
    444.   # Path of the default post cover when `index_img` is not set. If both are empty, no image will be displayed
    445.   default_index_img:
    446.   # 文章标题下方的元信息
    447.   # Meta information below title
    448.   meta:
    449.     # 作者,优先根据 front-matter 里 author 字段,其次是 hexo 配置中 author 值
    450.     # Author, based on `author` field in front-matter, if not set, based on `author` value in hexo config
    451.     author:
    452.       enable: false
    453.     # 文章日期,优先根据 front-matter 里 date 字段,其次是 md 文件日期
    454.     # Post date, based on `date` field in front-matter, if not set, based on create date of .md file
    455.     date:
    456.       enable: true
    457.       # 格式参照 ISO-8601 日期格式化
    458.       # ISO-8601 date format
    459.       # See: 文档 | Moment.js 中文网
    460.       format: "LL a"
    461.     # 字数统计
    462.     # Word count
    463.     wordcount:
    464.       enable: true
    465.     # 估计阅读全文需要的时长
    466.     # Estimated reading time
    467.     min2read:
    468.       enable: true
    469.       # 每个字词的长度,建议:中文≈2,英文≈5,中英混合可自行调节
    470.       # Average word length (chars count in word), ZH ≈ 2, EN ≈ 5
    471.       awl: 2
    472.       # 每分钟阅读字数,如果大部分是技术文章可适度调低
    473.       # Words per minute
    474.       wpm: 60
    475.     # 浏览量计数
    476.     # Number of visits
    477.     views:
    478.       enable: false
    479.       # 统计数据来源
    480.       # Data Source
    481.       # Options: busuanzi | leancloud
    482.       source: "busuanzi"
    483.   # 在文章开头显示文章更新时间,该时间默认是 md 文件更新时间,可通过 front-matter 中 `updated` 手动指定(和 date 一样格式)
    484.   # Update date is displayed at the beginning of the post. The default date is the update date of the md file, which can be manually specified by `updated` in front-matter (same format as date)
    485.   updated:
    486.     enable: false
    487.     # 格式参照 ISO-8601 日期格式化
    488.     # ISO-8601 date format
    489.     # See: 文档 | Moment.js 中文网
    490.     date_format: "LL a"
    491.     # 是否使用相对时间表示,比如:"3 天前"
    492.     # If true, it will be a relative time, such as: "3 days ago"
    493.     relative: false
    494.     # 提示标签类型
    495.     # Note class
    496.     # Options: default | primary | info | success | warning | danger | light
    497.     note_class: info
    498.   # 侧边栏展示当前分类下的文章
    499.   # Sidebar of category
    500.   category_bar:
    501.     enable: true
    502.     # 开启后,只有在文章 Front-matter 里指定 `category_bar: true` 才会展示分类,也可以通过 `category_bar: ["分类A"]` 来指定分类
    503.     # If true, only set `category_bar: true` in Front-matter will enable sidebar of category, also set `category_bar: ["CategoryA"]` to specify categories
    504.     specific: true
    505.     # 置于板块的左侧或右侧
    506.     # place in the board
    507.     # Options: left | right
    508.     placement: left
    509.     # 文章的排序字段,前面带减号是倒序,不带减号是正序
    510.     # Sort field for posts, with a minus sign is reverse order
    511.     # Options: date | title | or other field of front-matter
    512.     post_order_by: "title"
    513.     # 单个分类中折叠展示文章数的最大值,超过限制会显示 More,0 则不限制
    514.     # The maximum number of posts in a single category. If the limit is exceeded, it will be displayed More. If 0 no limit
    515.     post_limit: 0
    516.   # 侧边栏展示文章目录
    517.   # Table of contents (TOC) in the sidebar
    518.   toc:
    519.     enable: true
    520.     # 置于板块的左侧或右侧
    521.     # place in the board
    522.     # Options: left | right
    523.     placement: right
    524.     # 目录会选择这些节点作为标题
    525.     # TOC will select these nodes as headings
    526.     headingSelector: "h1,h2,h3,h4,h5,h6"
    527.     # 层级的折叠深度,0 是全部折叠,大于 0 后如果存在下级标题则默认展开
    528.     # Collapse depth. If 0, all headings collapsed. If greater than 0, it will be expanded by default if there are sub headings
    529.     collapseDepth: 0
    530.   # 版权声明,会显示在每篇文章的结尾
    531.   # Copyright, will be displayed at the end of each post
    532.   copyright:
    533.     enable: true
    534.     # CreativeCommons license
    535.     # Options: BY | BY-SA | BY-ND | BY-NC | BY-NC-SA | BY-NC-ND
    536.     license: 'BY'
    537.     # 显示作者
    538.     author:
    539.       enable: true
    540.     # 显示发布日期
    541.     # Show post date
    542.     post_date:
    543.       enable: true
    544.       format: "LL"
    545.     # 显示更新日期
    546.     # Show update date
    547.     update_date:
    548.       enable: false
    549.       format: "LL"
    550.   # 文章底部上一篇下一篇功能
    551.   # Link to previous/next post
    552.   prev_next:
    553.     enable: true
    554.   # 文章图片标题
    555.   # Image caption
    556.   image_caption:
    557.     enable: true
    558.   # 文章图片可点击放大
    559.   # Zoom feature of images
    560.   image_zoom:
    561.     enable: true
    562.     # 放大后图片链接替换规则,可用于将压缩图片链接替换为原图片链接,如 ['-slim', ''] 是将链接中 `-slim` 移除;如果想使用正则请使用 `re:` 前缀,如 ['re:\\d{3,4}\\/\\d{3,4}\\/', '']
    563.     # The image url replacement when zooming, the feature can be used to replace the compressed image to the original image, eg: ['-slim', ''] removes `-slim` from the image url when zooming; if you want to use regular, use prefix `re:`, eg: ['re:\\d{3,4}\\/\\d{3,4}\\/','']
    564.     img_url_replace: ['', '']
    565.   # 脚注语法,会在文章底部生成脚注,如果 Markdown 渲染器本身支持,则建议关闭,否则可能会冲突
    566.   # Support footnote syntax, footnotes will be generated at the bottom of the post page. If the Markdown renderer itself supports it, please disable it, otherwise it may conflict
    567.   footnote:
    568.     enable: true
    569.     # 脚注的节标题,也可以在 front-matter 中通过 `footnote:

      Reference

      ` 这种形式修改单独页面的 header
    570.     # The section title of the footnote, you can also modify the header of a single page in the form of `footnote:

      Reference

      ` in front-matter
    571.     header: ''
    572.   # 数学公式,开启之前需要更换 Markdown 渲染器,否则复杂公式会有兼容问题,具体请见:https://hexo.fluid-dev.com/docs/guide/##latex-数学公式
    573.   # Mathematical formula. If enable, you need to change the Markdown renderer, see: Guide | Hexo Fluid Docs
    574.   math:
    575.     # 开启后文章默认可用,自定义页面如需使用,需在 Front-matter 中指定 `math: true`
    576.     # If you want to use math on the custom page, you need to set `math: true` in Front-matter
    577.     enable: false
    578.     # 开启后,只有在文章 Front-matter 里指定 `math: true` 才会在文章页启动公式转换,以便在页面不包含公式时提高加载速度
    579.     # If true, only set `math: true` in Front-matter will enable math, to load faster when the page does not contain math
    580.     specific: false
    581.     # Options: mathjax | katex
    582.     engine: mathjax
    583.   # 流程图,基于 mermaid-js,具体请见:https://hexo.fluid-dev.com/docs/guide/#mermaid-流程图
    584.   # Flow chart, based on mermaid-js, see: Guide | Hexo Fluid Docs
    585.   mermaid:
    586.     # 开启后文章默认可用,自定义页面如需使用,需在 Front-matter 中指定 `mermaid: true`
    587.     # If you want to use mermaid on the custom page, you need to set `mermaid: true` in Front-matter
    588.     enable: false
    589.     # 开启后,只有在文章 Front-matter 里指定 `mermaid: true` 才会在文章页启动公式转换,以便在页面不包含公式时提高加载速度
    590.     # If true, only set `mermaid: true` in Front-matter will enable mermaid, to load faster when the page does not contain mermaid
    591.     specific: false
    592.     # See: mermaid - Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.
    593.     options: { theme: 'default' }
    594.   # 评论插件
    595.   # Comment plugin
    596.   comments:
    597.     enable: false
    598.     # 指定的插件,需要同时设置对应插件的必要参数
    599.     # The specified plugin needs to set the necessary parameters at the same time
    600.     # Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus
    601.     type: disqus
    602. #---------------------------
    603. # 评论插件
    604. # Comment plugins
    605. #
    606. # 开启评论需要先设置上方 `post: comments: enable: true`,然后根据 `type` 设置下方对应的评论插件参数
    607. # Enable comments need to be set `post: comments: enable: true`, then set the corresponding comment plugin parameters below according to `type`
    608. #---------------------------
    609. # Utterances
    610. # 基于 GitHub Issues
    611. # Based on GitHub Issues
    612. # See: https://utteranc.es
    613. utterances:
    614.   repo:
    615.   issue_term: pathname
    616.   label: utterances
    617.   theme: github-light
    618.   theme_dark: github-dark
    619. # Disqus
    620. # 基于第三方的服务,国内用户直接使用容易被墙,建议配合 Disqusjs
    621. # Based on third-party service
    622. # See: https://disqus.com
    623. disqus:
    624.   shortname:
    625.   # 以下为 Disqusjs 支持, 国内用户如果想使用 Disqus 建议配合使用
    626.   # The following are Disqusjs configurations, please ignore if DisqusJS is not required
    627.   # See: GitHub - SukkaW/DisqusJS: Render Disqus comments in Mainland China using Disqus API
    628.   disqusjs: false
    629.   apikey:
    630. # Gitalk
    631. # 基于 GitHub Issues
    632. # Based on GitHub Issues
    633. # See: https://github.com/gitalk/gitalk#options
    634. gitalk:
    635.   clientID:
    636.   clientSecret:
    637.   repo:
    638.   owner:
    639.   admin: ['name']
    640.   language: zh-CN
    641.   labels: ['Gitalk']
    642.   perPage: 10
    643.   pagerDirection: last
    644.   distractionFreeMode: false
    645.   createIssueManually: true
    646.   # 默认 proxy 可能会失效,解决方法请见下方链接
    647.   # The default proxy may be invalid, refer to the links for solutions
    648.   # https://github.com/gitalk/gitalk/issues/429
    649.   # https://github.com/Zibri/cloudflare-cors-anywhere
    650.   proxy: https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token
    651. # Valine
    652. # 基于 LeanCloud
    653. # Based on LeanCloud
    654. # See: 介绍 | Valine 一款快速、简洁且高效的无后端评论系统。
    655. valine:
    656.   appId:
    657.   appKey:
    658.   path: window.location.pathname
    659.   placeholder:
    660.   avatar: 'retro'
    661.   meta: ['nick', 'mail', 'link']
    662.   requiredFields: []
    663.   pageSize: 10
    664.   lang: 'zh-CN'
    665.   highlight: false
    666.   recordIP: false
    667.   serverURLs: ''
    668.   emojiCDN:
    669.   emojiMaps:
    670.   enableQQ: false
    671. # Waline
    672. # 从 Valine 衍生而来,额外增加了服务端和多种功能
    673. # Derived from Valine, with self-hosted service and new features
    674. # See: Waline | Waline
    675. waline:
    676.   serverURL: ''
    677.   path: window.location.pathname
    678.   meta: ['nick', 'mail', 'link']
    679.   requiredMeta: ['nick']
    680.   lang: 'zh-CN'
    681.   emoji: ['https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo']
    682.   dark: 'html[data-user-color-scheme="dark"]'
    683.   wordLimit: 0
    684.   pageSize: 10
    685. # 畅言 Changyan
    686. # 基于第三方的服务
    687. # Based on third-party service, insufficient support for regions outside China
    688. # 畅言云评 - 专业的社会化评论系统
    689. changyan:
    690.   appid: ''
    691.   appkey: ''
    692. # 来必力 Livere
    693. # 基于第三方的服务
    694. # Based on third-party service
    695. # See: Welcome to LiveRe.com
    696. livere:
    697.   uid: ''
    698. # Remark42
    699. # 需要自托管服务端
    700. # Based on self-hosted service
    701. # See: Remark42 – Privacy-focused lightweight commenting engine | Remark42
    702. remark42:
    703.   host:
    704.   site_id:
    705.   max_shown_comments: 10
    706.   locale: zh
    707.   components: ['embed']
    708. # Twikoo
    709. # 基于腾讯云开发
    710. # Based on Tencent CloudBase
    711. # See: Twikoo 文档
    712. twikoo:
    713.   envId:
    714.   region: ap-shanghai
    715.   path: window.location.pathname
    716. # Cusdis
    717. # 基于第三方服务或自托管服务
    718. # Based on third-party or self-hosted service
    719. # See Cusdis - Lightweight, privacy-first, open-source comment system
    720. cusdis:
    721.   host:
    722.   app_id:
    723.   lang: zh-cn
    724. # Giscus
    725. # 基于 GitHub Discussions,类似于 Utterances
    726. # Based on GitHub Discussions, similar to Utterances
    727. # See: giscus
    728. giscus:
    729.   repo:
    730.   repo-id:
    731.   category:
    732.   category-id:
    733.   theme-light: light
    734.   theme-dark: dark
    735.   mapping: pathname
    736.   reactions-enabled: 1
    737.   emit-metadata: 0
    738.   input-position: top
    739.   lang: zh-CN
    740. #---------------------------
    741. # 归档页
    742. # Archive Page
    743. #---------------------------
    744. archive:
    745.   banner_img: /img/default.png
    746.   banner_img_height: 60
    747.   banner_mask_alpha: 0.3
    748. #---------------------------
    749. # 分类页
    750. # Category Page
    751. #---------------------------
    752. category:
    753.   enable: true
    754.   banner_img: /img/default.png
    755.   banner_img_height: 60
    756.   banner_mask_alpha: 0.3
    757.   # 分类的排序字段,前面带减号是倒序,不带减号是正序
    758.   # Sort field for categories, with a minus sign is reverse order
    759.   # Options: length | name
    760.   order_by: "-length"
    761.   # 层级的折叠深度,0 是全部折叠,大于 0 后如果存在子分类则默认展开
    762.   # Collapse depth. If 0, all posts collapsed. If greater than 0, it will be expanded by default if there are subcategories
    763.   collapse_depth: 0
    764.   # 文章的排序字段,前面带减号是倒序,不带减号是正序
    765.   # Sort field for posts, with a minus sign is reverse order
    766.   # Options: date | title | or other field of front-matter
    767.   post_order_by: "-date"
    768.   # 单个分类中折叠展示文章数的最大值,超过限制会显示 More,0 则不限制
    769.   # The maximum number of posts in a single category. If the limit is exceeded, it will be displayed More. If 0 no limit
    770.   post_limit: 10
    771. #---------------------------
    772. # 标签页
    773. # Tag Page
    774. #---------------------------
    775. tag:
    776.   enable: true
    777.   banner_img: /img/default.png
    778.   banner_img_height: 80
    779.   banner_mask_alpha: 0.3
    780.   tagcloud:
    781.     min_font: 15
    782.     max_font: 30
    783.     unit: px
    784.     start_color: "#BBBBEE"
    785.     end_color: "#337ab7"
    786. #---------------------------
    787. # 关于页
    788. # About Page
    789. #---------------------------
    790. about:
    791.   enable: true
    792.   banner_img: /img/default.png
    793.   banner_img_height: 60
    794.   banner_mask_alpha: 0.3
    795.   avatar: /img/avatar.png
    796.   name: "Fluid"
    797.   intro: "An elegant theme for Hexo"
    798.   # 更多图标可从 图标 | Hexo Fluid 用户手册 查找,`class` 代表图标的 css class,添加 `qrcode` 后,图标不再是链接而是悬浮二维码
    799.   # More icons can be found from Icons | Hexo Fluid Docs  `class` is the css class of the icon. If adding `qrcode`, The icon is no longer a link, but a hovering QR code
    800.   icons:
    801.     - { class: "iconfont icon-github-fill", link: "https://github.com", tip: "GitHub" }
    802.     - { class: "iconfont icon-douban-fill", link: "豆瓣", tip: "豆瓣" }
    803.     - { class: "iconfont icon-wechat-fill", qrcode: "/img/favicon.png" }
    804. #---------------------------
    805. # 自定义页
    806. # Custom Page
    807. #
    808. # 通过 hexo new page 命令创建的页面
    809. # Custom Page through `hexo new page`
    810. #---------------------------
    811. page:
    812.   banner_img: /img/default.png
    813.   banner_img_height: 60
    814.   banner_mask_alpha: 0.3
    815. #---------------------------
    816. # 404页
    817. # 404 Page
    818. #---------------------------
    819. page404:
    820.   enable: true
    821.   banner_img: /img/default.png
    822.   banner_img_height: 85
    823.   banner_mask_alpha: 0.3
    824.   # 重定向到首页的延迟(毫秒)
    825.   # Delay in redirecting to home page (milliseconds)
    826.   redirect_delay: 5000
    827. #---------------------------
    828. # 友链页
    829. # Links Page
    830. #---------------------------
    831. links:
    832.   enable: true
    833.   banner_img: /img/default.png
    834.   banner_img_height: 60
    835.   banner_mask_alpha: 0.3
    836.   # 友链的成员项
    837.   # Member item of page
    838.   items:
    839.     - {
    840.       title: "Fluid Blog",
    841.       intro: "主题博客",
    842.       link: "Hexo Theme Fluid",
    843.       avatar: "/img/favicon.png"
    844.     }
    845.     - {
    846.       title: "Fluid Docs",
    847.       intro: "主题使用指南",
    848.       link: "Hexo Fluid 用户手册",
    849.       avatar: "/img/favicon.png"
    850.     }
    851.     - {
    852.       title: "Fluid Repo",
    853.       intro: "主题 GitHub 仓库",
    854.       link: "https://github.com/fluid-dev/hexo-theme-fluid",
    855.       avatar: "/img/favicon.png"
    856.     }
    857.   # 当成员头像加载失败时,替换为指定图片
    858.   # When the member avatar fails to load, replace the specified image
    859.   onerror_avatar: /img/avatar.png
    860.   # 友链下方自定义区域,支持 HTML,可插入例如申请友链的文字
    861.   # Custom content at the bottom of the links
    862.   custom:
    863.     enable: false
    864.     content: '

      在下方留言申请加入我的友链,按如下格式提供信息:

      • 博客名:Fluid
      • 简介:Fluid 主题官方博客
      • 链接:https://hexo.fluid-dev.com
      • 图片:https://hexo.fluid-dev.com/img/favicon.png
      '
    865.   # 评论插件
    866.   # Comment plugin
    867.   comments:
    868.     enable: false
    869.     # 指定的插件,需要同时设置对应插件的必要参数
    870.     # The specified plugin needs to set the necessary parameters at the same time
    871.     # Options: utterances | disqus | gitalk | valine | waline | changyan | livere | remark42 | twikoo | cusdis | giscus
    872.     type: disqus
    873. #---------------------------
    874. # 以下是配置 JS CSS 等静态资源的 URL 前缀,可以自定义成 CDN 地址,
    875. # 如果需要修改,最好使用与默认配置相同的版本,以避免潜在的问题,
    876. # ** 如果你不知道如何设置,请不要做任何改动 **
    877. #
    878. # Here is the url prefix to configure the static assets. Set CDN addresses you want to customize.
    879. # Be aware that you would better use the same version as default ones to avoid potential problems.
    880. # DO NOT EDIT THE FOLLOWING SETTINGS UNLESS YOU KNOW WHAT YOU ARE DOING
    881. #---------------------------
    882. static_prefix:
    883.   # 内部静态
    884.   # Internal static
    885.   internal_js: /js
    886.   internal_css: /css
    887.   internal_img: /img
    888.   anchor: https://lib.baomitu.com/anchor-js/4.3.1/
    889.   github_markdown: https://lib.baomitu.com/github-markdown-css/4.0.0/
    890.   jquery: https://lib.baomitu.com/jquery/3.6.0/
    891.   bootstrap: https://lib.baomitu.com/twitter-bootstrap/4.6.1/
    892.   prismjs: https://lib.baomitu.com/prism/1.27.0/
    893.   tocbot: https://lib.baomitu.com/tocbot/4.18.2/
    894.   typed: https://lib.baomitu.com/typed.js/2.0.12/
    895.   fancybox: https://lib.baomitu.com/fancybox/3.5.7/
    896.   nprogress: https://lib.baomitu.com/nprogress/0.2.0/
    897.   mathjax: https://lib.baomitu.com/mathjax/3.2.1/
    898.   katex: https://lib.baomitu.com/KaTeX/0.15.6/
    899.   busuanzi: https://busuanzi.ibruce.info/busuanzi/2.3/
    900.   clipboard: https://lib.baomitu.com/clipboard.js/2.0.10/
    901.   mermaid: https://lib.baomitu.com/mermaid/8.14.0/
    902.   valine: https://lib.baomitu.com/valine/1.4.17/
    903.   waline: https://lib.baomitu.com/waline/2.5.1/
    904.   gitalk: https://lib.baomitu.com/gitalk/1.7.2/
    905.   disqusjs: https://lib.baomitu.com/disqusjs/1.3.0/
    906.   twikoo: https://lib.baomitu.com/twikoo/1.5.11/
    907.   hint: https://lib.baomitu.com/hint.css/2.7.0/

    在 hexo 目录下找到并修改 _config.yml 文件:

    1. theme: fluid  # 指定主题
    2. language: zh-CN  # 指定语言,会影响主题显示的语言,按需修改

    尝试新建博客中的 关于我 页面,在hexo 目录下执行:

    hexo new page about

    建成功后,编辑博客目录下 /source/about/index.md,这里添加 layout 属性。

    1. ---
    2. title: about
    3. layout: about
    4. ---
    5. 这里写关于页的正文,支持 Markdown, HTML

    6、发布:

    修改 hexo 目录下的_config.yml 文件:

    位置:

    修改 _config.yml 文件里面的deploy:

    1. deploy:
    2.   type: git
    3.   repo: https://github.com/Yourname/Yourname.github.io.git
    4.   branch: main

    PS:

            repo 这里采用https方式;如果需要采用 git方式则需要在github中上传ssh key。

            branch 需要修改,保持和仓库中的相同。这里是 main

    安装发布插件:

    npm install hexo-deployer-git –save

    在 hexo 目录下 ,CMD中输入

    1. hexo clean //清除缓存文件 db.json 和已生成的静态文件 public
    2. hexo generate //生成网站静态文件到默认设置的 public 文件夹
    3. hexo deploy //自动生成网站静态文件,并部署到设定的仓库。

    过程中会提示你输入账号名和密码,Username是你的Github账号名称,而不是邮箱;Password就是你的Github的密码。

    发布成功的状态:

    此时 在浏览器中输入 Yourname.github.io 即可访问创建好的站点了。

    尝试新建文章,在 hexo 目录下执行:

    hexo new "my-article-title"

    会在 /source/_posts 中新建一个以 my-article-title.md 为名字的markdown文件,编辑这个文件之后再一次部署,过几分钟就可以看到博客的更新了。

    hexo 目录下执行:

    1.  hexo clean
    2.  hexo deploy

    Tips:

       hexo 命令缩写:

    1. hexo g == hexo generate 
    2. hexo d == hexo deploy
    3. hexo s == hexo server
    4. hexo n == hexo new

  • 相关阅读:
    如何选择合适的数据库管理工具?Navicat Or DBeaver
    使用selenium/drissionpage时如何阻止chrome自动跳转http到https
    戴钊《自我教练:迈向自我实现之路》读书笔记
    java毕业生设计校园面包超市系统计算机源码+系统+mysql+调试部署+lw
    Flutter 从源码看Getx的依赖原理
    9步打造个人ip
    TOK六大新话题怎么整理思路?
    文件I/O
    外包干了5天,技术明显退步。。。。。
    怎样下载微信视频号视频?分享十种方法给你~
  • 原文地址:https://blog.csdn.net/sedbz/article/details/126032526