Hexo Commands
Hexo Server
Starts the server running.
* Note you must be in the directory you initialized.
* Hexo server default location is http://localhost:4000/
Hexo Init {folder}
This is a command to create a website. This took about a minute, and then spit out more than the
cmd buffer could hold. In reality it created a folder with a few folders
Ideally, you change directory to the folder that you just created, and you start building
your website from that directory. (for example the next command is to create a blog page
using ‘new’)
Ex Hexo init c:\d\hexo\take1
This took about a minute to run, but upon completion I found a directory structure underneith c:\d\hexo\take1
Tips
- start with a directory that is easy to navigate to, since you do a lot of work in the command window.
Hexo new [layout] {title}
Creates a new page for the website.
Where
Layout can have one of following values
- Post - path is source/_posts
- Page - page is source
- Draft - path is source/_drafts ** Use this version
title
- use quotes if you have spaces
- Use proper casing “hexo notes” shows up as header 1 when published
- for multiword titles surround the text in Quotes -
Ex hexo new draft “hexo notes”
Use the markdown language
Do not use header 1, the hexo server presents the title this way
What happened is it created a file in the _drafts folder named “hexo-notes.md”
Editing a draft
notepad source/_drafts/{title}
Editing something that has been published
notepad source/_posts/{title}
Hexo publish [layout] {title}
Publishes a draft. I think this means copy the draft file I’m working on into the hexo server area.
Ex hexo publish draft “hexo notes”
- What I found was it moved the hexo-notes.md file out of _drafts into _posts
- When I navigated to http://localhost:4000/ I found the top of this page had the hexo notes header.
Hexo Generate
Build the website. This generates the static files needed for the website. It appears that it only generates changes needed to update the cached website.
Hmm, not sure what this does, but I do not see my sample 2 page listed.
9/21/2016 - Now that I have several pages what I did was deleted a few of the older sample pages.
Pressing refresh (on localhost 4000) did not hide those pages. But when I executed the Hexo Generate
statement it freshened the home page. So I am guessing that this function rebuilds all pages in
the website. But it only generates files that are obsolete or needs to be generated.
9/26/2016 - If you have “Hexo-Local-Search” installed, then the search.xml file will be rebuilt with this step.
Hexo deploy
Hexo deploy –generate
Copy files from local hexo server area to the area specified in the url:, root: parameters of the _config.yml file.
Hexo version
Provides version information
Hexo Server
- To use this command you must have installed the server add-in using “NPM install hexo-server –save”
Starts the server running.
• Note you must be in the directory you initialized.
• Hexo server default location is http://localhost:4000/
At this point you can use IE to browse to the website shown in the window.
http://localhost:4000
This is how you test.
Press Control C to shut down the server