Use global switch to enable/disable preview images
This commit is contained in:
parent
878cc5cb17
commit
f206f61e9a
9 changed files with 99 additions and 63 deletions
|
@ -4,8 +4,7 @@
|
|||
{% block title %}{{ book|book_title }}{% endblock %}
|
||||
|
||||
{% block opengraph_images %}
|
||||
<meta name="twitter:image" content="{{ request_protocol }}{{ media_path }}{{ book.preview_image }}">
|
||||
<meta name="og:image" content="{{ request_protocol }}{{ media_path }}{{ book.preview_image }}">
|
||||
{% include 'snippets/opengraph_images.html' with image=book.preview_image %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
<meta name="og:description" content="{{ site.instance_tagline }}">
|
||||
|
||||
{% block opengraph_images %}
|
||||
<meta name="twitter:image" content="{{ request.protocol }}{{ media_path }}{{ site.preview_image }}">
|
||||
<meta name="og:image" content="{{ request.protocol }}{{ media_path }}{{ site.preview_image }}">
|
||||
{% include 'snippets/opengraph_images.html' %}
|
||||
{% endblock %}
|
||||
<meta name="twitter:image:alt" content="BookWyrm Logo">
|
||||
</head>
|
||||
|
|
12
bookwyrm/templates/snippets/opengraph_images.html
Normal file
12
bookwyrm/templates/snippets/opengraph_images.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{% if preview_images_enabled is True %}
|
||||
{% if image %}
|
||||
<meta name="twitter:image" content="{{ request.protocol }}{{ media_path }}{{ image }}">
|
||||
<meta name="og:image" content="{{ request.protocol }}{{ media_path }}{{ image }}">
|
||||
{% else %}
|
||||
<meta name="twitter:image" content="{{ request.protocol }}{{ media_path }}{{ site.preview_image }}">
|
||||
<meta name="og:image" content="{{ request.protocol }}{{ media_path }}{{ site.preview_image }}">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<meta name="twitter:image" content="{{ request.protocol }}{% if site.logo %}{{ media_path }}{{ site.logo }}{% else %}{{ static_path }}/images/logo.png{% endif %}">
|
||||
<meta name="og:image" content="{{ request.protocol }}{% if site.logo %}{{ media_path }}{{ site.logo }}{% else %}{{ static_path }}/images/logo.png{% endif %}">
|
||||
{% endif %}
|
|
@ -8,8 +8,7 @@
|
|||
{% block title %}{{ user.display_name }}{% endblock %}
|
||||
|
||||
{% block opengraph_images %}
|
||||
<meta name="twitter:image" content="{{ request_protocol }}{{ media_path }}{{ user.preview_image }}">
|
||||
<meta name="og:image" content="{{ request_protocol }}{{ media_path }}{{ user.preview_image }}">
|
||||
{% include 'snippets/opengraph_images.html' with image=user.preview_image %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue