Hexo使用学习笔记

Hexo使用说明笔记

本文简要介绍如何使用Hexo在github上搭建一个个人博客网站,关于Hexo的详细使用说明,还请参考官方文档

1、文件简介

在Hexo生成的目录下,大致有一下几个文件夹/文件:

  • public 生成的网站文件,发布的站点文件。

  • source资源文件夹,用于存放内容。

  • tag 标签文件夹。

  • archive归档文件夹。

  • category分类文件夹。

  • downloads/code include code文件夹。

  • :lang i18n_dir 国际化文件夹。

  • _config.yml 配置文件

    • 配置说明
    
    # Hexo Configuration
    
    
    ## Docs: https://hexo.io/docs/configuration.html
    
    
    ## Source: https://github.com/hexojs/hexo/
    
    
    
    # Site,参数说明:title 网站标题;subtitle 网站副标题;description 网站描述,在搜索引擎中可被搜索的信息,可以配置描述关键字;author 作者姓名;language 网站语言;timezone 网站时区;
    
    
    # 默认使用电脑本地时区,可以用时区表指定,如America/New_York,UTC等。
    
    title: Binglumeng's Blog
    subtitle: Just do what you want !
    author: 冰路梦
    language: 
    timezone: 
    
    
    # URL
    
    
    ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
    
    
    # 参数说明:url 网址;root 网址根目录,要是网站存放在子目录,这里就要配置到子目录路径,如url是https://binglumeng.github.io ,而https://binglumeng.github.io/blog才是文件路径,那么root就要设置为/blog/;
    
    
    # permalink 文章永久链接格式,:year/:month/:day/:title/ ;permalink_defaults 永久链接中各部分的默认值。
    
    url: https://binglumeng.github.io/
    
    # root就是网址路径path
    
    root: /binglumeng/
    permalink: :year/:month/:day/:title/
    permalink_defaults:
    
    
    # Directory 目录参数说明:source_dir 资源文件夹,用于存放内容,默认值source;public_dir 公共文件夹,存放生成的站点文件,默认值public;
    
    
    # tag_dir 标签文件夹 默认值tag;archive_dir 归档文件夹 默认值archives;category_dir 分类文件夹,默认值categories;
    
    
    # code_dir include code 文件夹,默认值 downloads/code ;i18n_dir 国际化文件夹 ,默认值 :lang ;skip_render 跳过指定的渲染,可以使用glob表达式来匹配路径。
    
    
    source_dir: source
    public_dir: public
    tag_dir: tags
    archive_dir: i_dont_wanna_use_default_archives
    category_dir: categories
    code_dir: downloads/code
    i18n_dir: :lang
    skip_render:
    
    
    # Writing 文章相关参数:new_post_name 新文章文件名 ,默认值:title.md ;
    
    
    # default_category 预设布局,默认值 post ;
    
    
    # auto_spacing 中英文之间加入空格,默认 false;
    
    
    # titlecase 把标题转换为title case 默认值 false;
    
    
    # external_link 新标签中打开链接 ,默认值 true;
    
    
    # filename_case 把文件名转换为(1)小写或(2)大写。默认值0;
    
    
    # render_drafts 显示草稿,默认值false;
    
    
    # post_asset_folder 启动Asset文件夹,默认值false;
    
    
    # relative_link 把链接改为与根目录的相对路径位置,默认值false;
    
    
    # future 显示未来的文章,默认值true;
    
    
    # highlight 代码块设置
    
    new_post_name: :title.md # File name of new posts
    default_layout: post 
    titlecase: false # Transform title into titlecase
    external_link: true # Open external links in new tab
    filename_case: 0
    render_drafts: false
    post_asset_folder: true
    relative_link: false
    future: true
    highlight:
    enable: true
    line_number: true
    auto_detect: true
    tab_replace:
    
    
    # Category & Tag 分类和标签 ,default_categorty 默认分类,默认值 uncategorized;
    
    
    # category_map 分类别名;tag_map 标签别名
    
    default_category: uncategorized
    category_map:
    tag_map:
    
    
    # Date / Time format 日期时间格式 date_format 日期格式 ,默认是YYYY-MM-DD ;time_format 时间格式 ,H:mm:ss
    
    
    ## Hexo uses Moment.js to parse and display date
    
    
    ## You can customize the date format as defined in
    
    
    ## http://momentjs.com/docs/#/displaying/format/
    
    date_format: YYYY-MM-DD
    time_format: HH:mm:ss
    
    
    # Pagination 分页 per_page 每页显示的文章数,0表示关闭分页。默认值10;
    
    
    # pagination_dir 分页目录,默认值page
    
    
    ## Set per_page to 0 to disable pagination
    
    per_page: 10
    pagination_dir: page
    
    
    # Extensions 扩展,theme 当前主题的名称 ,false表示禁止使用主题。
    
    
    ## Plugins: https://hexo.io/plugins/
    
    
    ## Themes: https://hexo.io/themes/
    
    theme: binglumeng
    
    
    # Deployment 部署的设置
    
    
    ## Docs: https://hexo.io/docs/deployment.html
    
    deploy:
    type: git
    repo: https://github.com/
    branch: master
  • package.json 包信息

指令说明

使用hexo首先要安装node.js和git。本文演示为windows系统下,linux和mac请参照官方文档。

  • init
hexo init [folder] # 在cmd命令下,cd到你所需要建立博客的文件夹,执行此命令,其中folder为可选指令,若不写,则默认当前目录。
  • new
hexo new [layout] <title> # layout为可选项,默认使用_
  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值