I made a blog with hexo
and wrote an article in markdown. I ran hexo server
and saw the changes on localhost:4000, but when I ran hexo generate
and tried to open the index.html
file in the public/
folder, it appeared completely barebones
Isn't the publish
folder supposed to resemble the localhost:4000
site?
Here are the steps to make it work:
As stated in the docs, run these commands to start a new blog:
$ npm install hexo-cli -g
$ hexo init blog
$ cd blog
$ npm install
$ hexo server
At this point your site will be running with the dev server.
Now shut down the dev server and use
$ hexo generate
to generate the source files (in the /public
folder)
At this point, if you simply open the index.html in Chrome (or any other browser), it won't work because the paths to the external resources are broken.
You need to host the files on a web server of some sort. If you don't already have apache running somewhere on your machine, here is a quick way to run a node static web server:
$ npm -g install static-server
will install a simple http server to serve static resource files from a local directory.
then navigate to your public folder:
$ cd public
and start off the web server:
$ static-server
Open your browser at http://localhost:9080
and your site should be up and running.