github-pageshexo

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


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.


Solution

  • 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.