本文介绍了如何通过HEXO将README.md文件添加到生成的博客的根目录中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的博客基于Github Pages,而我正在使用的程序是HEXO

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

HEXO生成的文件不包含README.md文件,因此无法在Github存储库页面上声明博客.因此,我想将README.md文件添加到该文件夹​​中HEXO生成的文件.我尝试使用$ HEXO g后将其手动添加到文件夹中,然后成功添加到文件夹中.但是问题是,每次使用$ HEXO g时,添加的文件都会被删除该程序.
因此,我想知道是否有任何方法可以使HEXO程序在每次运行$ HEXO g时自动生成一个README.md文件到博客的根目录?谢谢大家.

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.

推荐答案

我写了一个博客显示如何将README.md添加到hexo,以及如何将所有.md文件保留在hexo中(用于版本控制),但这是中文. :)

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. :)

首先,您需要将README.md放在 source 文件夹下,但这还不够.

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

_config.yml 中,有一个名为skip_render的字段(如果不存在,请创建它),您必须声明README.md或任何其他需要保留其原始格式的文件归档后在源文件夹下,如下所示:

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

一些注意事项:要保留原始格式的文件不能以"_"开头,否则在"hexo generate"时将被忽略.

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

顺便说一句:我用的是hexo 3.0.1.

BTW: I used hexo 3.0.1.

这篇关于如何通过HEXO将README.md文件添加到生成的博客的根目录中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 03:40