feat: update layouts

master
nodejh 4 years ago
parent 81a13c63f8
commit ffea239839

@ -1,4 +1,10 @@
## 2017.12.09 Version 1.0 ## 2021.03.01 Version 2.0.0
- [x] Refactor
- [x] Support hugo 0.80.0
## 2017.12.09 Version 1.0.0
- [x] Support twitter card. - [x] Support twitter card.
- [x] Remove name in `.Site.Params`. It's duplicate with `.Site.title`. - [x] Remove name in `.Site.Params`. It's duplicate with `.Site.title`.

@ -1,119 +0,0 @@
# Hugo Theme Cactus Plus
[English Document](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/README.md) | [中文文档](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/README_zh-cn.md)
Cactus Plus is a minimalistic theme for bloggers based on the theme named [Cactus](https://github.com/digitalcraftsman/hugo-cactus-theme).
**Features**
+ **More beautiful style**
+ **Tags page**
+ **Archive page**
+ **[Disqus](https://disqus.com/) comment-system**
+ **Both Google Analytics and Baidu Analytics for site analytics.**
+ **Table of Content**
+ **Twitter Card**
Here's the link to online demo: [http://nodejh.com](http://nodejh.com).
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
- [Hugo Theme Cactus Plus](#hugo-theme-cactus-plus)
- [Screenshot](#screenshot)
- [Installation](#installation)
- [Example Site](#example-site)
- [Posts Summary](#posts-summary)
- [About page](#about-page)
- [Avatar](#avatar)
- [Hide pages](#hide-pages)
- [Disqus](#disqus)
- [Social link icons](#social-link-icons)
- [Nearly finished](#nearly-finished)
- [License](#license)
<!-- /TOC -->
## Screenshot
**home page**
![Screenshot](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/images/screenshot.png)
**tags page**
![Screenshot](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/images/tags.png)
**archive page**
![Screenshot](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/images/archive.png)
## Installation
First clone the theme to your themes directory:
```
$ cd themes
$ git clone https://github.com/nodejh/hugo-theme-cactus-plus.git
```
Take a look inside the [`exampleSite`](https://github.com/nodejh/hugo-theme-cactus-plus/tree/master/exampleSite) folder of this theme. You'll find a file called [`config.toml`](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/exampleSite/config.toml).
To use it, copy the [`config.toml`](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/exampleSite/config.toml) in the root folder of your Hugo site. Feel free to change strings as you like to customize your website.
And you may replace your site `archetypes/default.md` with [`hugo-theme-cactus-plus/archetypes/default.md`](https://github.com/nodejh/hugo-theme-cactus-plus/tree/master/archetypes/default.md)
For more information read the official [setup guide](//gohugo.io/overview/installing/) of Hugo.
## Example Site
There is an example site with config file and markdown files in [`exampleSite`](https://github.com/nodejh/hugo-theme-cactus-plus/tree/master/exampleSite) directory.
## Posts Summary
Summary will show follow the post title title in home page.
And if you want to use description property that in post's fromt matter to instated of post's content summary, set `useDescriptionReplaceSummary = true`.
To use the content summary, you may add the `<!--more-->` summary divider where you want to split the article alternatively. For org content, use # more where you want to split the article. Content that comes before the summary divider will be used as that contents summary.By default, Hugo automatically takes the first 70 words of your content as its summary. See also [https://gohugo.io/content-management/summaries/](https://gohugo.io/content-management/summaries/).
## About page
Use the about page to introduce yourself to your visitors. You can customize the content as you like in the `/content/about/_index.md`.
## Avatar
Furthermore, you should replace the [avatar placeholder](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/static/images/) with a great image of yourself.
## Hide pages
Pages can be hidden and don't appear in the post list on the homepage if you add the variable `hidden = true` to the frontmatter. This allows you to link from elsewhere, i.e. just the menu.
## Disqus
This theme features a comment system powered by Disqus. Just add your Disqus-shortname to the [`config.toml`](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/exampleSite/config.toml) and set `enableDisqus = true`, then let readers respond to your blog posts.
## Social link icons
You can add a social link panel in the footer by adding entries to the `social` block in the [`config.toml`](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/exampleSite/config.toml). You can choose between two icon fonts:
- [Font awesome](https://fortawesome.github.io/Font-Awesome/) or
- [Mono social icons](https://github.com/drinchev/monosocialiconsfont)
Assign either `font-awesome` or `mono-social` to the `iconFont` variable. The Mono social icons offer three styles of icons: -circle, rounded, or default (empty).
## Nearly finished
In order to see your site in action, run Hugo's built-in local server.
```
$ hugo server
```
Now enter [`localhost:1313`](http://localhost:1313) in the address bar of your browser.
## License
This theme is released under the MIT license. For more information read the [license](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/LICENSE.md).

@ -30,26 +30,32 @@ Features:
1. From your project's root directory, initiate the hugo module system if you haven't already: 1. From your project's root directory, initiate the hugo module system if you haven't already:
``` ```
$ hugo mod init github.com/<your_user>/<your_project> $ hugo mod init github.com/<your_user>/<your_project>
``` ```
2. Add the theme's repo to your `config.yaml`: 2. Add the theme's repo to your `config.yaml`:
```yaml ```yaml
theme: theme:
- github.com/nodejh/gohugo-theme-mini - github.com/nodejh/hugo-theme-mini
``` ```
### As Git Submodule ### As Git Submodule
Inside the folder of your Hugo site run: 1. Inside the folder of your Hugo site run:
``` ```
$ git submodule add https://github.com/nodejh/gohugo-theme-mini.git themes/mini $ git submodule add https://github.com/nodejh/hugo-theme-mini.git themes/mini
``` ```
For more information read the official [setup guide](//gohugo.io/overview/installing/) of Hugo.
2. Add the theme's directory to your `config.yaml`:
```yaml
theme: mini
```
For more information read the official [setup guide](//gohugo.io/overview/installing/) of Hugo.
## Getting started ## Getting started
@ -59,15 +65,45 @@ After installing the theme successfully it requires a just a few more steps to g
### The config file ### The config file
Take a look inside the [`exampleSite`](https://github.com/nodejh/gohugo-theme-mini/tree/master/exampleSite) folder of this theme. You'll find a file called [`config.yaml`](https://github.com/nodejh/gohugo-theme-mini/blob/master/exampleSite/config.yaml). To use it, copy the [`config.yaml`](https://github.com/nodejh/gohugo-theme-mini/blob/master/exampleSite/config.yaml) in the root folder of your Hugo site. Feel free to change the strings in this theme. Take a look inside the [`exampleSite`](https://github.com/nodejh/hugo-theme-mini/tree/master/exampleSite) folder of this theme. You'll find a file called [`config.yaml`](https://github.com/nodejh/hugo-theme-mini/blob/master/exampleSite/config.yaml). To use it, copy the [`config.yaml`](https://github.com/nodejh/hugo-theme-mini/blob/master/exampleSite/config.yaml) in the root folder of your Hugo site. Feel free to change the strings in this theme.
> ⚠️ You may need to delete the line: `themesDir: ../../`
### Add Comments
To enable comments, add following to your config file:
You may need to delete the line: `themesDir: ../../` - DISQUS: `disqusShortname: your-disqus-shorname`
- Enable Comment:
```yaml
params:
enableComments: true
```
### Google Analytics
To enable google analytics, add following to your config file:
- DISQUS: `googleAnalytics: your-google-analytics-id`
- Enable Comment:
```yaml
params:
enableGoogleAnalytics: true
```
### Logo and favicon ### Logo and favicon
You can replace the log in the top of each page and favicon with your own images. To do that replace `static/images/avatar.png` and `static/images/favicon.ico` . You can replace the log in the top of each page and favicon with your own images. To do that put your own logo and favicon into the `images` directory of your website static directory, then named them `avatar.png` and `favicon.ico`. For example:
```
- content
- static
└── images
├── avatar.png
└── favicon.ico
```
### Nearly finished ### Nearly finished
@ -78,3 +114,7 @@ $ hugo server
``` ```
Now enter localhost:1313 in the address bar of your browser. Now enter localhost:1313 in the address bar of your browser.
## License
[MIT](https://github.com/nodejh/hugo-theme-mini/blob/master/LICENSE.md)

@ -1,139 +0,0 @@
# Hugo Theme Cactus Plus
[English Document](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/README.md) | [中文文档](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/README_zh-cn.md)
Cactus Plus 是在 [Cactus](https://github.com/digitalcraftsman/hugo-cactus-theme) 更改的一个简约主题。
**特点**
+ **更漂亮的样式**
+ **添加了标签页**
+ **添加了归档页**
+ **集成了 [Disqus](https://disqus.com/) 评论系统**
+ **提供了 Google Analytics 和百度统计**
+ **文章目录**
+ **Twitter Card**
示例网站: [http://nodejh.com](http://nodejh.com)。
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
- [Hugo Theme Cactus Plus](#hugo-theme-cactus-plus)
- [截图](#截图)
- [安装](#安装)
- [示例站点](#示例站点)
- [文章摘要](#文章摘要)
- [关于页面](#关于页面)
- [头像](#头像)
- [隐藏页面](#隐藏页面)
- [Disqus 评论](#disqus-评论)
- [社交链接](#社交链接)
- [部署主题](#部署主题)
- [License](#license)
<!-- /TOC -->
## 截图
**首页**
![Screenshot](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/images/screenshot.png)
**标签页**
![Screenshot](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/images/tags.png)
**归档页**
![Screenshot](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/images/archive.png)
## 安装
首先进入 `hugo` 的站点目录运行下面的命令:
```
$ cd themes
$ git clone https://github.com/nodejh/hugo-theme-cactus-plus.git
```
本主题提供了一个示例配置文件是 [`exampleSite`](https://github.com/nodejh/hugo-theme-cactus-plus/tree/master/exampleSite) 目录里的 [`config.toml`](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/exampleSite/config.toml) 文件。
配置文件中对大部分配置都有详细的注释说明,复制该文件到站点目录下,根据自己的情况修改即可。
然后可能你还需要用 [`hugo-theme-cactus-plus/archetypes/default.md`](https://github.com/nodejh/hugo-theme-cactus-plus/tree/master/archetypes/default.md) 替换你的项目中的 `archetypes/default.md`
更多安装信息查看 Hugo 官方文档 [setup guide](//gohugo.io/overview/installing/)。
## 示例站点
[`exampleSite`](https://github.com/nodejh/hugo-theme-cactus-plus/tree/master/exampleSite) 是本主题的一个示例站点,里面有配置文件、关于页面的一些示例。
## 文章摘要
Summary will show follow the post title title in home page.
摘要会显示在首页的文章标题下面。
如果你想用文章头信息中的 `description` 属性代替文章内容摘要,将 `useDescriptionReplaceSummary` 设置为 `true` 即可。
如果要使用文章内容摘要,你可能需要在文章中添加 `<!--more-->` 分割线来分割文章。分割线前面的字符会作为文章摘要。默认情况下Hugo 会截取内容的前 70 个字作为摘要。查看更多 [https://gohugo.io/content-management/summaries/](https://gohugo.io/content-management/summaries/).
## 关于页面
使用关于页面首先要在你的站点目录的 `content` 目录下创建一个 `about` 目录,然后再创建一个 `_index.md` 文件,编写该文件即可。
你也可以参考本主题示例站点中的关于页:[`exampleSite/content/about/index.md`](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/exampleSite/content/about/index.md)。
## 头像
你需要将 [images](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/static/images/) 目录下的 `avatar.png`、`avatar@2x.png` 和 `favicon.ico` 都替换为你自己的图像。
## 隐藏页面
如果你不想让一个页面出现在文章列表中,只需要在 markdown 文件的 `frontmatter` 中添加 `hidden = true` 即可。
然后你可以在其他任何地方通过链接来引用该页面,如在菜单中放置一个链接。
关于页面就是这么实现的。
## Disqus 评论
本主题提供两种评论系统Disqus 和多说。使用 Disqus 评论需要在 [`config.toml`](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/exampleSite/config.toml) 中进行设置。
设置 `disqusShortname` 为你的 Disqus ID并将 `enableDisqus` 设置为 `true` 即可开启 Disqus 评论。
`enableDisqus` 设置为 `false` 则不启用 Disqus 评论。
## 社交链接
本主题的社交链接是字体图标的样式,并放置在了页面底部。你可以通过在 `config.toml``social` 模块中修改添加你的社交链接。社交链接提供了两种字体图标,选用其中一种即可:
- [Font awesome](https://fortawesome.github.io/Font-Awesome/) 或
- [Mono social icons](https://github.com/drinchev/monosocialiconsfont)
`iconFont` 变量即字体图标库,可以是 `font-awesome``mono-social`
如果使用的是 `Mono social icons``iconFont = "mono-social"`,则图标还有三种可选样式:`-circle`、`rounded`、或默认 `empty`
## 部署主题
配置完成之后,就可以使用下面的命令来启动 hugo 服务编译 markdown 文件生成静态站点:
```
$ hugo server
```
然后在浏览器地址栏输入 [`localhost:1313`](http://localhost:1313) 来访问站点。
## License
[MIT](https://github.com/nodejh/hugo-theme-cactus-plus/blob/master/LICENSE.md)

@ -2,12 +2,15 @@ baseURL: https://example.com
languageCode: en-us languageCode: en-us
title: Hugo title: Hugo
theme: hugo-theme-mini theme: hugo-theme-mini
# for exampleSite only, you may need to delete the line: `themesDir: ../../`
themesDir: ../../ themesDir: ../../
googleAnalytics: your-google-analytics-id
hasCJKLanguage: true hasCJKLanguage: true
permalinks: permalinks:
posts: /posts/:title/ posts: /posts/:title/
googleAnalytics: your-google-analytics-id
disqusShortname: your-disqus-shorname disqusShortname: your-disqus-shorname
# Hugo Configure Markup # Hugo Configure Markup
@ -35,7 +38,11 @@ params:
bio: Software Engineer bio: Software Engineer
# Site Description, used in HTML meat # Site Description, used in HTML meat
description: My Blog description: My Blog
enableRSS: true enableRSS: false
# To enable comments, you may need to set `disqusShortname`
enableComments: true
# To enable comments, you may need to set `googleAnalytics`
enableGoogleAnalytics: true
# Optional # Optional
home: '' # Default: Home home: '' # Default: Home
@ -44,7 +51,7 @@ params:
subscribe: '' # Default: Subscribe subscribe: '' # Default: Subscribe
olderPosts: '' # Default: Older Posts olderPosts: '' # Default: Older Posts
newerPosts: '' # Default: Newer Posts newerPosts: '' # Default: Newer Posts
copyright: '' copyright: '' # Default: © Copyright 2021 ❤️ author
title404: '' # Default: 404 - Page Not Found title404: '' # Default: 404 - Page Not Found
subtitle404: '' # Default: The content you're looking for doesn't seem to exist. subtitle404: '' # Default: The content you're looking for doesn't seem to exist.
readMore: '' # Default: Read More readMore: '' # Default: Read More

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 45 KiB

@ -1,4 +1,6 @@
<div id="comment"> {{ if .Site.Params.enableComments }}
<!-- https://gohugo.io/templates/internal/#use-the-disqus-template --> <div id="comment">
{{ template "_internal/disqus.html" . }} <!-- https://gohugo.io/templates/internal/#use-the-disqus-template -->
</div> {{ template "_internal/disqus.html" . }}
</div>
{{ end }}

@ -13,6 +13,10 @@
<link rel="stylesheet" href="{{ "/css/style.css" | relURL }}"> <link rel="stylesheet" href="{{ "/css/style.css" | relURL }}">
<link rel="shortcut icon" href="{{ "/images/favicon.ico" | relURL }}" type="image/x-icon" /> <link rel="shortcut icon" href="{{ "/images/favicon.ico" | relURL }}" type="image/x-icon" />
{{ if .Site.Params.enableGoogleAnalytics }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
{{ if .OutputFormats.Get "RSS" }} {{ if .OutputFormats.Get "RSS" }}
{{ with .OutputFormats.Get "RSS" }} {{ with .OutputFormats.Get "RSS" }}

@ -11,6 +11,6 @@
{{ end }} {{ end }}
{{ if .Site.Params.enableRSS }} {{ if .Site.Params.enableRSS }}
<a class="button" href="{{ .Site.RSSLink }}">{{ with .Site.Params.subscribe }}{{ . }}{{ else }}Subscribe{{ end }}</a> <a class="button" href="{{ .Site.RSSLink }}">{{ with .Site.Params.subscribe }}{{ . }}{{ else }}Subscribe{{ end }}</a>
{{ end }} {{ end }}
</nav> </nav>

@ -3,6 +3,9 @@
<section id="section"> <section id="section">
{{ .Content }} {{ .Content }}
{{ partial "comment.html" . }}
</section> </section>
{{ end }} {{ end }}

@ -5,7 +5,7 @@ description = "A fast, minimalist and responsive hugo theme for bloggers."
homepage = "https://github.com/nodejh/hugo-theme-mini" homepage = "https://github.com/nodejh/hugo-theme-mini"
tags = ["blog", "fast", "minimalist", "responsive", "simple", "beautiful", "tags", "pages"] tags = ["blog", "fast", "minimalist", "responsive", "simple", "beautiful", "tags", "pages"]
features = ["fast", "minimalist", "archive", "tags"] features = ["fast", "minimalist", "archive", "tags"]
min_version = "0.80.0" min_version = "0.64.0"
[author] [author]
name = "nodejh" name = "nodejh"

Loading…
Cancel
Save