Using hexo-theme-melody and Travis CI to build a beautiful hexo blog in a fast and with-version-control way.
Do all things on source
branch.
- Fork this repo, rename it to
your-username.github.io
andgit clone
to your computer. - Delete
source/CNAME
or change its content to your own custom domain. - Delete the
source/_drafts/
andsource/_posts/
folders. - Modify other configurations as needed, especially
_config.yml
in the root folder and thesource/_data/melody.yml
(Follow the hexo-theme-melody-doc). - Modify
.travis.yml
and.gitlab-ci.yml
for continuous integration build your blog. See this post for more information. - Sync and activate your repo on https://travis-ci.com/.
For security, we should not publish our personal API keys on GitHub repo.
-
GH_TOKEN
-
GL_TOKEN
(only if you use GitLab) -
Algolia search(only if you use Algolia)
See hexo-algoliasearch/lib/algolia.js
You need four environment variables:
ALGOLIA_APP_ID
,ALGOLIA_API_KEY
,ALGOLIA_ADMIN_API_KEY
andALGOLIA_INDEX_NAME
.
Configure them in Travis settings like below:
-
Write a post
$ hexo new post my-first-post ... writing...
-
deploy to the origin
./deploy.sh "Added: my first post"
or just
./deploy.sh
which is equivalent to
./deploy.sh "Updated: blog source"