hexo进阶

修改局部页面

页面展现的全部逻辑都在每个主题中控制,源代码在hexo\themes\jacman\中:

.
├── languages  #多语言|   ├── default.yml#默认语言|   └── zh-CN.yml  #中文语言├── layout #布局,根目录下的*.ejs文件是对主页,分页,存档等的控制|   ├── _partial   #局部的布局,此目录下的*.ejs是对头尾等局部的控制|   └── _widget#小挂件的布局,页面下方小挂件的控制├── source #源码|   ├── css#css源码 |   |   ├── _base  #*.styl基础css|   |   ├── _partial   #*.styl局部css|   |   ├── fonts  #字体|   |   ├── images #图片|   |   └── style.styl #*.styl引入需要的css源码|   ├── fancybox   #fancybox效果源码|   └── js #javascript源代码├── _config.yml#主题配置文件└── README.md

 

发表新文章

用hexo发表新文章

$ hexo n #写文章

其中my new post为文章标题,执行命令后,会在项目\source_posts中生成my new post.md文件,用编辑器打开编写即可。

也可以直接在\source_posts中新建一个md文件。

写完后,执行

$ hexo g #生成$ hexo d #部署 # 可与hexo g合并为 hexo d -g

用Hexo发表文章的Markdown语法

使用jacman或pacman主题,建议按此标准语法写:

title: postName #文章页面上的显示名称,可以任意修改,不会出现在URL中date: 2013-12-02 15:30:16 #文章生成时间,一般不改,当然也可以任意修改categories: example #分类tags: [tag1,tag2,tag3] #文章标签,可空,多标签请用格式,注意:后面有个空格description: 附加一段文章摘要,字数最好在140字以内。
---

以下正文

Hexo命令

常用命令:

hexo new "postName" #新建文章hexo new page "pageName" #新建页面hexo generate #生成静态页面至public目录hexo server #开启预览访问端口(默认端口4000,'ctrl + c'关闭server)hexo deploy #将.deploy目录部署到GitHub

常用复合命令:

hexo d -g #生成加部署hexo s -g #预览加部署

简写:

hexo n == hexo newhexo g == hexo generate
hexo s == hexo server
hexo d == hexo deploy

安装插件

添加sitemap和feed插件

$ npm install hexo-generator-sitemap
$ npm install hexo-generator-feed

修改_config.yml,增加以下内容

# ExtensionsPlugins:- hexo-generator-feed
- hexo-generator-sitemap#Feed Atomfeed:
  type: atom
  path: atom.xml
  limit: 20#sitemapsitemap:
  path: sitemap.xml


参考链接:http://www.jianshu.com/p/05289a4bc8b2/


你可能感兴趣的:(Hero)