hexo個人ブログ構築
7085 ワード
Hexoはgithubベースのブログシステムで、markdownを使用して文章の内容を書く.ブログ構築の主な作業を記録します.
1.インストール環境
Hexo足場 を取り付ける初期化サイトは、新しいファイルプラスを作成し、コマンドラインを使用してアクセスします.次のコマンド を実行します.
ローカルブログシステムが構築されました 2.3サイトディレクトリ 共通コマンド .
3.サイト最適化
新規分類ページ ページにタイプを追加してsource->categories->indexに入ります.md テンプレート追加分類scarffolds->postを開きます.md
このように文章を新規作成するとこの属性があり,分類を記入することで文章分類機能を実現できる.
新規ラベル ページにラベル属性を追加source->tags->indexを開きます.md
4.GitHubへの配備
を作成する. settingにGitHub Pagesオプション を追加ローカル同期がオンになります.->config.yml、配置パス を追加
注意:コロンの後に のスペースがあります倉庫を先に関連付け、ssh を配置する必要がある.
コマンド
注:エラー
の場合、実行
そしてもう一度やってみます.
テーマ編
Muse(デフォルト) Mist Pisces Gemini注釈その他、欲しいスタイル を残します
2.Menuの設定(一番上のボタン)
本のディレクトリの下 グローバル
Nextを開く本のディレクトリの下 本のディレクトリ
next
トップページの非表示部分(クリックして詳細を表示)
1.インストール環境
1.1 git
git --version
gitバージョンの表示
1.2 node
node -v
nodeバージョンの表示
2.Hexoを初歩的に取り付ける
npm install -g hexo-cli
hexo init
cd
npm install
ローカルブログシステムが構築されました
.
├── _config.yml // , 、 、 、 、 。
├── package.json// , 。
├── scaffolds// , : (posts)、 (page)、 (draft)。
├── source// , tags( )、categories( )
| ├── _drafts// ( )
| └── _posts// ( )
└── themes//
hexo n
新規記事hexo clean
キャッシュhexo g
生成静的ページhexo s
ローカルサーバを起動し、ローカル表示効果hexo d
をWebサイト上に配置する3.サイト最適化
3.1分類
hexo new page categories
---
title:
date: 2019-04-22 12:25:30
type: "categories" #
---
---
title: {{ title }}
date: {{ date }}
categories:
tags:
---
このように文章を新規作成するとこの属性があり,分類を記入することで文章分類機能を実現できる.
3.2ラベル
hexo new page tags
---
title: tags
date: 2019-04-23 00:13:22
type: "tags" #
---
3.3分類とラベルの使用
layout: posts
title:
date: 2019-04-23 00:17:41
categories:
tags: [node.js, java]
4.GitHubへの配備
github:
.github.io
の倉庫deploy:
type: git
repo: [email protected]:yourName/yourName.github.io.git
branch: master
注意:
コマンド
hexo g
hexo d
を使用して生成を完了し、yourName.github.io
をプッシュします.注:エラー
error deployer not found:github
の場合、実行
npm install --save hexo-deployer-git
そしてもう一度やってみます.
テーマ編
1.NEXTのインストール
nextはhexoのテーマで、公式サイトをクリックしてマルチ(evenテーマも悪くない)を見ることもできます.
インストールトピックはnextのプロジェクトcloneをルートディレクトリの下themes/nextにのみ使用します.git clone https://github.com/theme-next/hexo-theme-next themes/next
次に、構成を変更nextトピックを有効にするルートディレクトリの下_config.yml
を変更します.theme: next
nextの_config.yml
ではnextのスタイルを4つ修正できます.公式サイトで事例を見ることができます
nextはhexoのテーマで、公式サイトをクリックしてマルチ(evenテーマも悪くない)を見ることもできます.
インストールトピックはnextのプロジェクトcloneをルートディレクトリの下themes/nextにのみ使用します.
git clone https://github.com/theme-next/hexo-theme-next themes/next
次に、構成を変更nextトピックを有効にするルートディレクトリの下
_config.yml
を変更します.theme: next
nextの
_config.yml
ではnextのスタイルを4つ修正できます.公式サイトで事例を見ることができます# Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
scheme: Gemini
2.Menuの設定(一番上のボタン) themes/next/_config.yml
menu:
home: / || home #
about: /about/ || user #
tags: /tags/ || tags #
categories: /categories/ || th #
archives: /archives/ || archive #
3.githubストラップ
fork me on githubのボタンをクリックし、GitHub Cornersでストラップを選択し、themes/next/layout/_layout.swig
の
の下に追加します.コードのhttps//your-url
を自分のgitホームページに変更します.
4.ハイパーリンクcssスタイルの変更 themes/next/source/css/_common/components/post/post.styl
末尾追加.post-body p a{
color: #0593d3; //
border-bottom: none;
border-bottom: 1px solid #0593d3; //
&:hover {
color: #fc6423; //
border-bottom: none;
border-bottom: 1px solid #fc6423; //
}
}
5.アバターと動画の設定
テーマディレクトリ_config.yml
に追加(Sidebar Avatar
を検索)//
avatar: [ http://....]
アバターフィレット回転/themes/next/source/css/_common/components/sidebar/sidebar-author.styl
追加.site-author-image {
display: block;
margin: 0 auto;
padding: $site-author-image-padding;
max-width: $site-author-image-width;
height: $site-author-image-height;
border: $site-author-image-border-width solid $site-author-image-border-color;
/* */
border-radius: 80px;
-webkit-border-radius: 80px;
-moz-border-radius: 80px;
box-shadow: inset 0 -1px 0 #333sf;
/* [animation: (play) (2s) (ase-out)
(1s) 1 (1) (infinite ) ]*/
/* 360 */
-webkit-transition: -webkit-transform 1.0s ease-out;
-moz-transition: -moz-transform 1.0s ease-out;
transition: transform 1.0s ease-out;
}
img:hover {
/*
-webkit-animation-play-state:paused;
animation-play-state:paused;*/
/* 360 */
-webkit-transform: rotateZ(360deg);
-moz-transform: rotateZ(360deg);
transform: rotateZ(360deg);
}
/* Z */
@-webkit-keyframes play {
0% {
-webkit-transform: rotateZ(0deg);
}
100% {
-webkit-transform: rotateZ(-360deg);
}
}
@-moz-keyframes play {
0% {
-moz-transform: rotateZ(0deg);
}
100% {
-moz-transform: rotateZ(-360deg);
}
}
@keyframes play {
0% {
transform: rotateZ(0deg);
}
100% {
transform: rotateZ(-360deg);
}
}
6.コードブロックスタイル themes
ext\source\css\_custom\custom.styl
追加code {
color: #ff7600;
background: #fbf7f8;
margin: 2px;
}
//
.highlight, pre {
margin: 5px 0;
padding: 5px;
border-radius: 3px;
}
.highlight, code, pre {
border: 1px solid #d6d6d6;
}
7.SNSアイコン next/_config.yml
のSocial
[ ]: [ ] || [ ]
//github 、heartbeat( )、spinner( )...( )
アイコンはFont Awesome Icon
8.RSS
menu:
home: / || home #
about: /about/ || user #
tags: /tags/ || tags #
categories: /categories/ || th #
archives: /archives/ || archive #
fork me on githubのボタンをクリックし、GitHub Cornersでストラップを選択し、
themes/next/layout/_layout.swig
の
の下に追加します.コードのhttps//your-url
を自分のgitホームページに変更します.4.ハイパーリンクcssスタイルの変更 themes/next/source/css/_common/components/post/post.styl
末尾追加.post-body p a{
color: #0593d3; //
border-bottom: none;
border-bottom: 1px solid #0593d3; //
&:hover {
color: #fc6423; //
border-bottom: none;
border-bottom: 1px solid #fc6423; //
}
}
5.アバターと動画の設定
テーマディレクトリ_config.yml
に追加(Sidebar Avatar
を検索)//
avatar: [ http://....]
アバターフィレット回転/themes/next/source/css/_common/components/sidebar/sidebar-author.styl
追加.site-author-image {
display: block;
margin: 0 auto;
padding: $site-author-image-padding;
max-width: $site-author-image-width;
height: $site-author-image-height;
border: $site-author-image-border-width solid $site-author-image-border-color;
/* */
border-radius: 80px;
-webkit-border-radius: 80px;
-moz-border-radius: 80px;
box-shadow: inset 0 -1px 0 #333sf;
/* [animation: (play) (2s) (ase-out)
(1s) 1 (1) (infinite ) ]*/
/* 360 */
-webkit-transition: -webkit-transform 1.0s ease-out;
-moz-transition: -moz-transform 1.0s ease-out;
transition: transform 1.0s ease-out;
}
img:hover {
/*
-webkit-animation-play-state:paused;
animation-play-state:paused;*/
/* 360 */
-webkit-transform: rotateZ(360deg);
-moz-transform: rotateZ(360deg);
transform: rotateZ(360deg);
}
/* Z */
@-webkit-keyframes play {
0% {
-webkit-transform: rotateZ(0deg);
}
100% {
-webkit-transform: rotateZ(-360deg);
}
}
@-moz-keyframes play {
0% {
-moz-transform: rotateZ(0deg);
}
100% {
-moz-transform: rotateZ(-360deg);
}
}
@keyframes play {
0% {
transform: rotateZ(0deg);
}
100% {
transform: rotateZ(-360deg);
}
}
6.コードブロックスタイル themes
ext\source\css\_custom\custom.styl
追加code {
color: #ff7600;
background: #fbf7f8;
margin: 2px;
}
//
.highlight, pre {
margin: 5px 0;
padding: 5px;
border-radius: 3px;
}
.highlight, code, pre {
border: 1px solid #d6d6d6;
}
7.SNSアイコン next/_config.yml
のSocial
[ ]: [ ] || [ ]
//github 、heartbeat( )、spinner( )...( )
アイコンはFont Awesome Icon
8.RSS
.post-body p a{
color: #0593d3; //
border-bottom: none;
border-bottom: 1px solid #0593d3; //
&:hover {
color: #fc6423; //
border-bottom: none;
border-bottom: 1px solid #fc6423; //
}
}
テーマディレクトリ
_config.yml
に追加(Sidebar Avatar
を検索)//
avatar: [ http://....]
アバターフィレット回転
/themes/next/source/css/_common/components/sidebar/sidebar-author.styl
追加.site-author-image {
display: block;
margin: 0 auto;
padding: $site-author-image-padding;
max-width: $site-author-image-width;
height: $site-author-image-height;
border: $site-author-image-border-width solid $site-author-image-border-color;
/* */
border-radius: 80px;
-webkit-border-radius: 80px;
-moz-border-radius: 80px;
box-shadow: inset 0 -1px 0 #333sf;
/* [animation: (play) (2s) (ase-out)
(1s) 1 (1) (infinite ) ]*/
/* 360 */
-webkit-transition: -webkit-transform 1.0s ease-out;
-moz-transition: -moz-transform 1.0s ease-out;
transition: transform 1.0s ease-out;
}
img:hover {
/*
-webkit-animation-play-state:paused;
animation-play-state:paused;*/
/* 360 */
-webkit-transform: rotateZ(360deg);
-moz-transform: rotateZ(360deg);
transform: rotateZ(360deg);
}
/* Z */
@-webkit-keyframes play {
0% {
-webkit-transform: rotateZ(0deg);
}
100% {
-webkit-transform: rotateZ(-360deg);
}
}
@-moz-keyframes play {
0% {
-moz-transform: rotateZ(0deg);
}
100% {
-moz-transform: rotateZ(-360deg);
}
}
@keyframes play {
0% {
transform: rotateZ(0deg);
}
100% {
transform: rotateZ(-360deg);
}
}
6.コードブロックスタイル themes
ext\source\css\_custom\custom.styl
追加code {
color: #ff7600;
background: #fbf7f8;
margin: 2px;
}
//
.highlight, pre {
margin: 5px 0;
padding: 5px;
border-radius: 3px;
}
.highlight, code, pre {
border: 1px solid #d6d6d6;
}
7.SNSアイコン next/_config.yml
のSocial
[ ]: [ ] || [ ]
//github 、heartbeat( )、spinner( )...( )
アイコンはFont Awesome Icon
8.RSS
ext\source\css\_custom\custom.styl
code {
color: #ff7600;
background: #fbf7f8;
margin: 2px;
}
//
.highlight, pre {
margin: 5px 0;
padding: 5px;
border-radius: 3px;
}
.highlight, code, pre {
border: 1px solid #d6d6d6;
}
next/_config.yml
のSocial
[ ]: [ ] || [ ]
//github 、heartbeat( )、spinner( )...( )
アイコンはFont Awesome Icon
8.RSS
npm install --save hexo-generator-feed
_config.yml
末尾追加# Extensions
## Plugins: http://hexo.io/plugins/
plugins: hexo-generate-feed
Nextを開く
_config.yml
のrss:
構成rss: /atom.xml
9.検索機能
npm install hexo-generator-search --save
_config.yml
のうち# Search
search:
path: ./public/search.xml
field: post # (page、all)
format: html
limit: 10000 #
next
_config.yml
local_search:
enable: true # true
trigger: auto
top_n_per_article: 1 # , -1 。
トップページの非表示部分(クリックして詳細を表示)
nextプロファイル# Automatically Excerpt. Not recommand.
# Please use in the post to control excerpt accurately.
auto_excerpt:
enable: false
length: 150
簡易化構築 HEXO Portable
分ブログを作成
# Automatically Excerpt. Not recommand.
# Please use in the post to control excerpt accurately.
auto_excerpt:
enable: false
length: 150
HEXO Portable
分ブログを作成