安装 hexo 主题 landscape

Landscape

NPM version

一个全新的 Hexo 默认主题。

安装

安装主题

如果您使用的是 Hexo 5.0 或更高版本,最简单的安装方式是通过 npm:

1
npm i hexo-theme-landscape

通过 git 安装:

1
git clone --depth 1 https://github.com/hexojs/hexo-theme-landscape themes/landscape

如果您想启用 RSS 功能,还需要安装 hexo-generator-feed 插件。

启用主题

修改 _config.yml 中的 theme 设置为 landscape

1
2
3
_config.yml
- theme: some-theme
+ theme: landscape

更新主题

通过 npm 安装最新版本:

1
npm install hexo-theme-landscape@latest

或者通过 git 更新到最新的 master 分支:

1
2
cd themes/landscape
git pull

配置

主题的配置文件是仓库中的 _config.yml。作为 Hexo 的默认主题,hexo-theme-landscape 在 hexo init 创建站点过程中通过 npm 安装,因此它通常位于 node_modules/hexo-theme-landscape 目录中。如果您通过 git clone 或其他方式安装,它可能位于 themes/landscape 目录中。

需要注意的是,为了防止您对主题配置文件的修改在主题升级过程中丢失或被覆盖,我们不建议直接修改这个默认配置文件。您可以将主题的 _config.yml 复制到您的博客根目录,命名为 _config.landscape.yml,并根据其中的配置选项文档进行配置(请参阅 替代主题配置)。

下面也将详细介绍一些选项的用法。

特性

FancyBox

Landscape 使用 Fancybox 来展示您的照片。您可以使用 Markdown 语法或 fancybox 标签插件来添加照片。

1
2
3
![img caption](img url)

{% fancybox img_url [img_thumbnail] [img_caption] %}

侧边栏

您可以通过编辑 sidebar 设置,将侧边栏放在站点的左侧、右侧或底部。

Landscape 提供了 5 个内置小部件:

  • category(分类)
  • tag(标签)
  • tagcloud(标签云)
  • archives(归档)
  • recent_posts(最近文章)

默认情况下,所有小部件都已启用。您可以在 widget 设置中编辑它们。

头部链接

您可以添加带有图标的链接到头部区域。

1
2
3
4
links:
github: https://github.com/your_github_account
twitter: https://twitter.com/your_twitter_account
telegram: https://t.me/your_telegram_account

安装 hexo 主题 light

Light

一个适用于 Hexo 的简约主题。

安装

执行以下命令,并将 _config.yml 中的 theme 修改为 light

1
git clone --depth 1 https://github.com/hexojs/hexo-theme-light themes/light
1
2
3
_config.yml
- theme: some-theme
+ theme: light

更新

执行以下命令来更新 Light 主题。

1
2
cd themes/light
git pull

配置

默认配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
menu:
Home: /
Archives: /archives

widgets:
- search
- category
- tag
- twitter

excerpt_link: Read More

twitter:
username:
show_replies: false
tweet_count: 5

fancybox: true

google_analytics:
rss:
  • menu - 主导航菜单
  • widget - 侧边栏显示的小部件
  • excerpt_link - 摘要文章底部的”阅读更多”链接文本
  • twitter - Twitter 小部件配置
    • username - Twitter 用户名
    • show_replies - 启用显示回复
    • tweet_count - 小部件中显示的推文数量
  • fancybox - 启用 Fancybox
  • google_analytics - Google Analytics ID
  • rss - RSS 订阅链接(如果使用 Feedburner 请修改)

特性

图库文章

Gallery Post

链接文章

Link Post

Twitter 小部件

Tweet Widget

Fancybox

Fancybox

Hexo Hello World

欢迎使用 Hexo!这是你的第一篇文章。查看 文档 了解更多信息。如果你在使用 Hexo 时遇到任何问题,可以在 故障排除 中找到答案,或者在 GitHub 上向我提问。

快速开始

创建新文章

1
$ hexo new "My New Post"

更多信息:写作

运行服务器

1
$ hexo server

更多信息:服务器

生成静态文件

1
$ hexo generate

更多信息:生成

部署到远程站点

1
$ hexo deploy

更多信息:部署