{"id":125,"date":"2020-05-01T16:07:29","date_gmt":"2020-05-01T07:07:29","guid":{"rendered":"https:\/\/chen.za.net\/?p=125"},"modified":"2020-05-01T16:14:18","modified_gmt":"2020-05-01T07:14:18","slug":"hexo-common-commands","status":"publish","type":"post","link":"https:\/\/chen.za.net\/?p=125","title":{"rendered":"hexo\u5e38\u7528\u547d\u4ee4\u7b14\u8bb0"},"content":{"rendered":"<article class=\"article fmt article-content\" data-id=\"1190000002632530\" data-license=\"cc\"><span style=\"color: inherit; font-size: 1.95em; font-weight: 600;\">hexo<\/span><\/p>\n<pre class=\"bash hljs\"><code class=\"bash\">npm install hexo -g <span class=\"hljs-comment\">#\u5b89\u88c5  <\/span>\nnpm update hexo -g <span class=\"hljs-comment\">#\u5347\u7ea7  <\/span>\nhexo init <span class=\"hljs-comment\">#\u521d\u59cb\u5316<\/span>\n<\/code><\/pre>\n<h2 id=\"item-2\">\u7b80\u5199<\/h2>\n<p><code>hexo n \"\u6211\u7684\u535a\u5ba2\"<\/code>\u00a0==\u00a0<code>hexo new \"\u6211\u7684\u535a\u5ba2\"<\/code>\u00a0#\u65b0\u5efa\u6587\u7ae0<br \/>\n<code>hexo p<\/code>\u00a0==\u00a0<code>hexo publish<\/code><br \/>\n<code>hexo g<\/code>\u00a0==\u00a0<code>hexo generate<\/code>#\u751f\u6210<br \/>\n<code>hexo s<\/code>\u00a0==\u00a0<code>hexo server<\/code>\u00a0#\u542f\u52a8\u670d\u52a1\u9884\u89c8<br \/>\n<code>hexo d<\/code>\u00a0==\u00a0<code>hexo deploy<\/code>#\u90e8\u7f72<\/p>\n<h2 id=\"item-3\">\u670d\u52a1\u5668<\/h2>\n<p><code>hexo server<\/code>\u00a0#Hexo \u4f1a\u76d1\u89c6\u6587\u4ef6\u53d8\u52a8\u5e76\u81ea\u52a8\u66f4\u65b0\uff0c\u60a8\u65e0\u987b\u91cd\u542f\u670d\u52a1\u5668\u3002<br \/>\n<code>hexo server -s<\/code>\u00a0#\u9759\u6001\u6a21\u5f0f<br \/>\n<code>hexo server -p 5000<\/code>\u00a0#\u66f4\u6539\u7aef\u53e3<br \/>\n<code>hexo server -i 192.168.1.1<\/code>\u00a0#\u81ea\u5b9a\u4e49 IP<\/p>\n<p><code>hexo clean<\/code>\u00a0#\u6e05\u9664\u7f13\u5b58 \u7f51\u9875\u6b63\u5e38\u60c5\u51b5\u4e0b\u53ef\u4ee5\u5ffd\u7565\u6b64\u6761\u547d\u4ee4<br \/>\n<code>hexo g<\/code>\u00a0#\u751f\u6210\u9759\u6001\u7f51\u9875<br \/>\n<code>hexo d<\/code>\u00a0#\u5f00\u59cb\u90e8\u7f72<\/p>\n<h3 id=\"item-3-1\">\u76d1\u89c6\u6587\u4ef6\u53d8\u52a8<\/h3>\n<p><code>hexo generate<\/code>\u00a0#\u4f7f\u7528 Hexo \u751f\u6210\u9759\u6001\u6587\u4ef6\u5feb\u901f\u800c\u4e14\u7b80\u5355<br \/>\n<code>hexo generate --watch<\/code>\u00a0#\u76d1\u89c6\u6587\u4ef6\u53d8\u52a8<\/p>\n<h3 id=\"item-3-2\">\u5b8c\u6210\u540e\u90e8\u7f72<\/h3>\n<blockquote><p>\u4e24\u4e2a\u547d\u4ee4\u7684\u4f5c\u7528\u662f\u76f8\u540c\u7684<br \/>\n<code>hexo generate --deploy<\/code><br \/>\n<code>hexo deploy --generate<\/code><\/p><\/blockquote>\n<p><code>hexo deploy -g<\/code><br \/>\n<code>hexo server -g<\/code><\/p>\n<h2 id=\"item-4\">\u8349\u7a3f<\/h2>\n<p><code>hexo publish [layout] &lt;title&gt;<\/code><\/p>\n<h2 id=\"item-5\">\u6a21\u7248<\/h2>\n<p><code>hexo new \"postName\"<\/code>\u00a0#\u65b0\u5efa\u6587\u7ae0<br \/>\n<code>hexo new page \"pageName\"<\/code>\u00a0#\u65b0\u5efa\u9875\u9762<br \/>\n<code>hexo generate<\/code>\u00a0#\u751f\u6210\u9759\u6001\u9875\u9762\u81f3public\u76ee\u5f55<br \/>\n<code>hexo server<\/code>\u00a0#\u5f00\u542f\u9884\u89c8\u8bbf\u95ee\u7aef\u53e3\uff08\u9ed8\u8ba4\u7aef\u53e34000\uff0c&#8217;ctrl + c&#8217;\u5173\u95edserver\uff09<br \/>\n<code>hexo deploy<\/code>\u00a0#\u5c06.deploy\u76ee\u5f55\u90e8\u7f72\u5230GitHub<\/p>\n<p><code>hexo new [layout] &lt;title&gt;<\/code><br \/>\n<code>hexo new photo \"My Gallery\"<\/code><br \/>\n<code>hexo new \"Hello World\" --lang tw<\/code><\/p>\n<table>\n<thead>\n<tr>\n<th>\u53d8\u91cf<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>layout<\/td>\n<td>\u5e03\u5c40<\/td>\n<\/tr>\n<tr>\n<td>title<\/td>\n<td>\u6807\u9898<\/td>\n<\/tr>\n<tr>\n<td>date<\/td>\n<td>\u6587\u4ef6\u5efa\u7acb\u65e5\u671f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre class=\"hljs yaml\"><code><span class=\"hljs-attr\">title:<\/span> <span class=\"hljs-string\">\u4f7f\u7528Hexo\u642d\u5efa\u4e2a\u4eba\u535a\u5ba2<\/span>\n<span class=\"hljs-attr\">layout:<\/span> <span class=\"hljs-string\">post<\/span>\n<span class=\"hljs-attr\">date:<\/span> <span class=\"hljs-number\">2014<\/span><span class=\"hljs-number\">-03<\/span><span class=\"hljs-number\">-03<\/span> <span class=\"hljs-number\">19<\/span><span class=\"hljs-string\">:07:43<\/span>\n<span class=\"hljs-attr\">comments:<\/span> <span class=\"hljs-literal\">true<\/span>\n<span class=\"hljs-attr\">categories:<\/span> <span class=\"hljs-string\">Blog<\/span>\n<span class=\"hljs-attr\">tags:<\/span> <span class=\"hljs-string\">[Hexo]<\/span>\n<span class=\"hljs-attr\">keywords:<\/span> <span class=\"hljs-string\">Hexo,<\/span> <span class=\"hljs-string\">Blog<\/span>\n<span class=\"hljs-attr\">description:<\/span> <span class=\"hljs-string\">\u751f\u547d\u5728\u4e8e\u6298\u817e\uff0c\u53c8\u628a\u535a\u5ba2\u6298\u817e\u5230Hexo\u4e86\u3002\u7ed9Hexo\u70b9\u8d5e\u3002<\/span>\n<\/code><\/pre>\n<h2 id=\"item-6\">\u6a21\u7248\uff08Scaffold\uff09<\/h2>\n<p><code>hexo new photo \"My Gallery\"<\/code><\/p>\n<table>\n<thead>\n<tr>\n<th>\u53d8\u91cf<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>layout<\/td>\n<td>\u5e03\u5c40<\/td>\n<\/tr>\n<tr>\n<td>title<\/td>\n<td>\u6807\u9898<\/td>\n<\/tr>\n<tr>\n<td>date<\/td>\n<td>\u6587\u4ef6\u5efa\u7acb\u65e5\u671f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"item-7\">\u8bbe\u7f6e\u6587\u7ae0\u6458\u8981<\/h2>\n<pre class=\"hljs xml\"><code>\u4ee5\u4e0a\u662f\u6587\u7ae0\u6458\u8981 <span class=\"hljs-comment\">&lt;!--more--&gt;<\/span> \u4ee5\u4e0b\u662f\u4f59\u4e0b\u5168\u6587 \n<\/code><\/pre>\n<h2 id=\"item-8\">\u5199\u4f5c<\/h2>\n<p><code>hexo new page &lt;title&gt;<\/code><br \/>\n<code>hexo new post &lt;title&gt;<\/code><\/p>\n<table>\n<thead>\n<tr>\n<th>\u53d8\u91cf<\/th>\n<th>\u63cf\u8ff0<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>:title<\/td>\n<td>\u6807\u9898<\/td>\n<\/tr>\n<tr>\n<td>:year<\/td>\n<td>\u5efa\u7acb\u7684\u5e74\u4efd\uff084 \u4f4d\u6570\uff09<\/td>\n<\/tr>\n<tr>\n<td>:month<\/td>\n<td>\u5efa\u7acb\u7684\u6708\u4efd\uff082 \u4f4d\u6570\uff09<\/td>\n<\/tr>\n<tr>\n<td>:i_month<\/td>\n<td>\u5efa\u7acb\u7684\u6708\u4efd\uff08\u53bb\u6389\u5f00\u5934\u7684\u96f6\uff09<\/td>\n<\/tr>\n<tr>\n<td>:day<\/td>\n<td>\u5efa\u7acb\u7684\u65e5\u671f\uff082 \u4f4d\u6570\uff09<\/td>\n<\/tr>\n<tr>\n<td>:i_day<\/td>\n<td>\u5efa\u7acb\u7684\u65e5\u671f\uff08\u53bb\u6389\u5f00\u5934\u7684\u96f6\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3 id=\"item-8-3\">\u63a8\u9001\u5230\u670d\u52a1\u5668\u4e0a<\/h3>\n<p><code>hexo n<\/code>\u00a0#\u5199\u6587\u7ae0<br \/>\n<code>hexo g<\/code>\u00a0#\u751f\u6210<br \/>\n<code>hexo d<\/code>\u00a0#\u90e8\u7f72 #\u53ef\u4e0e<code>hexo g<\/code>\u5408\u5e76\u4e3a\u00a0<code>hexo d -g<\/code><\/p>\n<h2 id=\"item-9\">\u62a5\u9519<\/h2>\n<h3 id=\"item-9-4\">1.\u627e\u4e0d\u5230git\u90e8\u7f72<\/h3>\n<pre class=\"hljs yaml\"><code><span class=\"hljs-attr\">ERROR Deployer not found:<\/span> <span class=\"hljs-string\">git<\/span>\n<\/code><\/pre>\n<p><strong>\u89e3\u51b3\u65b9\u6cd5<\/strong><\/p>\n<p><code>npm install hexo-deployer-git --save<\/code><\/p>\n<h3 id=\"item-9-5\">3.\u90e8\u7f72\u7c7b\u578b\u8bbe\u7f6egit<\/h3>\n<p>hexo 3.0 \u90e8\u7f72\u7c7b\u578b\u4e0d\u518d\u662f<code>github<\/code>\uff0c<code>_config.yml<\/code>\u00a0\u4e2d\u4fee\u6539<\/p>\n<pre class=\"bash hljs\"><code class=\"bash\"><span class=\"hljs-comment\"># Deployment<\/span>\n<span class=\"hljs-comment\">## Docs: http:\/\/hexo.io\/docs\/deployment.html<\/span>\ndeploy:\n  <span class=\"hljs-built_in\">type<\/span>: git\n  repository: git@***.github.com:***\/***.github.io.git\n  branch: master\n<\/code><\/pre>\n<h3 id=\"item-9-6\">4. xcodebuild<\/h3>\n<p>xcode-select: error: tool &#8216;xcodebuild&#8217; requires Xcode, but active developer directory &#8216;\/Library\/Developer\/CommandLineTools&#8217; is a command line tools instance<\/p>\n<p><code>npm install bcrypt<\/code><\/p>\n<h3 id=\"item-9-7\">5. RSS\u4e0d\u663e\u793a<\/h3>\n<h4>\u5b89\u88c5RSS\u63d2\u4ef6<\/h4>\n<p><code>npm install hexo-generator-feed --save<\/code><\/p>\n<h4>\u5f00\u542fRSS\u529f\u80fd<\/h4>\n<p>\u7f16\u8f91hexo\/_config.yml\uff0c\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre class=\"hljs yaml\"><code><span class=\"hljs-attr\">rss:<\/span> <span class=\"hljs-string\">\/atom.xml<\/span> <span class=\"hljs-comment\">#rss\u5730\u5740  \u9ed8\u8ba4\u5373\u53ef<\/span>\n<\/code><\/pre>\n<pre class=\"xml hljs\"><code class=\"html\">\n<\/code><\/pre>\n<\/article>\n<div class=\"d-none d-lg-block\">\n<div id=\"OA_holder_3\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>hexo npm install hexo -g #\u5b89\u88c5 npm update hexo -g #\u5347\u7ea7 hex [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-125","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/chen.za.net\/index.php?rest_route=\/wp\/v2\/posts\/125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chen.za.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chen.za.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chen.za.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chen.za.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=125"}],"version-history":[{"count":0,"href":"https:\/\/chen.za.net\/index.php?rest_route=\/wp\/v2\/posts\/125\/revisions"}],"wp:attachment":[{"href":"https:\/\/chen.za.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chen.za.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chen.za.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}