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

View file

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

View file

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