Display pages: Add OpenGraph tags for media

This commit is contained in:
Andrei Marcu 2020-05-14 01:12:24 -07:00
parent e2a65a5b62
commit 6ce2bd6b9f
4 changed files with 17 additions and 5 deletions

View File

@ -122,6 +122,7 @@ func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request, fileNam
"forcerandom": Config.forceRandomFilename, "forcerandom": Config.forceRandomFilename,
"lines": lines, "lines": lines,
"files": metadata.ArchiveFiles, "files": metadata.ArchiveFiles,
"siteurl": strings.TrimSuffix(getSiteURL(r), "/"),
}, r, w) }, r, w)
if err != nil { if err != nil {

View File

@ -1,9 +1,12 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block head %}
<meta property="og:audio" content="{{ siteurl }}{{ sitepath }}{{ selifpath }}{{ filename }}" />
{% endblock %}
{% block main %} {% block main %}
<audio class="display-audio" controls preload='auto'> <audio class="display-audio" controls preload='auto'>
<source src='{{ sitepath }}{{ selifpath }}{{ filename }}'> <source src='{{ sitepath }}{{ selifpath }}{{ filename }}'>
<a href='{{ sitepath }}{{ selifpath }}{{ filename }}'>Download it instead</a> <a href='{{ sitepath }}{{ selifpath }}{{ filename }}'>Download it instead</a>
</audio> </audio>
{% endblock %} {% endblock %}

View File

@ -1,5 +1,9 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block head %}
<meta property="og:image" content="{{ siteurl }}{{ sitepath }}{{ selifpath }}{{ filename }}" />
{% endblock %}
{% block main %} {% block main %}
<a href="{{ sitepath }}{{ selifpath }}{{ filename }}"> <a href="{{ sitepath }}{{ selifpath }}{{ filename }}">
<img class="display-image" src="{{ sitepath }}{{ selifpath }}{{ filename }}" /> <img class="display-image" src="{{ sitepath }}{{ selifpath }}{{ filename }}" />

View File

@ -1,5 +1,9 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block head %}
<meta property="og:video" content="{{ siteurl }}{{ sitepath }}{{ selifpath }}{{ filename }}" />
{% endblock %}
{% block main %} {% block main %}
<video class="display-video" controls autoplay> <video class="display-video" controls autoplay>
<source src="{{ sitepath }}{{ selifpath }}{{ filename }}" /> <source src="{{ sitepath }}{{ selifpath }}{{ filename }}" />