Compare commits

...
13 Commits
Author SHA1 Message Date
Jimmy Cai 779982eb95 doc: update theme.toml 2020-09-13 12:27:14 +02:00
Jimmy Cai a750e02629 doc: add screenshots 2020-09-13 12:24:07 +02:00
Jimmy Cai f26a9fa070 feat: add support for non-extended version of Hugo
resources folder is included now, with compiled SCSS file
2020-09-13 12:16:43 +02:00
Jimmy Cai b06910fc5d feat: add avatar placeholder to assets/img 2020-09-13 11:30:31 +02:00
Jimmy Cai c12de4db04 refactor: rename archive -> archives in config.toml
And rename SVG icon.
2020-09-13 11:26:12 +02:00
Jimmy Cai 7379bbe412 refactor: rename archive -> archives 2020-09-13 11:22:47 +02:00
Jimmy Cai c600f87213 feat: make archive template available for all sections 2020-09-13 11:00:19 +02:00
Jimmy Cai 45e7e07a86 refactor: change default article layout
Post layout become exclusive for `post` section (with toolbar)
Page layout become the default layout (without toolbar)
2020-09-13 10:59:52 +02:00
Jimmy Cai 294f445e0a doc(config.toml): change baseurl to https://example.com
Following Hugo theme showcase guideline
2020-09-13 10:51:31 +02:00
Jimmy Cai 2451b194dc refactor: use relLangURL to build relative links
For better i18n support

Fixes archive page path
Remove tag cloud term exclusion

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/8
2020-09-13 10:14:17 +02:00
Jimmy CaiandGitHub 822eba9513 doc(github): add issue templates 2020-09-12 23:57:44 +02:00
Jimmy Cai 929cd3c43a doc(README): update README 2020-09-12 22:34:39 +02:00
Jimmy Cai f0b3617ec4 fix(helper/image): add support for relative linked image 2020-09-12 22:14:32 +02:00
28 changed files with 186 additions and 99 deletions
+38
View File
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+27 -15
View File
@@ -1,44 +1,56 @@
![Stack](https://i.imgur.com/qj9onpz.jpg) ![Stack](https://i.imgur.com/cCiHOGS.jpg)
# Hugo Theme Stack # Hugo Theme Stack
Just another simple theme for Hugo > Card-style Hugo theme designed for bloggers.
[![Netlify Status](https://api.netlify.com/api/v1/badges/a2d2807a-a905-4bcb-97da-8da8d847da3d/deploy-status)](https://app.netlify.com/sites/hugo-theme-stack/deploys)
## Demo ## Demo
[Example Site](https://theme-stack.jimmycai.com/) [Example Site](https://theme-stack.jimmycai.com/)
[![Netlify Status](https://api.netlify.com/api/v1/badges/a2d2807a-a905-4bcb-97da-8da8d847da3d/deploy-status)](https://app.netlify.com/sites/hugo-theme-stack/deploys)
## Documentation & more information ## Documentation & more information
[Documentation](https://www.notion.so/jimmycai/Hugo-Theme-Stack-511aec5b9ed845ce9b6e3ae0bf7fb6d4) | [中文文档](https://www.notion.so/jimmycai/Hugo-Stack-511aec5b9ed845ce9b6e3ae0bf7fb6d4) [Documentation](https://www.notion.so/jimmycai/Hugo-Theme-Stack-511aec5b9ed845ce9b6e3ae0bf7fb6d4) | [中文文档](https://www.notion.so/jimmycai/Hugo-Theme-Stack-511aec5b9ed845ce9b6e3ae0bf7fb6d4)
## Features ## Introduction
- Full Vanilla JS, without jQuery Stack is a simple card-style Hugo theme designed for bloggers, some of its features are:
- No CSS framework
- PhotoSwipe integration - Responsive images support
- Responsive images - Lazy load images
- Lazy load images by default - Dark mode
- Archive page - [PhotoSwipe](https://photoswipe.com/) integration
- Dark mode - Archive page template
- Full native JavaScript, no jQuery or any other frameworks are used
- No CSS framework, keep it simple and minimal
- External dependencies (like PhotoSwipe's library) are being loaded selectively, or asynchronously
- Properly cropped thumbnails
The only JavaScript library being used is [node-vibrant](https://github.com/Vibrant-Colors/node-vibrant) for generating colour schemes for articles.
![Page Insight](https://i.imgur.com/0hUWmMh.png)
## Requirements ## Requirements
- **Hugo extended >= 0.74** This theme uses SCSS and TypeScript. For that reason, it's necessary to use **Hugo ≥ 0.74.0**.
It's built and tested on version 0.74, might not work correctly on older versions of Hugo. **Note**: You'll need Hugo Extended version to edit SCSS files
## Installation ## Installation
Clone / Download this repository to `theme` folder, and edit your site config following `exampleSite/config.toml`. Clone / Download this repository to `theme` folder, and edit your site config following `exampleSite/config.toml`.
Check [documentation](https://www.notion.so/jimmycai/Hugo-Theme-Stack-511aec5b9ed845ce9b6e3ae0bf7fb6d4) for more details.
## Copyright ## Copyright
**Licensed under the GNU General Public License v3.0** **Licensed under the GNU General Public License v3.0**
Please do not remove the "*Theme Stack designed by Jimmy*" text and link. Please do not remove the "*Theme Stack designed by Jimmy*" text and link.
If you want to port this theme to another blogging platform, please let me know🙏.
## Thanks to ## Thanks to
- [Vibrant-Colors/node-vibrant](https://github.com/Vibrant-Colors/node-vibrant) - [Vibrant-Colors/node-vibrant](https://github.com/Vibrant-Colors/node-vibrant)

Before

Width:  |  Height:  |  Size: 432 B

After

Width:  |  Height:  |  Size: 432 B

Before

Width:  |  Height:  |  Size: 373 B

After

Width:  |  Height:  |  Size: 373 B

@@ -1,6 +1,6 @@
.archive-group { .archives-group {
margin-bottom: var(--section-separation); margin-bottom: var(--section-separation);
.archive-date { .archives-date {
text-transform: uppercase; text-transform: uppercase;
margin-bottom: 10px; margin-bottom: 10px;
font-size: 1.6rem; font-size: 1.6rem;
@@ -12,7 +12,7 @@
} }
} }
.template-archive { .template-archives {
.category-list { .category-list {
margin-bottom: var(--section-separation); margin-bottom: var(--section-separation);
overflow-x: auto; overflow-x: auto;
+3 -3
View File
@@ -43,9 +43,9 @@
} }
} }
/* Archive widget */ /* Archives widget */
.widget.archive { .widget.archives {
.archive-year { .archives-year {
margin-bottom: 10px; margin-bottom: 10px;
a { a {
background-color: var(--card-background); background-color: var(--card-background);
+1 -1
View File
@@ -18,7 +18,7 @@
@import "partials/pagination.scss"; @import "partials/pagination.scss";
@import "partials/sidebar.scss"; @import "partials/sidebar.scss";
@import "partials/base.scss"; @import "partials/base.scss";
@import "partials/layout/archive.scss"; @import "partials/layout/archives.scss";
@import "partials/layout/article.scss"; @import "partials/layout/article.scss";
@import "partials/layout/taxonomy.scss"; @import "partials/layout/taxonomy.scss";
@import "partials/layout/404.scss"; @import "partials/layout/404.scss";
+9 -9
View File
@@ -1,4 +1,4 @@
baseurl = "https://theme-stack.jimmycai.com/" baseurl = "https://example.com"
languageCode = "en-us" languageCode = "en-us"
theme = "hugo-theme-stack" theme = "hugo-theme-stack"
paginate = 5 paginate = 5
@@ -29,11 +29,11 @@ DefaultContentLanguage = "en" # Theme i18n support
# Only Disqus is available so far # Only Disqus is available so far
provider = "disqus" provider = "disqus"
[params.widgets] [params.widgets]
enabled = ['archive', 'tag-cloud'] enabled = ['archives', 'tag-cloud']
[params.widgets.archive] [params.widgets.archives]
limit = 5 limit = 5
### Archive page relative URL ### Archives page relative URL
path = "archive" path = "archives"
[params.widgets.tagCloud] [params.widgets.tagCloud]
limit = 10 limit = 10
[params.opengraph] [params.opengraph]
@@ -68,11 +68,11 @@ DefaultContentLanguage = "en" # Theme i18n support
weight = -90 weight = -90
pre = "user" pre = "user"
[[menu.main]] [[menu.main]]
identifier = "archive" identifier = "archives"
name = "Archive" name = "Archives"
url = "/archive/" url = "/archives/"
weight = -70 weight = -70
pre = "archive" pre = "archives"
[related] [related]
includeNewer = true includeNewer = true
-6
View File
@@ -1,6 +0,0 @@
---
title: "Archive"
date: 2019-05-28
layout: "archive"
slug: "archive"
---
+6
View File
@@ -0,0 +1,6 @@
---
title: "Archives"
date: 2019-05-28
layout: "archives"
slug: "archives"
---
+3 -3
View File
@@ -7,10 +7,10 @@
[lastUpdatedOn] [lastUpdatedOn]
other ="Last updated on {{ .Count }}" other ="Last updated on {{ .Count }}"
[widgetArchiveTitle] [widgetArchivesTitle]
other = "Archive" other = "Archives"
[widgetArchiveMore] [widgetArchivesMore]
other = "More" other = "More"
[widgetTagCloudTitle] [widgetTagCloudTitle]
+2 -2
View File
@@ -7,10 +7,10 @@
[lastUpdatedOn] [lastUpdatedOn]
other ="最后更新于 {{ .Count }}" other ="最后更新于 {{ .Count }}"
[widgetArchiveTitle] [widgetArchivesTitle]
other = "归档" other = "归档"
[widgetArchiveMore] [widgetArchivesMore]
other = "更多" other = "更多"
[widgetTagCloudTitle] [widgetTagCloudTitle]
Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

@@ -1,4 +1,4 @@
{{ define "body-class" }}template-archive{{ end }} {{ define "body-class" }}template-archives{{ end }}
{{ define "main" }} {{ define "main" }}
{{ $categories := ($.Site.GetPage "taxonomyTerm" "categories").Pages }} {{ $categories := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
{{ if $categories }} {{ if $categories }}
@@ -20,8 +20,8 @@
{{ range $filtered.GroupByDate "2006" }} {{ range $filtered.GroupByDate "2006" }}
{{ $id := lower (replace .Key " " "-") }} {{ $id := lower (replace .Key " " "-") }}
<div class="archive-group" id="{{ $id }}"> <div class="archives-group" id="{{ $id }}">
<h3 class="archive-date"><a href="{{ $.Permalink }}#{{ $id }}">{{ .Key }}</a></h3> <h3 class="archives-date"><a href="{{ $.Permalink }}#{{ $id }}">{{ .Key }}</a></h3>
<div class="article-list--compact"> <div class="article-list--compact">
{{ range .Pages }} {{ range .Pages }}
{{ partial "article-list/compact" . }} {{ partial "article-list/compact" . }}
+2 -11
View File
@@ -1,21 +1,12 @@
{{ define "container-class" }}article-page with-toolbar{{ end }} {{ define "body-class" }}article-page keep-sidebar{{ end }}
{{ define "main" }} {{ define "main" }}
<div id="article-toolbar">
<a href="{{ .Site.BaseURL }}" class="back-home">
{{ (resources.Get "icons/back.svg").Content | safeHTML }}
<span>Back</span>
</a>
</div>
{{ partial "article/article.html" . }} {{ partial "article/article.html" . }}
{{ partial "article/components/related-contents" . }}
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}} {{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
{{ partial "comments/include" . }} {{ partial "comments/include" . }}
{{ end }} {{ end }}
{{ partialCached "footer/footer" . }} {{ partialCached "footer/footer" . }}
{{- partial "article/components/photoswipe.html" . -}} {{ partial "article/components/photoswipe" . }}
{{ end }} {{ end }}
-12
View File
@@ -1,12 +0,0 @@
{{ define "body-class" }}article-page keep-sidebar{{ end }}
{{ define "main" }}
{{ partial "article/article.html" . }}
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
{{ partial "comments/include" . }}
{{ end }}
{{ partialCached "footer/footer" . }}
{{ partial "article/components/photoswipe" . }}
{{ end }}
@@ -7,10 +7,10 @@
{{ if and $image.exists $image.resource }} {{ if and $image.exists $image.resource }}
{{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}} {{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}}
{{- $20x := $imageRaw.Fill "20x20 smart" -}} {{- $20x := $imageRaw.Fill "20x20 smart" -}}
<a href="/categories/{{ . | urlize }}" class="color-tag" <a href="{{ printf `categories/%s` (. | urlize) | relLangURL }}" class="color-tag"
data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ . | humanize }}</a> data-image="{{ $20x.RelPermalink }}" data-key="{{ $context.Slug }}" data-hash="{{ $imageRaw.Data.Integrity }}">{{ . | humanize }}</a>
{{ else }} {{ else }}
<a href="/categories/{{ . | urlize }}">{{ . | humanize }}</a> <a href="{{ printf `categories/%s` (. | urlize) | relLangURL }}">{{ . | humanize }}</a>
{{ end }} {{ end }}
{{ end }} {{ end }}
</header> </header>
@@ -2,7 +2,7 @@
{{ with $tags := .Params.Tags }} {{ with $tags := .Params.Tags }}
<section class="article-tags"> <section class="article-tags">
{{ range $tags }} {{ range $tags }}
<a href="/tags/{{ . | urlize }}">{{ . | humanize }}</a> <a href="{{ printf `tags/%s` (. | urlize) | relLangURL }}">{{ . | humanize }}</a>
{{ end }} {{ end }}
</section> </section>
{{ end }} {{ end }}
+2 -8
View File
@@ -12,20 +12,14 @@
{{ $result = merge $result (dict "permalink" $imageValue) }} {{ $result = merge $result (dict "permalink" $imageValue) }}
{{ else }} {{ else }}
{{ $pageResourceImage := .Context.Resources.GetMatch (printf "%s" ($imageValue | safeURL)) }} {{ $pageResourceImage := .Context.Resources.GetMatch (printf "%s" ($imageValue | safeURL)) }}
{{ $siteResourceImage := resources.GetMatch (printf "%s" ($imageValue | safeURL)) }}
{{ if $pageResourceImage }} {{ if $pageResourceImage }}
<!-- If image is found under page bundle --> <!-- If image is found under page bundle -->
{{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }} {{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }}
{{ $result = merge $result (dict "resource" $pageResourceImage) }} {{ $result = merge $result (dict "resource" $pageResourceImage) }}
{{ else if $siteResourceImage }}
<!-- Try search image under site's assets folder -->
{{ $result = merge $result (dict "permalink" $siteResourceImage.RelPermalink) }}
{{ $result = merge $result (dict "resource" $siteResourceImage) }}
{{ else }} {{ else }}
<!-- Can not find the image --> <!-- Can not find the image under page bundle. Could be a relative linked image -->
{{ errorf "Failed loading image: %q" $imageValue }} {{ $result = merge $result (dict "permalink" $imageValue) }}
{{ $result = merge $result (dict "exists" false) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
@@ -1,28 +1,28 @@
<section class="widget archive"> <section class="widget archives">
<div class="widget-icon"> <div class="widget-icon">
{{ (resources.Get "icons/infinity.svg").Content | safeHTML }} {{ (resources.Get "icons/infinity.svg").Content | safeHTML }}
</div> </div>
<h1 class="widget-title">{{ T "widgetArchiveTitle" }}</h1> <h1 class="widget-title">{{ T "widgetArchivesTitle" }}</h1>
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
{{ $filtered := ($pages | intersect $notHidden) }} {{ $filtered := ($pages | intersect $notHidden) }}
{{ $archive := $filtered.GroupByDate "2006" }} {{ $archives := $filtered.GroupByDate "2006" }}
{{ range first .Site.Params.widgets.archive.limit ($archive) }} {{ range first .Site.Params.widgets.archives.limit ($archives) }}
{{ $id := lower (replace .Key " " "-") }} {{ $id := lower (replace .Key " " "-") }}
<div class="archive-year"> <div class="archives-year">
<a href="{{ $.Site.BaseURL }}{{ $.Site.Params.widgets.archive.path }}#{{ $id }}"> <a href="{{ $.Site.Params.widgets.archives.path | relLangURL }}#{{ $id }}">
<span class="year">{{ .Key }}</span> <span class="year">{{ .Key }}</span>
<span class="count">{{ len .Pages }}</span> <span class="count">{{ len .Pages }}</span>
</a> </a>
</div> </div>
{{ end }} {{ end }}
{{ if gt (len $archive) .Site.Params.widgets.archive.limit }} {{ if gt (len $archives) .Site.Params.widgets.archives.limit }}
<div class="archive-year"> <div class="archives-year">
<a href="{{ $.Site.BaseURL }}/archive"> <a href="{{ $.Site.Params.widgets.archives.path | relLangURL }}">
<span class="year">{{ T "widgetArchiveMore" }}</span> <span class="year">{{ T "widgetArchivesMore" }}</span>
</a> </a>
</div> </div>
{{ end }} {{ end }}
+2 -3
View File
@@ -1,5 +1,4 @@
{{ $tags := .Site.Taxonomies.tags.ByCount }} {{ $tags := .Site.Taxonomies.tags.ByCount }}
{{ $v2 := where $tags "Term" "not in" (slice "hugo" "tag" "rss") }}
<section class="widget tagCloud"> <section class="widget tagCloud">
<div class="widget-icon"> <div class="widget-icon">
@@ -8,8 +7,8 @@
<h1 class="widget-title">{{ T "widgetTagCloudTitle" }}</h1> <h1 class="widget-title">{{ T "widgetTagCloudTitle" }}</h1>
<div class="tagCloud-tags"> <div class="tagCloud-tags">
{{ range first .Site.Params.widgets.tagCloud.limit $v2 }} {{ range first .Site.Params.widgets.tagCloud.limit $tags }}
<a href="{{ $.Site.BaseURL }}tags/{{ .Term | urlize }}/" class="font_size_{{ .Count }}"> <a href="{{ printf `tags/%s` (.Term | urlize) | relLangURL }}" class="font_size_{{ .Count }}">
{{ .Term | humanize }} {{ .Term | humanize }}
</a> </a>
{{ end }} {{ end }}
+21
View File
@@ -0,0 +1,21 @@
{{ define "container-class" }}article-page with-toolbar{{ end }}
{{ define "main" }}
<div id="article-toolbar">
<a href="{{ .Site.BaseURL }}" class="back-home">
{{ (resources.Get "icons/back.svg").Content | safeHTML }}
<span>Back</span>
</a>
</div>
{{ partial "article/article.html" . }}
{{ partial "article/components/related-contents" . }}
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
{{ partial "comments/include" . }}
{{ end }}
{{ partialCached "footer/footer" . }}
{{- partial "article/components/photoswipe.html" . -}}
{{ end }}
+3 -3
View File
@@ -6,12 +6,12 @@
HUGO_THEME = "repo" HUGO_THEME = "repo"
[context.production] [context.production]
command = "cd exampleSite && hugo --gc --themesDir ../.." command = "cd exampleSite && hugo --gc --themesDir ../.. -b ${URL}"
[context.production.environment] [context.production.environment]
HUGO_ENV = "production" HUGO_ENV = "production"
[context.branch-deploy] [context.branch-deploy]
command = "cd exampleSite && hugo --gc --themesDir ../.. -b ${DEPLOY_PRIME_URL}/" command = "cd exampleSite && hugo --gc --themesDir ../.. -b ${DEPLOY_PRIME_URL}"
[context.deploy-preview] [context.deploy-preview]
command = "cd exampleSite && hugo --gc --themesDir ../.. -b ${DEPLOY_PRIME_URL}/" command = "cd exampleSite && hugo --gc --themesDir ../.. -b ${DEPLOY_PRIME_URL}"
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"Target":"scss/style.min.css","MediaType":"text/css","Data":{}}
+15 -3
View File
@@ -4,10 +4,22 @@
name = "Stack" name = "Stack"
license = "GPL-3.0-only" license = "GPL-3.0-only"
licenselink = "https://github.com/CaiJimmy/hugo-theme-stack/blob/master/LICENSE" licenselink = "https://github.com/CaiJimmy/hugo-theme-stack/blob/master/LICENSE"
description = "Just another simple Hugo theme" description = "Card-style Hugo theme designed for bloggers"
homepage = "https://blog.jimmycai.com/p/hugo-theme-stack" homepage = "https://blog.jimmycai.com/p/hugo-theme-stack"
tags = [] tags = [
features = [] "blog",
"responsive",
"clean",
"light",
"dark",
"personal"
]
features = [
"disqus",
"photoswipe",
"opengraph",
"widgets"
]
min_version = "0.74.0" min_version = "0.74.0"
[author] [author]