四十五、Gtihub+Hexo+icarus搭建自己的博客

网友投稿 613 2022-05-30

最近我看了hexo的主题,发现了很多好看的主题。很多人的博客就是用别人的主题,搞出来的。之前我的博客发现真的是太难看了,然后没有去维护。那个时候不知道没有关系,今天我知道了,就是把之前删除了。

我在茫茫的主题中发现了它,这个就是大神开发的:https://shen-yu.gitee.io/

对应的Github:https://github.com/Shen-Yu/hexo-theme-ayer

我先去给大神Star了,这个大神牛逼。百度发现教程不足,搭建起来头疼。遇到问题,Github上又没有解释。

最后决定用icarus,好像很多人用这个主题

文章目录

开干

修改主题

配置主题

项目配置

写文章

开干

在本地创建一个博客目录

hexo init blog

1

上面这个命令执行完后,会在本地创建一个 blog 目录,然后进入到这个目录中,执行 npm install 命令,安装相关的依赖。

现在去_config.yml文件中,做网站的一些基本配置, 网站的 title,描述,关键字、图标等,这些配置搞定。如下

# Site title: 'Python之王' subtitle: 'Python之王' description: '人生最重要的不是所站的位置,而是内心所朝的方向。只要我在每篇博文中写得自己体会,修炼身心;在每天的不断重复学习中,耐住寂寞,练就真功,不畏艰难,奋勇前行,不忘初心,砥砺前行,人生定会有所收获,不留遗憾...' keywords: 'Python, Java, 机器学习, 爬虫, 前端, Spring家族, 人工智能' author: 'Runsen' language: en timezone: ''

1

2

3

4

5

6

7

8

配置完成后,定位到 blog 目录,执行hexo s就可以在本地启动项目了,浏览器中输入 http://localhost:4000 就可以看到网站了,就是那个最难看的页面。

补充下hexo的命令

新建GIthub项目,创建 {username}.GIthub.io 的仓库,

修改主题

Hexo 默认使用的主题是 landscape ,之前使用了 hexo-theme-next 主题,现在我用melody 。

下面就是看官方教程来搞下来。

首先将之克隆到 ./themes 目录下,这个目录下原本有有一个 landscape 文件夹,里边放的默认的样式,

首先命令行进入到项目的根目录,执行如下命令即可:

git clone https://github.com/Molunerfinn/hexo-theme-melody themes/melody

1

克隆成功后,修改 hexo 的 _config.yml 文件,将主题修改为 melody,如下:

theme: icarus

1

这个时候就可以跑起来了。

配置主题

主题创建好之后,接下来就是对主题的配置了,这个比较麻烦,直接参考官方文档和Github教程即可。

下面是我的主题配置

# Version of the configuration file version: 3.0.0 # Icarus theme variant, can be "default" or "cyberpunk" variant: default # Path or URL to the website's logo logo: /img/logo.png # Page metadata configurations head: # URL or path to the website's icon favicon: /img/avatar.png # Open Graph metadata # https://hexo.io/docs/helpers.html#open-graph open_graph: # Page title (og:title) (optional) # You should leave this blank for most of the time title: # Page type (og:type) (optional) # You should leave this blank for most of the time type: blog # Page URL (og:url) (optional) # You should leave this blank for most of the time url: # Page cover (og:image) (optional) # You should leave this blank for most of the time image: # Site name (og:site_name) (optional) # You should leave this blank for most of the time site_name: # Page author (article:author) (optional) # You should leave this blank for most of the time author: # Page description (og:description) (optional) # You should leave this blank for most of the time description: # Twitter card type (twitter:card) twitter_card: # Twitter ID (twitter:creator) twitter_id: # Twitter Site (twitter:site) twitter_site: # Google+ profile link (deprecated) google_plus: # Facebook admin ID fb_admins: # Facebook App ID fb_app_id: # Structured data of the page # https://developers.google.com/search/docs/guides/intro-structured-data structured_data: # Page title (optional) # You should leave this blank for most of the time title: # Page description (optional) # You should leave this blank for most of the time description: # Page URL (optional) # You should leave this blank for most of the time url: # Page author (article:author) (optional) # You should leave this blank for most of the time author: # Page images (optional) # You should leave this blank for most of the time image: # Additional HTML meta tags in an array meta: # Meta tag specified in = style # E.g., name=theme-color;content=#123456 => - 'name=theme-color;content=#123456' - 'name=generator;content="Hexo 4.2.0"' # URL or path to the website's RSS atom.xml rss: /path/to/atom.xml navbar: # Navigation bar menu links menu: #菜单显示改为中文 首页: / 归档: /archives 分类: /categories 标签: /tags 关于: /about # Links to be shown on the right of the navigation bar links: Download on GitHub: icon: fab fa-github url: 'https://github.com/ppoffice/hexo-theme-icarus' # Page footer configurations footer: # Links to be shown on the right of the footer section links: Creative Commons: icon: fab fa-creative-commons url: 'https://creativecommons.org/' Attribution 4.0 International: icon: fab fa-creative-commons-by url: 'https://creativecommons.org/licenses/by/4.0/' Download on GitHub: icon: fab fa-github url: 'https://github.com/ppoffice/hexo-theme-icarus' # Article related configurations article: # Code highlight settings highlight: # Code highlight themes # https://github.com/highlightjs/highlight.js/tree/master/src/styles theme: atom-one-light # Show copy code button clipboard: true # Default folding status of the code blocks. Can be "", "folded", "unfolded" fold: unfolded # Whether to show thumbnail image for every article thumbnail: true # Whether to show estimated article reading time readtime: true # Search plugin configurations # https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Search/ search: type: insight # Comment plugin configurations # https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Comment/ comment: type: disqus # Disqus shortname shortname: 'Runsen' avatar: retro # Gravatar style : mm/identicon/monsterid/wavatar/retro/hide placeholder: 要不要说点啥... # Comment Box placeholder # Donate plugin configurations # https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Donation/ donates: # Alipay donate button configurations - type: alipay # Alipay qrcode image URL qrcode: '/img/alipay.png' # "Buy me a coffee" donate button configurations # Wechat donate button configurations - type: wechat # Wechat qrcode image URL qrcode: '/img/wechat.png' # Share plugin configurations # https://ppoffice.github.io/hexo-theme-icarus/categories/Plugins/Share/ share: type: sharejs # URL to the ShareThis share plugin script install_url: '' # Sidebar configurations. # Please be noted that a sidebar is only visible when it has at least one widget sidebar: # Left sidebar configurations left: # Whether the sidebar sticks to the top when page scrolls sticky: true # Right sidebar configurations right: # Whether the sidebar sticks to the top when page scrolls sticky: true # Sidebar widget configurations # http://ppoffice.github.io/hexo-theme-icarus/categories/Widgets/ widgets: - # Where should the widget be placed, left sidebar or right sidebar type: toc position: right # Profile widget configurations - # Where should the widget be placed, left sidebar or right sidebar position: left type: profile # Author name author: Runsen # Author title author_title: 喜欢折腾的Runsen,微信联系:RunsenLiu # Author's current location location: 中国广东某一个辣鸡学院 # URL or path to the avatar image avatar: # Whether show the rounded avatar image avatar_rounded: false # Email address for the Gravatar gravatar: # URL or path for the follow button follow_link: 'https://github.com/MaoliRUNsen' # Links to be shown on the bottom of the profile widget social_links: Github: icon: fab fa-github url: 'https://github.com/MaoliRUNsen' QQ: icon: fab fa-qq url: 'http://wpa.qq.com/msgrd?v=1&uin=2953510364&site=ioshenmue&menu=yes' RSS: icon: fas fa-rss url: / # Table of contents widget configurations # Recommendation links widget configurations - # Where should the widget be placed, left sidebar or right sidebar position: left type: links # Names and URLs of the sites links: CSDN: 'https://blog.csdn.net/weixin_44510615' 知乎: 'https://www.zhihu.com/people/qian-xiao-28-8' 头条: 'https://www.toutiao.com/c/user/2115112815048734/' # Categories widget configurations - # Where should the widget be placed, left sidebar or right sidebar position: left type: categories # Recent posts widget configurations - # Where should the widget be placed, left sidebar or right sidebar position: right type: recent_posts # Archives widget configurations - # Where should the widget be placed, left sidebar or right sidebar position: left type: archives # Tags widget configurations - # Where should the widget be placed, left sidebar or right sidebar position: right type: tags # https://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/speed-up-your-site-with-custom-cdn/ providers: # Name or URL template of the JavaScript and/or stylesheet CDN provider cdn: jsdelivr # Name or URL template of the webfont CDN provider fontcdn: google # Name or URL of the fontawesome icon font CDN provider iconcdn: fontawesome

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

项目配置

下面是项目的根目录配置

# Hexo Configuration ## Docs: https://hexo.io/docs/configuration.html ## Source: https://github.com/hexojs/hexo/ # Site title: 'Python之王' subtitle: 'Python之王' description: '人生最重要的不是所站的位置,而是内心所朝的方向。只要我在每篇博文中写得自己体会,修炼身心;在每天的不断重复学习中,耐住寂寞,练就真功,不畏艰难,奋勇前行,不忘初心,砥砺前行,人生定会有所收获,不留遗憾...' keywords: 'Python, Java, 机器学习, 爬虫, 前端, Spring家族, 人工智能' author: 'Runsen' language: zh-CN timezone: 'Asia/Shanghai' # URL ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' url: https://maolirunsen.github.io/ root: / permalink: :year/:month/:day/:title/ permalink_defaults: pretty_urls: trailing_index: true # Set to false to remove trailing 'index.html' from permalinks trailing_html: true # Set to false to remove trailing '.html' from permalinks search: path: search.xml field: post # Directory source_dir: source public_dir: public tag_dir: tags archive_dir: archives category_dir: categories code_dir: downloads/code i18n_dir: :lang skip_render: # Writing new_post_name: :title.md # File name of new posts default_layout: post titlecase: false # Transform title into titlecase external_link: enable: true # Open external links in new tab field: site # Apply to the whole site exclude: 'default_category' filename_case: 0 render_drafts: true post_asset_folder: true relative_link: true future: true highlight: enable: true line_number: true auto_detect: true tab_replace: '' wrap: true hljs: true # Home page setting # path: Root path for your blogs index page. (default = '') # per_page: Posts displayed per page. (0 = disable pagination) # order_by: Posts order. (Order by date descending by default) index_generator: path: '' per_page: 10 order_by: -date # Category & Tag default_category: uncategorized category_map: tag_map: # Metadata elements ## https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta meta_generator: true # Date / Time format ## Hexo uses Moment.js to parse and display date ## You can customize the date format as defined in ## http://momentjs.com/docs/#/displaying/format/ date_format: YYYY-MM-DD time_format: HH:mm:ss ## Use post's date for updated date unless set in front-matter use_date_for_updated: true # Pagination ## Set per_page to 0 to disable pagination per_page: 10 pagination_dir: page # Include / Exclude file(s) ## include:/exclude: options only apply to the 'source/' folder # include: # exclude: # ignore: #busuanzi: # enable: true # ---------------下面选项需要对应插件的支持--------------- # npm install hexo-generator-index --save # npm install hexo-generator-archive --save # npm install hexo-generator-category --save # npm install hexo-generator-tag --save archive_generator: per_page: 20 ##归档页面默认20篇文章标题 yearly: true ##生成年视图 monthly: true ##生成月视图 tag_generator: per_page: 10 ##标签分类页面默认10篇文章 category_generator: per_page: 10 ###分类页面默认10篇文章 # Extensions ## Plugins: https://hexo.io/plugins/ ## Themes: https://hexo.io/themes/ theme: icarus # 多说 ShortName busuanzi: enable: true # Deployment ## Docs: https://hexo.io/docs/deployment.html deploy: type: git repo: https://github.com/MaoliRUNsen/MaoliRUNsen.github.io.git branch: master

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

四十五、Gtihub+Hexo+icarus搭建自己的博客

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

写文章

写文章时需要有下面的标志,没有就不能有阅读全文的标签。

`

--- tags: - Python环境 categories: - Python toc: true --- 1、 搭建Python的基础环境

1

2

3

4

5

6

7

8

9

10

下面就是搭建的效果。

https://maolirunsen.github.io/

有个问题就是不知道怎么解析域名,卡了好久了。还有,网站访问比较慢。

Hexo

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:JVM系列之垃圾回收机制(Garbage Collect)
下一篇:什么是事务数据库?丨【绽放吧!数据库】
相关文章