|
1 | | -<!-- |
2 | | - Refactor the HTML structure. |
3 | | ---> |
| 1 | +<!-- Refactor the HTML structure --> |
4 | 2 |
|
5 | 3 | {% assign _content = include.content %} |
6 | 4 |
|
|
44 | 42 | {% endif %} |
45 | 43 |
|
46 | 44 | <!-- images --> |
| 45 | +{% assign IMG_TAG = '<img ' %} |
47 | 46 |
|
48 | | -{% if _content contains '<img' %} |
49 | | - {% assign IMG_TAG = '<img ' %} |
| 47 | +{% if _content contains IMG_TAG %} |
50 | 48 | {% assign _img_content = nil %} |
51 | 49 | {% assign _img_snippets = _content | split: IMG_TAG %} |
52 | 50 |
|
|
160 | 158 | <!-- Bypass the HTML-proofer test --> |
161 | 159 | {% assign _left = _left | append: ' data-proofer-ignore' %} |
162 | 160 |
|
163 | | - {% if page.layout == 'post' %} |
| 161 | + {% if page.layout == 'home' %} |
| 162 | + <!-- create the image wrapper --> |
| 163 | + {%- capture _wrapper_start -%} |
| 164 | + <div class="preview-img {{ _class | strip }}"> |
| 165 | + {%- endcapture -%} |
| 166 | + {% assign _img_content = _img_content | append: _wrapper_start %} |
| 167 | + {% assign _right = _right | prepend: '></div' %} |
| 168 | + |
| 169 | + {% else %} |
164 | 170 | <!-- make sure the `<img>` is wrapped by `<a>` --> |
165 | 171 | {% assign _parent = _right | slice: 1, 4 %} |
166 | 172 |
|
|
179 | 185 | {% assign _img_content = _img_content | append: _wrapper_start %} |
180 | 186 | {% assign _right = _right | prepend: '></a' %} |
181 | 187 | {% endif %} |
182 | | - |
183 | | - {% endif %} |
184 | | - |
185 | | - {% if page.layout == 'home' %} |
186 | | - <!-- create the image wrapper --> |
187 | | - {%- capture _wrapper_start -%} |
188 | | - <div class="preview-img {{ _class | strip }}"> |
189 | | - {%- endcapture -%} |
190 | | - {% assign _img_content = _img_content | append: _wrapper_start %} |
191 | | - {% assign _right = _right | prepend: '></div' %} |
192 | 188 | {% endif %} |
193 | 189 |
|
194 | 190 | <!-- combine --> |
|
0 commit comments