Compare commits

..
2 Commits
Author SHA1 Message Date
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
2 changed files with 28 additions and 24 deletions
+26 -16
View File
@@ -1,44 +1,54 @@
![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 Extended version ≥ 0.74.0**.
It's built and tested on version 0.74, might not work correctly on older versions of Hugo.
## 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)
+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 }}