mobile grid bug fixed, header customization support
This commit is contained in:
parent
b6a4eb268a
commit
aa53cfd1e9
110
README.md
110
README.md
|
@ -1,6 +1,6 @@
|
||||||
# Zzo theme for Hugo
|
# 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](https://github.com/zzossig/hugo-theme-zzo/issues) issue or pull request so that I can make this theme better.
|
Thank you for click me!. Zzo theme is a blog theme powered by Hugo with free(always), and many features.
|
||||||
|
|
||||||
## Table of contents
|
## Table of contents
|
||||||
|
|
||||||
|
@ -219,8 +219,7 @@ custom_css = []
|
||||||
custom_js = []
|
custom_js = []
|
||||||
|
|
||||||
# header
|
# header
|
||||||
homeHeaderType = "slide" # text, img, slide
|
homeHeaderType = "img" # text, img, slide
|
||||||
swiperCount = 3 # only works when homeHeaderType = slide
|
|
||||||
|
|
||||||
# body
|
# body
|
||||||
enableBreadcrumb = true
|
enableBreadcrumb = true
|
||||||
|
@ -235,13 +234,13 @@ archivePaginate = 20
|
||||||
paginateWindow = 1
|
paginateWindow = 1
|
||||||
|
|
||||||
# whoami
|
# whoami
|
||||||
myname = "zzossig"
|
myname = ""
|
||||||
email = "zzossig@gmail.com"
|
email = ""
|
||||||
whoami = "Web Developer"
|
whoami = ""
|
||||||
useGravatar = false
|
useGravatar = false
|
||||||
location = "Seoul, Korea"
|
location = ""
|
||||||
organization = "Hugo"
|
organization = ""
|
||||||
link = "https://github.com/zzossig/hugo-theme-zzo"
|
link = ""
|
||||||
|
|
||||||
# sidebar
|
# sidebar
|
||||||
enableBio = true
|
enableBio = true
|
||||||
|
@ -553,33 +552,86 @@ single_contents = "'Merriweather', serif"
|
||||||
|
|
||||||
You may want to change home page header. There are 4 options which is slider, image, text, empty.
|
You may want to change home page header. There are 4 options which is slider, image, text, empty.
|
||||||
|
|
||||||
* Empty
|
1. Set param at config/_default/params.toml(homeHeaderType)
|
||||||
|
|
||||||
1. Set params at config/_default/params.toml(homeHeaderType=""). Empty string or just delete it.
|
2. Make _index.md file at root/content/_index.md and copy & paste below.
|
||||||
|
|
||||||
* Slider
|
```yaml
|
||||||
This project use swiper library for slider header component.
|
---
|
||||||
|
header:
|
||||||
|
- type: text
|
||||||
|
height: 235
|
||||||
|
paddingX: 50
|
||||||
|
paddingY: 0
|
||||||
|
align: left
|
||||||
|
title:
|
||||||
|
- header title1
|
||||||
|
- header title2
|
||||||
|
subtitle:
|
||||||
|
- header subtitle1
|
||||||
|
- header subtitle2
|
||||||
|
titleFontSize: 44
|
||||||
|
subtitleFontSize: 16
|
||||||
|
spaceBetweenTitleSubtitle: 20
|
||||||
|
|
||||||
1. Set params at config/_default/params.toml(homeHeaderType="slide", swiperCount).
|
- type: img
|
||||||
|
image: images/header/background.png
|
||||||
|
height: 235
|
||||||
|
paddingX: 50
|
||||||
|
paddingY: 0
|
||||||
|
align: center
|
||||||
|
title:
|
||||||
|
- header title1
|
||||||
|
- header title2
|
||||||
|
subtitle:
|
||||||
|
- header subtitle1
|
||||||
|
- header subtitle2
|
||||||
|
titleFontSize: 44
|
||||||
|
subtitleFontSize: 16
|
||||||
|
spaceBetweenTitleSubtitle: 20
|
||||||
|
|
||||||
2. Make slide-{number}.html file to layouts/partials/header folder.
|
- type: slide
|
||||||
|
height: 235
|
||||||
|
slide:
|
||||||
|
- paddingX: 50
|
||||||
|
paddingY: 0
|
||||||
|
align: left
|
||||||
|
image: images/header/background.png
|
||||||
|
title:
|
||||||
|
- header title1
|
||||||
|
subtitle:
|
||||||
|
- header subtitle1
|
||||||
|
titleFontSize: 44
|
||||||
|
subtitleFontSize: 16
|
||||||
|
spaceBetweenTitleSubtitle: 20
|
||||||
|
|
||||||
3. Make swiper.json file that contains options to data folder.
|
- paddingX: 50
|
||||||
|
paddingY: 0
|
||||||
|
align: center
|
||||||
|
image: images/header/background.png
|
||||||
|
title:
|
||||||
|
- header title2
|
||||||
|
subtitle:
|
||||||
|
- header subtitle2
|
||||||
|
titleFontSize: 44
|
||||||
|
subtitleFontSize: 16
|
||||||
|
spaceBetweenTitleSubtitle: 20
|
||||||
|
|
||||||
* Image
|
- paddingX: 50
|
||||||
|
paddingY: 0
|
||||||
1. Set homeHeaderType param to "img"
|
align: right
|
||||||
|
image: images/header/background.png
|
||||||
2. Add image to static/images/header/background.jpg. Filename must be background
|
title:
|
||||||
|
- header title3
|
||||||
3. If you want add some contents, make a file at layouts/partials/header/header-img-content.html and edit as you want.
|
subtitle:
|
||||||
|
- header subtitle3
|
||||||
* Text
|
titleFontSize: 44
|
||||||
|
subtitleFontSize: 16
|
||||||
1. Make a file at layouts/partials/header/header-text.html
|
spaceBetweenTitleSubtitle: 20
|
||||||
|
---
|
||||||
2. Edit the file as you want.
|
```
|
||||||
|
|
||||||
|
3. Edit params as you wish.
|
||||||
|
|
||||||
### custom grid
|
### custom grid
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,13 @@
|
||||||
.fade-1 {
|
.hr-fade {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
$color: #595B5C;
|
|
||||||
color: $color;
|
|
||||||
background-image: linear-gradient(
|
|
||||||
90deg,
|
|
||||||
rgba($color, 0),
|
|
||||||
rgba($color, 1) 50%,
|
|
||||||
rgba($color, 0) 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-2 {
|
@include themify($themes) {
|
||||||
border-width: 0 0 1px;
|
color: themed('hr-color');
|
||||||
$color: #595B5C;
|
background-image: linear-gradient(
|
||||||
color: $color;
|
90deg,
|
||||||
border-image: linear-gradient(
|
transparent,
|
||||||
90deg,
|
themed('hr-color') 50%,
|
||||||
rgba($color, 0),
|
transparent 100%
|
||||||
rgba($color, 1) 50%,
|
);
|
||||||
rgba($color, 0) 100%) 0 0 100%;
|
}
|
||||||
border-style: solid;
|
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@ $grid_column_gap: $grid_column_gap_width + $grid_column_gap_unit;
|
||||||
grid-column-gap: $grid_column_gap;
|
grid-column-gap: $grid_column_gap;
|
||||||
grid-row-gap: $grid_row_gap;
|
grid-row-gap: $grid_row_gap;
|
||||||
@include respond-to(sm) {
|
@include respond-to(sm) {
|
||||||
grid-template-columns: minmax(350px, $grid_main_main) minmax(0, $grid_main_side);
|
grid-template-columns: minmax(0, $grid_main_main) minmax(0, $grid_main_side);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,39 @@
|
||||||
background-image: url("../images/header/background.jpg"),
|
background-image: url("../images/header/background.jpg"),
|
||||||
url("../images/header/background.png");
|
url("../images/header/background.png");
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 300px;
|
height: 235px;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-header {
|
||||||
|
@include flexbox();
|
||||||
|
@include justify-content(center);
|
||||||
|
@include flex-direction(column);
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
line-height: 1.1;
|
||||||
|
font-weight: 700;
|
||||||
|
font-family: $header_title_font;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__subtitle {
|
||||||
|
line-height: 1.2;
|
||||||
|
font-family: $header_title_font;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__align-left {
|
||||||
|
@include align-items(flex-start);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__align-center {
|
||||||
|
@include align-items(center);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__align-right {
|
||||||
|
@include align-items(flex-end);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&__title {
|
&__title {
|
||||||
margin-top: 2rem;
|
margin: 2rem 0;
|
||||||
@include themify($themes) {
|
@include themify($themes) {
|
||||||
color: themed('terms-title-color');
|
color: themed('terms-title-color');
|
||||||
text-shadow: 1px 1px 0 darken(themed('terms-title-color'), 10%),
|
text-shadow: 1px 1px 0 darken(themed('terms-title-color'), 10%),
|
||||||
|
|
|
@ -5,7 +5,6 @@ custom_js = []
|
||||||
|
|
||||||
# header
|
# header
|
||||||
homeHeaderType = "slide" # text, img, slide
|
homeHeaderType = "slide" # text, img, slide
|
||||||
swiperCount = 3 # only works when homeHeaderType = slide
|
|
||||||
|
|
||||||
# body
|
# body
|
||||||
enableBreadcrumb = true
|
enableBreadcrumb = true
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{{- $scr := .Scratch -}}
|
|
||||||
{
|
{
|
||||||
"name": "{{site.Title}}",
|
"name": "{{site.Title}}",
|
||||||
"short_name": "{{site.Title}}",
|
"short_name": "{{site.Title}}",
|
||||||
|
|
|
@ -49,16 +49,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mermaid) {
|
if (window.mermaid) {
|
||||||
if (selectedThemeVariant === "dark" || selectedThemeVariant === "hacker") {
|
if (selectedThemeVariant === "dark" || selectedThemeVariant === "hacker") {
|
||||||
mermaid.initialize({ theme: 'dark' });
|
mermaid.initialize({ theme: 'dark' });
|
||||||
location.reload();
|
location.reload();
|
||||||
} else {
|
} else {
|
||||||
mermaid.initialize({ theme: 'default' });
|
mermaid.initialize({ theme: 'default' });
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
|
@ -1 +0,0 @@
|
||||||
{{ partial "header/slide-1" . }}
|
|
|
@ -1,3 +1,37 @@
|
||||||
<div class="header__image">
|
{{ if $.Params.header }}
|
||||||
{{ partial "header/header-img-content" . }}
|
{{ range $.Params.header }}
|
||||||
</div>
|
{{ if eq .type "img" }}
|
||||||
|
<div class="custom-header custom-header__align-{{ .align }}" style="background-image: url('{{.image | relURL }}'); width: 100%; height: {{ .height }}px; padding: {{ .paddingY }}px {{ .paddingX }}px;">
|
||||||
|
{{ $header := . }}
|
||||||
|
{{ if .title }}
|
||||||
|
{{ range .title }}
|
||||||
|
<div class="custom-header__title" style="font-size: {{ $header.titleFontSize }}px;">
|
||||||
|
{{ . }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if .spaceBetweenTitleSubtitle }}
|
||||||
|
<div style="height: {{ .spaceBetweenTitleSubtitle }}px"></div>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .subtitle }}
|
||||||
|
{{ range .subtitle }}
|
||||||
|
<div class="custom-header__subtitle" style="font-size: {{ $header.subtitleFontSize }}px;">
|
||||||
|
{{ . }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ if (fileExists "static/images/header/background.png") }}
|
||||||
|
{{ $.Scratch.Set "header_background" "images/header/background.png" }}
|
||||||
|
{{ else if (fileExists "static/images/header/background.jpg") }}
|
||||||
|
{{ $.Scratch.Set "header_background" "images/header/background.jpg" }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $.Scratch.Set "header_background" "images/header/background.png" }}
|
||||||
|
{{ end }}
|
||||||
|
<div style="background-image: url('{{$.Scratch.Get "header_background" | relURL }}'); width: 100%; height: 235px;">
|
||||||
|
{{ partial "header/slide-1" . }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
|
@ -1,15 +1,48 @@
|
||||||
|
{{ if $.Params.header }}
|
||||||
<div class="swiper-container">
|
<div class="swiper-container">
|
||||||
<div class="swiper-wrapper">
|
<div class="swiper-wrapper">
|
||||||
{{ if .Site.Params.swiperCount }}
|
{{ range $.Params.header }}
|
||||||
{{ range $idx, $seq := (seq .Site.Params.swiperCount) }}
|
{{ if eq .type "slide" }}
|
||||||
<div class="swiper-slide">
|
{{ $height := .height }}
|
||||||
{{ partial (print "header/slide-" $seq) . }}
|
{{ range .slide }}
|
||||||
</div>
|
<div class="swiper-slide custom-header custom-header__align-{{ .align }}" style="background-image: url('{{.image | relURL }}'); height: {{ $height }}px;">
|
||||||
|
{{ $header := . }}
|
||||||
|
{{ if .title }}
|
||||||
|
{{ range .title }}
|
||||||
|
<div class="custom-header__title" style="font-size: {{ $header.titleFontSize }}px; padding: {{ $header.paddingY }}px {{ $header.paddingX }}px;">
|
||||||
|
{{ . }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if .spaceBetweenTitleSubtitle }}
|
||||||
|
<div style="height: {{ .spaceBetweenTitleSubtitle }}px"></div>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .subtitle }}
|
||||||
|
{{ range .subtitle }}
|
||||||
|
<div class="custom-header__subtitle" style="font-size: {{ $header.subtitleFontSize }}px; padding: {{ $header.paddingY }}px {{ $header.paddingX }}px;">
|
||||||
|
{{ . }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
<div class="swiper-pagination"></div>
|
||||||
|
</div>
|
||||||
|
{{ else }}
|
||||||
|
<div class="swiper-container">
|
||||||
|
<div class="swiper-wrapper">
|
||||||
|
{{ range $idx, $seq := (seq 3) }}
|
||||||
|
<div class="swiper-slide">
|
||||||
|
{{ partial (print "header/slide-" $seq) . }}
|
||||||
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
<div class="swiper-pagination"></div>
|
<div class="swiper-pagination"></div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ $js := .Site.Data.lib.js }}
|
{{ $js := .Site.Data.lib.js }}
|
||||||
{{ $css := .Site.Data.lib.css }}
|
{{ $css := .Site.Data.lib.css }}
|
||||||
|
@ -18,7 +51,7 @@
|
||||||
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"swiper\"></script>" $js.swiper.url $js.swiper.sri | safeHTML }}
|
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"swiper\"></script>" $js.swiper.url $js.swiper.sri | safeHTML }}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
{{ $swiper:= .Site.Data.swiper }}
|
{{ $swiper := .Site.Data.swiper }}
|
||||||
var options = JSON.parse({{ $swiper | jsonify }});
|
var options = JSON.parse({{ $swiper | jsonify }});
|
||||||
|
|
||||||
var mySwiper = new Swiper('.swiper-container', options);
|
var mySwiper = new Swiper('.swiper-container', options);
|
||||||
|
|
|
@ -1,5 +1,32 @@
|
||||||
|
{{ if $.Params.header }}
|
||||||
|
{{ range $.Params.header }}
|
||||||
|
{{ if eq .type "text" }}
|
||||||
|
<div class="custom-header custom-header__align-{{ .align }}" style="width: 100%; height: {{ .height }}px; padding: {{ .paddingY }}px {{ .paddingX }}px;">
|
||||||
|
{{ $header := . }}
|
||||||
|
{{ if .title }}
|
||||||
|
{{ range .title }}
|
||||||
|
<div class="custom-header__title" style="font-size: {{ $header.titleFontSize }}px;">
|
||||||
|
{{ . }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if .spaceBetweenTitleSubtitle }}
|
||||||
|
<div style="height: {{ .spaceBetweenTitleSubtitle }}px"></div>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .subtitle }}
|
||||||
|
{{ range .subtitle }}
|
||||||
|
<div class="custom-header__subtitle" style="font-size: {{ $header.subtitleFontSize }}px;">
|
||||||
|
{{ . }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
<div class="features-text">
|
<div class="features-text">
|
||||||
<div class="features-text__item h2">
|
<div class="features-text__item h2">
|
||||||
{{ .Site.Params.Title }}
|
{{ .Site.Params.Title }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ end }}
|
|
@ -19,13 +19,13 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr class="fade-1 sidebar-hr" />
|
<hr class="hr-fade sidebar-hr" />
|
||||||
<div class="taxo-root">
|
<div class="taxo-root">
|
||||||
{{ partial "taxonomy/taxonomy-tags" . }}
|
{{ partial "taxonomy/taxonomy-tags" . }}
|
||||||
{{ partial "taxonomy/taxonomy-categories" . }}
|
{{ partial "taxonomy/taxonomy-categories" . }}
|
||||||
{{ partial "taxonomy/taxonomy-series" . }}
|
{{ partial "taxonomy/taxonomy-series" . }}
|
||||||
</div>
|
</div>
|
||||||
<hr class="fade-1 sidebar-hr" />
|
<hr class="hr-fade sidebar-hr" />
|
||||||
{{ partial "sidebar/site-subs" . }}
|
{{ partial "sidebar/site-subs" . }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
|
@ -68,5 +68,5 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr class="fade-1 sidebar-hr"/>
|
<hr class="hr-fade sidebar-hr"/>
|
||||||
{{ end }}
|
{{ end }}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 1.5 MiB |
Loading…
Reference in New Issue