1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

refactor: enhance the setting of preview image path

This commit is contained in:
Cotes Chung
2022-11-18 22:16:35 +08:00
parent f6e9a3fccf
commit da7d7e25b6
3 changed files with 9 additions and 14 deletions

View File

@@ -26,13 +26,13 @@ tail_includes:
</span>
{% endif %}
{% if page.image.path %}
{% if page.image %}
{% capture bg %}
{% unless page.image.no_bg %}{{ 'bg' }}{% endunless %}
{% endcapture %}
<div class="mt-3 mb-3">
<img src="{{ page.image.path }}" class="preview-img {{ bg | strip }}"
<img src="{{ page.image.path | default: page.image }}" class="preview-img {{ bg | strip }}"
alt="{{ page.image.alt | default: "Preview Image" }}"
{% if page.image.width %}