mirror of
https://github.com/MathiasDPX/blog.git
synced 2025-05-09 15:13:09 +00:00
Add attachments to scrapbook
This commit is contained in:
parent
4a8e87142b
commit
789a7fa2bb
1 changed files with 22 additions and 0 deletions
|
@ -2,6 +2,15 @@
|
|||
|
||||
{% block head %}
|
||||
<title>Scrapbook</title>
|
||||
|
||||
<style>
|
||||
img, video {
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
@ -20,6 +29,19 @@
|
|||
{% endif %}
|
||||
<summary>{{ moment(post.postedAt).format('DD/MM/YYYY @ HH[h]mm') }}</summary>
|
||||
<div>{{ post.text | formatContent |safe }}</div>
|
||||
{% for attachment in post.attachments %}
|
||||
<br>
|
||||
{% if attachment.endswith(('.jpg', '.jpeg', '.png', '.gif', '.webp', '.svg', '.bmp')) %}
|
||||
<img src="{{ attachment }}" alt="Image">
|
||||
{% elif attachment.endswith(('.mp4', '.webm', '.ogg', '.mov', '.avi')) %}
|
||||
<video controls>
|
||||
<source src="{{ attachment }}" type="video/{{ attachment.split('.')[-1] }}">
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
{% else %}
|
||||
<p>URL does not appear to be an image or video: {{ attachment }}</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</details>
|
||||
{% endfor %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue