How do I add a README.md file into the root directory of the generated blog by HEXO?

对着背影说爱祢 提交于 2020-01-02 19:48:12

问题


My blog is based on Github Pages and the program I'm using is HEXO

the files that are generated by HEXO don't contain a README.md file so I can't make a declaration of my blog on Github repo page.So I want to add a README.md file to the folder that HEXO generates.I've tried that add it manually to the folder after using $ HEXO g and it is added to successfully.But the problem is that every time I use $ HEXO g,the file I added will be deleted by the program.
So I want to that is there any method that make the HEXO program generate a README.md file to the blog's root directory automatically everytime I run $ HEXO g?
thanks everybody.


回答1:


I have write a blog to show how to add README.md to hexo and how to keep all .md files in hexo (for version control), but it's in chinese. :)

At first, you need put README.md under source folder, but it's not enough.

In _config.yml, there is a field called skip_render (if it's not exist, create it), you must declare README.md or any other files that need to keep its original format under source folder after this filed, like this:

skip_render: README.md

if you want to keep more than one file, do like this:

skip_render: [README.md, ori_data/*, ori_data/posts/*, ori_data/tags/*, ori_data/categories/*, ori_data/themes/next/*]

my folder tree is like this:

D:\hexo_blog>tree source /F
D:\HEXO_BLOG\SOURCE
│  README.md
│
├─categories
│      index.md
│
├─ori_data
│  │  config.yml
│  │
│  ├─categories
│  │      index.md
│  │
│  ├─posts
│  │      2013-02-05-my-blog-in-github.md
│  │      2013-02-06-resolve-goagent-cp65001.m
│  │      2013-03-11-c_stack.md
│  │      2015-05-03-hello-hexo.md
│  │
│  ├─tags
│  │      index.md
│  │
│  └─themes
│      └─next
│              config.yml
│
├─tags
│      index.md
│
└─_posts
        2013-02-05-my-blog-in-github.md
        2013-02-06-resolve-goagent-cp65001.md
        2013-03-11-c_stack.md
        2013-03-18-understand_typdef_funp.md
        2013-03-24-understand_container_of.md
        2015-05-03-hello-hexo.md

some notices: the file that want to keep origin format must not start with '_', else it will be ignored when 'hexo generate'.

BTW: I used hexo 3.0.1.




回答2:


Did you tried to create your file in sources folder ? See EXO doc

Edit: you can also try Jekyll




回答3:


You can use README.mdown file in your source directory :)




回答4:


Hexo has its own repositories in you github page.

You don't have to add readme.md by using hexo command.

Just go to that repositories page, and you'll a hint said "Help people interested in this repository understand your project by adding a README!".

There's a button next to it. Click and begin to Write



来源:https://stackoverflow.com/questions/25258660/how-do-i-add-a-readme-md-file-into-the-root-directory-of-the-generated-blog-by-h

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!