add opengraph metadata for preview cards

This commit is contained in:
xenofem 2022-06-29 20:00:58 -04:00
parent b0a2f7ec7c
commit 16e7ea4806
7 changed files with 44 additions and 5 deletions

View file

@ -2,6 +2,19 @@
{% block title %}{{ info.file.name }} - transbeam{% endblock %}
{% block og_title %}{{ info.file.name }}{% endblock %}
{% block og_description -%}
{% let formatted_total_size = bytesize::to_string(info.file.size.clone(), false).replace(" ", "") -%}
{% match info.file.contents -%}
{% when Some with (files) -%}
{{ files.len() }} files, {{ formatted_total_size }} total
{%- else -%}
{{ formatted_total_size }}
{%- endmatch %}, expires {{ info.file.expiry.format(DATE_DISPLAY_FORMAT).unwrap() }}
{%- endblock %}
{% block relative_path %}download?code={{ info.code }}{% endblock %}
{% block head %}
<script src="js/util.js?{{ cachebuster }}"></script>
<script type="text/javascript">