Skip to content

Commit 6ce2bd6

Browse files
committed
Display pages: Add OpenGraph tags for media
1 parent e2a65a5 commit 6ce2bd6

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

display.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ func fileDisplayHandler(c web.C, w http.ResponseWriter, r *http.Request, fileNam
122122
"forcerandom": Config.forceRandomFilename,
123123
"lines": lines,
124124
"files": metadata.ArchiveFiles,
125+
"siteurl": strings.TrimSuffix(getSiteURL(r), "/"),
125126
}, r, w)
126127

127128
if err != nil {

templates/display/audio.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{% extends "base.html" %}
22

3+
{% block head %}
4+
<meta property="og:audio" content="{{ siteurl }}{{ sitepath }}{{ selifpath }}{{ filename }}" />
5+
{% endblock %}
6+
37
{% block main %}
48
<audio class="display-audio" controls preload='auto'>
59
<source src='{{ sitepath }}{{ selifpath }}{{ filename }}'>
610
<a href='{{ sitepath }}{{ selifpath }}{{ filename }}'>Download it instead</a>
711
</audio>
8-
{% endblock %}
9-
12+
{% endblock %}

templates/display/image.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{% extends "base.html" %}
22

3+
{% block head %}
4+
<meta property="og:image" content="{{ siteurl }}{{ sitepath }}{{ selifpath }}{{ filename }}" />
5+
{% endblock %}
6+
37
{% block main %}
48
<a href="{{ sitepath }}{{ selifpath }}{{ filename }}">
59
<img class="display-image" src="{{ sitepath }}{{ selifpath }}{{ filename }}" />
610
</a>
7-
{% endblock %}
11+
{% endblock %}

templates/display/video.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{% extends "base.html" %}
22

3+
{% block head %}
4+
<meta property="og:video" content="{{ siteurl }}{{ sitepath }}{{ selifpath }}{{ filename }}" />
5+
{% endblock %}
6+
37
{% block main %}
48
<video class="display-video" controls autoplay>
5-
<source src="{{ sitepath }}{{ selifpath }}{{ filename }}"/>
9+
<source src="{{ sitepath }}{{ selifpath }}{{ filename }}" />
610
<a href='{{ sitepath }}{{ selifpath }}{{ filename }}'>Download it instead</a>
711
</video>
8-
{% endblock %}
12+
{% endblock %}

0 commit comments

Comments
 (0)