Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image alt attribute to the from the top of the post contents #271

Merged
merged 3 commits into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ <h1 data-toc-skip>{{ page.title }}</h1>
<div class="post-content">

{% if page.image %}
<img src="{{ page.image }}" class="preview-img" alt="Preview Image">
<img src="{{ page.image.src }}" class="preview-img" alt="{{ page.image.alt }}" />
{% endif %}

{{ content }}
Expand Down
12 changes: 11 additions & 1 deletion _posts/2019-08-08-write-a-new-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,20 @@ If you want to add an image to the top of the post contents, specify the url for

```yaml
---
image: /path/to/image-file
image:
src: /path/to/image-file
---
```

### Image alt attribute

If you want to add the "alt attribute" to the image at the top of the post contents, specify it by:
```yaml
---
image:
alt: image alternative text
```

### Image caption

Add italics to the next line of an image,then it will become the caption and appear at the bottom of the image:
Expand Down