Hexo
Doc
- Doc
- Restart hexo server, each time changed yml file
NEW BLOG PROJECT
hexo init blog_project_namePOST
creating a post
# under blog folder to create a new post with name a.md
hexo new aDRAFT
create a new draft
hexo new draft btest draft
hexo server --draftpublish the draft
# move b from _drafts folder to _posts folder
hexo publish bPAGE
hexo new page c- to access the page c “http://localhost:4000/about/”
SCAFFOLDS
For handling default content
- create a new file within scafoolds. e.g. giraffe.md
title: {{ title }} // title within curly brace here are just placeholder
date: {{ date }}
layout: {{ layout }}- create new post with template giraffe
hexo new giraffe fTags & Categories
Within _posts folder a.md file
---
tags: [Tag1, Tag2, Tag3]
categories:
- [Cat1, Cat1.1]
- [Cat2]
- [Cat3]
---Tag Plugins
Code Block
{% codeblock lang:c++ %}
{% endcodeblock %}Youtube
{% youtube AnyYoutubeID %}Asset folders
use hexo syntax for img: second priority
_config.ymlpost_asset_folder: trueThen next time we create new post with hexo command line, it will also create a asset folderaalong witha.md
- Notice: jpg works, png not works
# within a.md
{% asset_img testdel.jpg Image Title Here %}
{% asset_link testdel.jpg %}
{% asset_path testdel.jpg %}use markdown syntax for img: first priority
# _config.yml
post_asset_folder: true
marked:
prependRoot: true
postAsset: true- Notice: create an additional folder for reference and convinence
Official Theme
Clone github to themes folder
theme: change the name here to theme-folder's nameThen restart hexo server
Creating a theme
- file
layout.ejsis the overview of the structure
partial
partial can make process modular
- create
partialfolder, and a fileheader.ejs
# within layout.ejs
# title is the parameter
<body>
<%- parital('partial/header', {title: 'red'}) %>
</body># within partial/header.ejs
# to get the parameter
<%= title %>