feat: support showing description of preview image

Also moved the image position to the metadata area
This commit is contained in:
Cotes Chung 2022-04-26 03:03:34 +08:00
parent 135a16f13e
commit 2bd6efa95a
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
3 changed files with 30 additions and 26 deletions

View file

@ -11,31 +11,9 @@ tail_includes:
{% include lang.html %}
{% if page.image.path %}
{% capture bg %}
{% unless page.image.no_bg %}{{ 'bg' }}{% endunless %}
{% endcapture %}
<img src="{{ page.image.path }}" class="preview-img {{ bg | strip }}"
alt="{{ page.image.alt | default: "Preview Image" }}"
{% if page.image.width %}
width="{{ page.image.width }}"
{% elsif page.image.w %}
width="{{ page.image.w }}"
{% endif %}
{% if page.image.height %}
height="{{ page.image.height }}"
{% elsif page.image.h %}
height="{{ page.image.h }}"
{% endif %}>
{% endif %}
<h1 data-toc-skip>{{ page.title }}</h1>
<div class="post-meta text-muted">
<div>
<!-- published date -->
<span>
{{ site.data.locales[lang].post.posted }}
@ -49,7 +27,34 @@ tail_includes:
{% include datetime.html date=page.last_modified_at tooltip=true %}
</span>
{% endif %}
</div>
{% if page.image.path %}
{% 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 }}"
alt="{{ page.image.alt | default: "Preview Image" }}"
{% if page.image.width %}
width="{{ page.image.width }}"
{% elsif page.image.w %}
width="{{ page.image.w }}"
{% endif %}
{% if page.image.height %}
height="{{ page.image.height }}"
{% elsif page.image.h %}
height="{{ page.image.h }}"
{% endif %}>
{% if page.image.alt %}
<figcaption class="pt-2 pb-2">{{ page.image.alt }}</figcaption>
{% endif %}
</div>
{% endif %}
<div class="d-flex justify-content-between">
<!-- author -->

View file

@ -441,7 +441,7 @@ img[data-src] {
margin-right: 2px;
}
&:hover {
&:not([class]):hover {
@extend %link-hover;
}
}

View file

@ -41,8 +41,7 @@ h1 + .post-meta {
}
img.preview-img {
margin-top: 3.75rem;
margin-bottom: 0;
margin: 0;
border-radius: 6px;
&.bg[data-loaded=true] {