基于GithubHexo的个人博客搭建过程 (2)

站点配置文件详细配置示例

# Hexo Configuration ## Docs: https://hexo.io/docs/configuration.html ## Source: https://github.com/hexojs/hexo/ # Site 这里的配置,哪项配置反映在哪里,可以参考我的博客 title: xxx # 博客的名字,也称站点名称 subtitle: xxx # 副标题 description: xxx # 对站点的描述,搜索引擎会抓取,可以自定义 author: xxx # 作者名字 language: zh-Hans # 语言 简体中文 timezone: # 用默认的即可 # URL # 这项暂时不需要配置,绑定域名后,要创建 sitemap.xml 时再配置该项 ## If your site is put in a subdirectory, set url as \'http://yoursite.com/child\' and root as \'/child/\' url: # root: / permalink: :year/:month/:day/:title/ permalink_defaults: # Directory # 目录,不要修改 source_dir: source public_dir: public tag_dir: tags archive_dir: archives category_dir: categories code_dir: downloads/code i18n_dir: :lang skip_render: # Writing # 文章布局、写作格式的定义,不修改 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: false relative_link: false future: true highlight: enable: true line_number: true auto_detect: false tab_replace: # Category & Tag default_category: uncategorized category_map: tag_map: # Date / Time format # 日期 / 时间 格式,不要修改 ## Hexo uses Moment.js to parse and display date ## You can customize the date format as defined in ## #/displaying/format/ date_format: MMM D YYYY time_format: H:mm:ss # Pagination # 每页显示文章数,可以自定义 ## Set per_page to 0 to disable pagination per_page: 10 pagination_dir: page # Extensions # 配置站点所用主题和插件,这里将默认主题注释,修改为 next ## Plugins: https://hexo.io/plugins/ ## Themes: https://hexo.io/themes/ theme: next #theme: landscape # 头像 # 注意:是 xxx.github.io/source 下的开始的相对路径,如果 source 文件夹下面没有 uploads 文件夹,那么新建一个。考虑到会博客中用很多图片,在 uploads 文件夹下请分好类,避免混乱 avatar: /uploads/images/avatar.jpg # Deployment # 本地博客部署到 github 上要配置这里 ## Docs: https://hexo.io/docs/deployment.html deploy: type: git # 使用 Git 提交 repository: https://github.com/xxx/xxx.github.io.git # 就是存放博客的仓库地址

下面是我自己的文件详细配置:Daotin.github.io/_config.yml文件

# Hexo Configuration ## Docs: https://hexo.io/docs/configuration.html ## Source: https://github.com/hexojs/hexo/ # Site title: Daotin\'s Home subtitle: 说好的幸福呢 description: 每天进步一点点 author: Daotin language: zh-Hans timezone: # URL ## If your site is put in a subdirectory, set url as \'http://yoursite.com/child\' and root as \'/child/\' url: root: / permalink: :year/:month/:day/:title/ permalink_defaults: # Directory source_dir: source public_dir: public tag_dir: tags archive_dir: archives category_dir: categories code_dir: downloads/code i18n_dir: :lang skip_render: # Writing 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: false relative_link: false future: true highlight: enable: true line_number: true auto_detect: false tab_replace: # Home page setting # path: Root path for your blogs index page. (default = \'\') # per_page: Posts displayed per page. (0 = disable pagination) # order_by: Posts order. (Order by date descending by default) index_generator: path: \'\' per_page: 10 order_by: -date # Category & Tag default_category: uncategorized category_map: tag_map: # Date / Time format ## Hexo uses Moment.js to parse and display date ## You can customize the date format as defined in ## #/displaying/format/ date_format: YYYY-MM-DD time_format: HH:mm:ss # Pagination ## Set per_page to 0 to disable pagination per_page: 10 pagination_dir: page # Extensions ## Plugins: https://hexo.io/plugins/ ## Themes: https://hexo.io/themes/ theme: next #theme: landscape # 头像 # 注意:是 xxx.github.io/source 下的开始的相对路径,如果 source 文件夹下面没有 uploads 文件夹,那么新建一个。考虑到会博客中用很多图片,在 uploads 文件夹下请分好类,避免混乱 avatar: /uploads/touxiang/touxiang.jpg # Deployment ## Docs: https://hexo.io/docs/deployment.html deploy: type: git repository: https://github.com/Daotin/Daotin.github.io.git

以上基本本地博客就已经搭建好了,我们可以先看看效果:

在 cmd 下定位到 xxx.github.io 目录,输入命令:

$ hexo s // hexo server

启动成功可以看到提示,按照提示用浏览器打开提示网址 :4000/ ,即可看到你的本地博客了,里面有一篇系统自带的 Hello World 文章.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzpwjg.html