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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5645fb9778838423d8c2a7e7b3ed266aac69a656d38444d8ece92b74f1958eac
4
- data.tar.gz: 81d332f313d19a3934e7647bb0d2850cfab5486b864949d600b65cb550cca30a
3
+ metadata.gz: f4c330dbb5bda150852ec2f29385968f2746e471deb102eac10be3fee3b9a8fb
4
+ data.tar.gz: d25595bd3e27e95dd13e2bbcdd0bfe9b3f5da30bbd5f54bea15ef99fc6c32055
5
5
  SHA512:
6
- metadata.gz: f79d43c995d3920e4c041b089f4306c18a0fcdbc3433c480feae728872b4c909a6c8775cd7a12b5dea948bb100449933ad8ab386ad606dd91f71e3036220b8a7
7
- data.tar.gz: f0e872a09ea5f678b0631317c408a98a553afed6d9e302b189df29bab38cf34dd16357ddcbc943785e2fcd58c8201cb50585e3c4a18807455cb2f829c3716e24
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="{{ include.src | absolute_url }}" alt="{{ include.caption }}" {% if include.width %}width="{{ include.width }}"{% endif %} {% if include.height %}height="{{ include.height }}"{% endif %}/>
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="{{ include.src | absolute_url }}" alt="{{ include.alt }}" {% if include.width %}width="{{ include.width }}"{% endif %} {% if include.height %}height="{{ include.height }}"{% endif %}/>
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 %}
@@ -101,9 +101,7 @@ a {
101
101
  */
102
102
  blockquote {
103
103
  border-left: 0.3em solid;
104
- padding-left: $spacing-unit / 2;
105
- padding-top: $spacing-unit / 4;
106
- padding-bottom: $spacing-unit / 4;
104
+ padding: $spacing-unit;
107
105
  font-style: italic;
108
106
 
109
107
  > :last-child {
@@ -343,7 +343,7 @@ figcaption.align-center {
343
343
 
344
344
 
345
345
  .social-icons {
346
- padding: $spacing-unit 0;
346
+ margin-bottom: $spacing-unit;
347
347
 
348
348
  .social-icon {
349
349
  margin: 0.3em;
@@ -18,6 +18,7 @@ a {
18
18
  }
19
19
 
20
20
  blockquote {
21
+ background-color: $border-color-light;
21
22
  color: $text-color-light;
22
23
  border-left-color: $border-color;
23
24
  }
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.1.2
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-10 00:00:00.000000000 Z
11
+ date: 2020-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll