Go to file
zzossig 59fbf3cc1d missing resource added, mermaid, math type with katex support. flowchartjs in progress 2019-11-14 12:31:02 +09:00
archetypes missing resource added, mermaid, math type with katex support. flowchartjs in progress 2019-11-14 12:31:02 +09:00
assets missing resource added, mermaid, math type with katex support. flowchartjs in progress 2019-11-14 12:31:02 +09:00
data missing resource added, mermaid, math type with katex support. flowchartjs in progress 2019-11-14 12:31:02 +09:00
exampleSite missing resource added, mermaid, math type with katex support. flowchartjs in progress 2019-11-14 12:31:02 +09:00
i18n sidebar subs added, gallery mask, mode added, 2019-11-13 17:06:51 +09:00
images jpg -> png, permalink issue fixed 2019-11-05 09:33:01 +09:00
layouts missing resource added, mermaid, math type with katex support. flowchartjs in progress 2019-11-14 12:31:02 +09:00
resources/_gen/assets missing resource added, mermaid, math type with katex support. flowchartjs in progress 2019-11-14 12:31:02 +09:00
static toc enable switch position fixed, switch color customizing. 2019-11-12 20:24:17 +09:00
.gitignore first commit 2019-11-04 22:09:44 +09:00
.jsbeautifyrc first commit 2019-11-04 22:09:44 +09:00
LICENSE.md first commit 2019-11-04 22:09:44 +09:00
README.md missing resource added, mermaid, math type with katex support. flowchartjs in progress 2019-11-14 12:31:02 +09:00
theme.toml first commit 2019-11-04 22:09:44 +09:00

README.md

Zzo theme for Hugo

Thank you for click me!. Zzo theme is a blog theme for Hugo with free(always), and many features. If you find any bugs, or wanna share your custom color skin, or have some good idea to share with me and others who use this theme, feel free to open github issue or pull request so that I can make this theme better.

Table of contents

Features

  • Multiple sub themes(dark, light, solarized, hacker)
  • A mobile menu
  • CSS grid and flex for layout
  • HTML5
  • Hugo Pipes for js and sass
  • jQuery
  • Simple blog
  • Minify css
  • Meta tags and JSON-LD
  • Multilingual (i18n)
  • Responsive design
  • RSS and JSON feeds with full content
  • Search with Lunr
  • Gallery with Masonry, Photoswipe
  • Prism.js for highlight code
  • Lazy image load with lazysizes

Reference

I have referenced:

Dependency

Zzo theme is using this library.

  • jquery@3.4.1
  • mark.js
  • clipboard.js
  • lazysizes
  • masonry
  • lunr
  • jquery.toc
  • photoswipe
  • prism
  • shave.js

Minimum Hugo version

Hugo version 0.58.0 or higher is required.

Installation

First of all, You need to add config files. Follow the Configuration step.

Then, You can download and unpack the theme manually from Github but it's easier to use git to clone the repo.

From the root of your site:

$ git clone https://github.com/zzossig/hugo-theme-zzo.git themes/zzo

If you use git to version control your site, highly recommended, it's best to add the zzo theme as a submodule.

From the root of your site:

git submodule add https://github.com/zzossig/hugo-theme-zzo.git themes/zzo

Updating

From the root of your site:

git submodule update --remote --merge

Run example site

From the root of themes/zzo/exampleSite:

hugo server --themesDir ../..

Configuration

  1. From the root of your site: delete config.toml file and add the files below

  2. config folder structure

root
├── config
│   ├── _default
│   │   ├── config.toml
│   │   ├── languages.toml
│   │   ├── menus.en.toml
│   │   ├── params.toml
  1. config.toml
baseURL = "http://example.org/"
title = "Hugo Zzo Theme"
theme = "zzo"

defaultContentLanguage = "en"
defaultContentLanguageInSubdir = true
hasCJKLanguage = true

summaryLength = 70

googleAnalytics = ""
copyright = "©yourcopyright"
timeout = 10000
enableEmoji = true
paginate = 7
rssLimit = 100

[outputs]
  home = [ "HTML", "RSS", "JSON" ]

[taxonomies]
  category = "categories"
  tag = "tags"
  series = "series"

  1. languages.toml
[en]
  title = "Hugo Zzo Theme"
  languageName = "English"
  weight = 1

[ko]
  title = "Hugo Zzo Theme"
  languageName = "한국어"
  weight = 2
  1. menus.en.toml

You shoud make your own menu.

[[main]]
  identifier = "about"
  name = "about"
  url = "about"
  weight = 1

[[main]]
  identifier = "archive"
  name = "archive"
  url = "archive"
  weight = 2

[[main]]
  identifier = "gallery"
  name = "gallery"
  url = "gallery"
  weight = 3
    
[[main]]
  parent = "gallery"
  name = "cartoon"
  url = "gallery/cartoon"

[[main]]
  parent = "gallery"
  name = "photo"
  url = "gallery/photo"

[[main]]
  identifier = "posts"
  name = "posts"
  url = "posts"
  weight = 4
    
[[main]]
  identifier = "notes"
  name = "notes"
  url = "notes"
  weight = 5
...
  1. params.toml
logoText = "Zzo"
description = "The Zzo theme for Hugo example site."
custom_css = ["css/custom.css", "css/custom.css"]
custom_js = ["js/custom.js"]
myname = "yourname"
whoami = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sit amet cursus massa. Vestibulum eu posuere est. Suspendisse erat purus, mollis in leo quis, hendrerit fringilla felis."

# body
enableBreadcrumb = true
enablePhotoSwipe = true
enableSearch = true
enableMark = true
enableGoToTop = true
enableWhoami = true
summaryShape = "card" # card, classic, compact
archiveGroupByDate = "2006-01" # "2006-01": group by month, "2006": group by year

# sidebar
enableSidebar = true
enableSidebarTags = true
enableSidebarSeries = true
enableSidebarCategories = true
enableToc = true
enableTocSwitch = true
itemsPerCategory = 5
enableSideSubscribe = false

# comment
enableComment = false
disqus_shortname = ""
commento = false

# footer
showPoweredBy = true
showFeedLinks = true
showSocialLinks = true
enableLangChange = true
enableThemeChange = true
themeOptions = ["dark", "light", "hacker", "solarized", "custom"]
[socialOptions]
  email = "mailto:your@email.com"
  facebook = "http://example.org/"
  twitter = "http://example.org/"
  github = "http://example.org/"
  stack-overflow = ""
  instagram = ""
  google-plus = ""
  youtube = ""
  medium = ""
  tumblr = ""
  linkedin = ""
  pinterest = ""
  stack-exchange = ""

Layout

CSS grid for layout

Modern CSS grid is the easiest and cleanest way to layout your pages.

The CSS grid layout are in assets/sass/layout/_grid.scss. A lot can be done by just reordering "grid-template-rows".

grid structure

left right
1 2
3 4
5 6
7 8
  • left, right column width ratio => 5 : 2
  • 1 => .navbar-main
  • 2 => .navbar-side
  • 1 + 2 => .navbar
  • 3 => .header-main
  • 4 => .header-side
  • 3 + 4 => .header
  • 5 => .main-main
  • 6 => .main-side
  • 5 + 6 => .main
  • 7 => .footer-main
  • 8 => .footer-side
  • 7 + 8 => .footer

grid structure example applied in home page

<div class="navbar"></div>
<div class="header"></div>
<div>
  <div class="main-main"></div>
  <div class="main-side"></div>
</div>
<div class="footer></div>

There are two ways to make gallery. You can specify mode at frontmatter.

content/gallery/mygallery/index.md

---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
description: 
type: gallery
mode: one-by-one # at-once or one-by-one
tags:
-
series:
-
categories:
-
images: # when mode is one-by-one, images front matter works
  - image: image1.jpg
    caption: caption1
  - image: image2.jpg
    caption: caption2
    ...
---

If you set the mode to one-by-one, list.html page will use images frontmatter above. If you set the mode to at-once, list.html page will not use images frontmatter and just read all files under the static/gallery/mygallery folder.

  1. Make a gallery folder under the content folder
root
├── content
│   ├── gallery
  1. Make a sub folder under the gallery folder
root
├── content
│   ├── gallery
│   │   ├── mygallery
  1. Make a index.md file under the sub folder using this command
hugo new gallery/mygallery/index.md
  1. Put your images in static folder
root
├── static
│   ├── gallery
│   │   ├── mygallery
│   │   │   ├── ...your images here

Multi Language

The default language of this theme is English. If you want to use another language, follow these steps

  1. Make a menu file.
root
├── config
│   ├── _default
│   │   ├── ...
│   │   ├── menus.ko.toml
config/_default/menus.ko.toml

[[main]]
  identifier = "about"
  name = "about"
  url = "/about/"
  weight = 1

[[main]]
    identifier = "archive"
    name = "archive"
    url = "/archive/"
    weight = 2
...
  1. Make a content file. Add your language code before the md extension.
hugo new about/index.ko.md
hugo new posts/markdown-syntax.ko.md
...
  1. Make an i18n file.
i18n/ko.toml

[search-placeholder]
other = "검색..."

[summary-dateformat]
other = "2006년 01월 02일"

[taxo-tags]
other = "태그"

...

Customizing

It's better idea not to modify zzo theme's folder if you wanna future support and upgrade. (You can modify if it doesn't matter) If you want more customizing options, open an issue.

custom css

  1. Add this line of code to your params.toml file
config/_default/params.toml

...
custom_css = ["css/custom.css", "scss/custom.scss", ...]
...
  1. Add your file to assets folder. Filename must match with config params you set above.
assets/scss/custom.scss
assets/css/custom.css
  1. If you want to modify zzo theme's default color, you should override the theme style. For example, if you want to change the body background-color, because I set the background-color in #body selector, not in body tag selector, you should override body background-color there. body tag selector won't work. And make sure to set !important.
assets/scss/custom.scss or assets/css/custom.css

...
#body {
  background-color: red !important;
}
...

custom js

  1. Add this line of code to your params.toml file
config/_default/params.toml

...
custom_js = ["js/custom.js", ...]
...
  1. Add your file to assets folder. Filename must match with config params you set above.
assets/js/custom.js

custom skin(sub theme)

  1. Make a skin.toml file in data folder. (data/skin.toml)

  2. Copy the contents of themes/zzo/data/skin.toml file and paste it into the skin.toml file you created above.

  3. Change the color you want.

  4. Edit config/_default/params.toml file. The option name must be custom.

...
themeOptions = ["custom", "dark", ...]
...
  1. Once you change the skin.toml file, restart hugo.

custom font

  1. Make a font.toml file in data folder. (data/font.toml)

  2. Copy the contents of themes/zzo/data/font.toml file and paste it into the font.toml file you created above.

  3. Change the font you want. Make sure that you have imported that font.

  4. Once you change the font.toml file, restart hugo.

data/font.toml example

search_placeholder = "'Montserrat', sans-serif"
summary_title = "'Montserrat', sans-serif"
summary_subtitle = "'Merriweather', serif"
summary_text = "'Merriweather', serif"
taxo_titie = "'Montserrat', sans-serif"
footer_content = "'Montserrat', sans-serif"
header_title = "'Montserrat', sans-serif"
navbar_item = "'Montserrat', sans-serif"
sidebar_title = "'Montserrat', sans-serif"
sidebar_list = "inherit"
page_not_found = "'Montserrat', sans-serif"
gallery_contents = "'Merriweather', serif"
list_title = "'Montserrat', sans-serif"
list_desc = "'Merriweather', serif"
single_title = "'Montserrat', sans-serif"
single_contents = "'Merriweather', serif"

custom header

You may want to change home page header. To do this, just make a file at layouts/partials/header/site-header.html and edit this file. Don't forget adding grid class. That's it.

{{ if .IsHome }}
<header class="header">
    ...
    Your custom header here.
    ...
</header>
{{ end }}

custom grid

  1. Make a grid.toml file in data folder. (data/grid.toml)

  2. Copy the contents of themes/zzo/data/grid.toml file and paste it into the grid.toml file you created above.

  3. Change the grid you want.

  4. Once you change the grid.toml file, restart hugo.

data/grid.toml example

grid_max_width = "960px"
grid_main_main_width = "5"
grid_main_main_unit = "fr"
grid_main_side_width = "2"
grid_main_side_unit = "fr"
grid_navbar_height = "50px"
grid_column_gap = "1.5rem"
grid_row_gap = "0"

Shortcodes

warning

{{% alert theme="info" %}}**this** is a text{{% /alert %}}
{{% alert theme="success" %}}**Yeahhh !** is a text{{% /alert %}}
{{% alert theme="warning" %}}**Be carefull** is a text{{% /alert %}}
{{% alert theme="danger" %}}**Beware !** is a text{{% /alert %}}

expand

{{%expand "Expand me" %}}Good job{{% /expand%}}

img

{{% img src="https://example.com" title="Image4" caption="Image description" alt="image alt" %}}

notice

{{% notice note %}}
A notice disclaimer
{{% /notice %}}