jekyll-theme-hamilton 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -0
- data/_includes/image.html +9 -2
- data/_sass/hamilton/base.scss +1 -3
- data/_sass/hamilton/layout.scss +1 -1
- data/_sass/hamilton/skin.scss +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4c330dbb5bda150852ec2f29385968f2746e471deb102eac10be3fee3b9a8fb
|
4
|
+
data.tar.gz: d25595bd3e27e95dd13e2bbcdd0bfe9b3f5da30bbd5f54bea15ef99fc6c32055
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f281e92a5cfe9e997166c29d935ddf4384013d09dbf3dbbbe385c50d745e32733bf9dd257e3e70657ae09086a6c878b8fa141bacb2e86bc35c86090588a285a
|
7
|
+
data.tar.gz: 8e455ab4408e1948722dc1ff59fd76b0cab04434804a04e1cc0db8df17d57d618aef70249268c6835da7af94891b9cc8cf3154810c91ff6ba69610eba31fdad8
|
data/README.md
CHANGED
@@ -19,6 +19,7 @@ Please check out the [demo](https://ngzhio.github.io/jekyll-theme-hamilton/).
|
|
19
19
|
- Configurable page navigation
|
20
20
|
- Customizable styles and skins
|
21
21
|
- Archive pages implemented in pure Liquid
|
22
|
+
- An elegant way to import images on posts
|
22
23
|
|
23
24
|
## Table of Contents <!-- omit in toc -->
|
24
25
|
|
@@ -27,6 +28,7 @@ Please check out the [demo](https://ngzhio.github.io/jekyll-theme-hamilton/).
|
|
27
28
|
- [Optional Parameters](#optional-parameters)
|
28
29
|
- [Archive Pages](#archive-pages)
|
29
30
|
- [MathJax](#mathjax)
|
31
|
+
- [Images](#images)
|
30
32
|
- [Customization](#customization)
|
31
33
|
- [Metadata](#metadata)
|
32
34
|
- [Navigation](#navigation)
|
@@ -109,6 +111,30 @@ layout: archive-years
|
|
109
111
|
|
110
112
|
You can enable MathJax on each post or page, just set `math: true` on that page.
|
111
113
|
|
114
|
+
## Images
|
115
|
+
|
116
|
+
Hamilton provides a template [`image.html`](_includes/image.html) to let you import images on each post through an elegant way. For example,
|
117
|
+
|
118
|
+
```liquid
|
119
|
+
{% include image.html src="the/path/to/the/image" %}
|
120
|
+
```
|
121
|
+
|
122
|
+
By default, the alignment of the image is center, but you can configure the alignment to left or right by passing a parameter `align`, for example,
|
123
|
+
|
124
|
+
```liquid
|
125
|
+
{% include image.html src="the/path/to/the/image" align="left" %}
|
126
|
+
```
|
127
|
+
|
128
|
+
You can also configure the width and height of the image,
|
129
|
+
|
130
|
+
```liquid
|
131
|
+
{% include image.html src="the/path/to/the/image" width="50%" height="128px" %}
|
132
|
+
```
|
133
|
+
|
134
|
+
Besides, you can pass the `caption` parameter to the include, then it will wrap the `img` with a `figure` block; alternatively, you can pass the `alt` parameter to the include.
|
135
|
+
|
136
|
+
If you feel that passing a long path to the image to the include is ugly and wasting time, you can replace the `src` parameter with the `name` parameter, which is just the name of the image, and by default, the path would be `assets/img/{{ page.title | slugify}}/{{ include.name }}`.
|
137
|
+
|
112
138
|
## Customization
|
113
139
|
|
114
140
|
### Metadata
|
data/_includes/image.html
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
{% capture align %}align-{{ include.align | default: "center" }}{% endcapture %}
|
2
|
+
|
3
|
+
{%- if include.src -%}
|
4
|
+
{% assign src = include.src %}
|
5
|
+
{%- elsif include.name -%}
|
6
|
+
{% capture src %}assets/img/{{ page.title | slugify }}/{{ include.name }}{% endcapture %}
|
7
|
+
{%- endif -%}
|
8
|
+
|
2
9
|
{% if include.caption %}
|
3
10
|
<figure class="{{ align }}">
|
4
|
-
<img class="{{ align }}" src="{{
|
11
|
+
<img class="{{ align }}" src="{{ src | absolute_url }}" alt="{{ include.caption }}" {% if include.width %}width="{{ include.width }}"{% endif %} {% if include.height %}height="{{ include.height }}"{% endif %}/>
|
5
12
|
<figcaption class="{{ align }}">{{ include.caption }}</figcaption>
|
6
13
|
</figure>
|
7
14
|
{% else %}
|
8
|
-
<img class="{{ align }}" src="{{
|
15
|
+
<img class="{{ align }}" src="{{ src | absolute_url }}" alt="{{ include.alt }}" {% if include.width %}width="{{ include.width }}"{% endif %} {% if include.height %}height="{{ include.height }}"{% endif %}/>
|
9
16
|
{% endif %}
|
data/_sass/hamilton/base.scss
CHANGED
data/_sass/hamilton/layout.scss
CHANGED
data/_sass/hamilton/skin.scss
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-hamilton
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shangzhi Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|